Ucamserver
Introduction
Intended for image handling functions.
The following camera-related plug-ins are available:
- Camera control (camget, camset etc)
- Image access (imageget, imageset) access to fresh images.
- Image pool handling (poolget poollist etc.) pool of imege buffers with image handling functionality.
- Guidemark detection (gmkget) giudemark 3D pose and code
- Road outline plugin (pathget) polygon with road outline matching a seed area.
- Sample plugin (center of gravity)
The following cameras are supported:
- all USB cameras supported by the pwc (Philips Web Cam) driver, e.g.
- - Philips 740K, 840K,
- - Logitech Orbit
- A few frame-grapper cards (I have not tried for a long time)
- IEEE1394 DCI-standard
- IEEE1394 DVI - not supported
- palantir streaming video - not supported p.t.
Run the server
Run the server in a directory with a configuration file (ucamserver.ini)
ucamserver
It then shows a command prompt:
>>
To monitor images and results use the monitoring client UCLIENT or AUCLIENT (or the server console directly - or as a last resort TELNET)
See:
>> module list
For further help about the server and a list of all available commands (from all plug-ins) use:
>> help
Each of the listed commands should have an on-line help function, e.g:
>> camset help
Typical configuration SMR
A camera server configuration (ucamserver.ini) for the SMR could be:
server dataPath="/vhome/jca/logfiles" server imagepath="/vhome/jca/logfiles/imgorg" module load=var module load=gmk module load=odopose odopose log # camera parameters for GUPPY camera (device 10) camset device=10 focallength=650 camset device=10 posx=0.4 posy=0.0 posz=0.87 rotphi=0.3 module load=path # ballfinder and configuration module load="./aub2.so.0" var b2.redlim="105 127 129 180" var b2.bluelim="115 200 95 132" var b2.ballsize=0.12 var b2.topline=75 var b2.minsize=20 var b2.maxsize=65 # log images from device 10 camset device=10 log # use an image every 1.5 seconds (image is logged and available in image pool) push t=1.5 cmd="imageget img=10" # use the image to find balls every time image 10 is updated poolpush img=10 cmd="ball blue debug='true'"
Logfile for odometry and used images will then be produced in datapath, and the images saved in the imagepata.
These files cam be replayed for repeated function testing.
Image log
If imagelog is opened by:
>> server imagepath="/home/chr/chr/results" >> server datapath="/home/chr/chr/results" >> camset device=1 log Logfile renamed OK: mv /home/chr/chr/results/image.log /home/chr/chr/results/image20110502_125734.logg Logging images to /home/chr/chr/results/image.log <camset info="done"/> >> camset device=0 log <camset info="done"/>
all used images are saved (in imagepath) with timestamp and filename in the image.log (in the datapath) file (see log file format below). More than one camera can be logged in this way, e.g.:
>> campush device=0 i=10 cmd="imageget silent" >> campush device=1 i=10 cmd="imageget silent"
For the stereo camera GUPPY the cameras should be connected with a trigger cable. and both cameras set to external trigger
>> camset device=10 gain=auto shutter=auto >> camset device=11 gain=auto shutter=auto >> camset device=10 triggerExt=true; >> camset device=11 triggerExt=true; >> campush device=10 cmd="imageget rectImg=12 silent" >> campush device=11 cmd="imageget rectImg=13 silent"
Then trigger both cameras with a regular command like:
>> push t=0.5 cmd="camset device=11 trigger"
To trigger new images at a rate of 2Hz (t=0.5) in this case.
NB! the logging of images to a disk file takes time, so keep frame rate down. An alternative could be to let the imagepath to a RAM-disk, and (tar) pack and move the files to a diskfile at regular intervals. This seems to be much less demanding than to save all images directly to disk. There is an example of this solution in the bin/config_hako2 directory, using the aucron.so.0 plugin to trigger a bash script, like:
>> cron t=11 cmd="bash move-to-usbdisk '/mnt/ram/svs*' /rhome/demo/log"
This takes all files on the ram-disk that matches /mnt/ram/svs* and packs the files to a disk file at /rhome/demo/log. The bash script
To close the logging of images from a specific camera use
>> camset device=10 log=false
or
>> var
To close the log file for all cameras use the command
>> imageget log=false Closed image snapshot log /home/demo/results/image.log
Replay configuration
Make a directory for the replay configuration, e.g. replay/ballfinder:
mkdir ~/replay/ballfinder cd ~/replay/ballfinder
place a copy of the cameraserver configuration file ucamserver.ini in this directory.
Make a subdirectory in this directory, e.g. called log
mkdir log cd log
Place the logfiles (odoPose.log and image.log) in this directory
cp <sourcedir>/*.log .
Make a further subdirectory for the images, this directory MUST be called imgorg
mkdir imgorg cp <imagepath>/*.png imgorg/
The ucamserver.ini need to be modified slightly to enable the replay:
server dataPath="/vhome/jca/logfiles" server imagepath="/vhome/jca/logfiles/imgorg" server replayPath="/vhome/jca/replay/ballfinder" <--- new module load=var module load=gmk module load=odopose odopose replay <--- new # odopose log <--- changed to comment # camera parameters for GUPPY camera (device 10) camset device=10 focallength=650 camset device=10 posx=0.4 posy=0.0 posz=0.87 rotphi=0.3 camset device=10 replay <--- new module load=path # ballfinder and configuration module load="./aub2.so.0" var b2.redlim="105 127 129 180" var b2.bluelim="115 200 95 132" var b2.ballsize=0.12 var b2.topline=75 var b2.minsize=20 var b2.maxsize=65 # log images from device 10 # camset device=10 log=false <--- changed to comment # use an image every 1.5 seconds (image is logged and available in image pool) # push t=1.5 cmd="imageget img=10" <--- changed to comment # use the image to find balls every time image 10 is updated poolpush img=10 cmd="ball blue debug='true'"
Then the replay can commence, first start the camera server in the configuration directory
cd ~/replay/ballfinder ucamserver
When the cameraserver is started, then the stepping can start
>> camset step <camset info="Stepped to 1266588079.109762 line 2 in image.log"/> Ball position x: 4.1385 y: 0.5525 z: 0.2767 >>
This will advance to the next image in the logfile, and some messages may be printed on the console. The image will be loaded into the image-pool with the same image number as the original device number (here 10).
The odometry pose may be stepped too:
>> odopose step <odopose tod="1266588094.529696" time="15:01:34.529" logLine="2"/> >>
This may advance the image.log file too (to the same log-time), and thus trigger another image and any command related to that image.
Image.log file format
The image log file has one line per image, like:
1287579606.142885 159 120 160 1050.00 2 0.000 0.000 0.000 0.0000 0.0000 0.0000 img00000159-cam02-20101020_150006.142.png 1287579608.842862 186 120 160 1050.00 2 0.000 0.000 0.000 0.0000 0.0000 0.0000 img00000186-cam02-20101020_150008.842.png 1287579609.642899 194 120 160 1050.00 2 0.000 0.000 0.000 0.0000 0.0000 0.0000 img00000194-cam02-20101020_150009.642.png 1287579610.242894 200 120 160 1050.00 2 0.000 0.000 0.000 0.0000 0.0000 0.0000 img00000200-cam02-20101020_150010.242.png
and the following format on each line:
- timestamp (seconds since 1 jan 1970)
- image serial number
- image height
- image width
- camera focal length in pixels (as set in camera configuration file ucamserver.ini)
- camera device number (here device 2)
- camera x pose relative to robot (forward)
- camera y pose relative to robot (left)
- camera z pose relative to robot (up)
- camera Omega Rotation (in radians) around x-axis
- camera Phi Rotation (in radians) around y-axis
- camera Kappa Rotation (in radians) around z-axis
- image filename
Odometry logfile format
The odopmetry - as well as the map and utm logfiles has the following format:
1266588182.049364 0.593 0.114 0.46900 0.000 -1 1266588182.049630 1266588182.119369 0.604 0.119 0.48700 0.000 -1 1266588182.119790 1266588182.189390 0.614 0.125 0.50450 0.000 -1 1266588182.189852 1266588182.269268 0.625 0.131 0.52320 0.000 -1 1266588182.269529 1266588182.457870 0.647 0.144 0.56050 0.000 -1 1266588182.458362
With the following meaning
- timestamp in seconds (when the data is assumed to be valid)
- x-position in meters
- y-position in meters
- heading in radians
- velocity in m/s
- data quality (if any)
- data source (update source, -1 is from MRC using the MRC connection to the server)
- additional timestamp (when the data was put into the logfile)