Skip to content

Colortable DarwinOP

coco66 edited this page Oct 10, 2014 · 1 revision

This page addresses the following topics related to the vision system on Darwin OPs-

  • Changing camera parameters
  • Recording logs
  • Creating color tables from logs by learning important colors
  • Using these color tables on the Darwin OP robots

Preparation for the Robot

  • SSH into the robot with X support

ssh -X darwin@<robot IP>

  • Kill all screens with killall screen

  • Run guvcview, a program that shows the camera feed and allows you to change the brightness, saturation, etc. guvcview

Note: If you cannot run guvcview, check that you SSHed with the -X flag on.

  • Modify the brightness, contrast and saturation. Generally we keep contrast around 2 or 3, to enhance the pure colors so that everything else is in a 'haze'. Take a screen shot of the window showing all the parameters.You should use these values for the colorable you will make.

  • To compile, cd to /UPennDev/Lib/Modules/Util/Z and then make

  • Go back to /UPennDev/Lib and then make clean then make setup_op

  • Now you will check the robot works: cd to /UPennDev/Player Create separate screens and execute files screen -S dcm -> lua run_dcm.lua ::: Head values should not be stayed at 0.0 Detach the screen screen -S vcm -> lua run_cognition.lua Detach the screen screen -S demo -> lua test_vision.lua In this window you should be able to press the following keys to make the robot do:

    8 : Make robot stand up and walk

    8 again : Make the robot stand still

    9 : Make the robot walk once it is standing

    7 : Make robot sit

    w, a, x, d : rotate head

    s : center head

    3 : set head to scanning mode

    i, j, k, l : Move the robot around

*Let the robot stand up and then go to the next step

Make Colortables

  • The next step is on Matlab. In your local UPennDev folder, check your current branch. master branch may not have mex folder. If you are in master branch, change the branch into git checkout Dev2014_jit then git pull

  • Make sure you have MEX setup properly on your computer. The mex program should be able to run from your terminal. If you are not able to do so, make sure you have a symbolic link to <matlab-path>/bin/mex in your /usr/local/bin folder. Also, add the following line to your ./.bashrc file:

export PATH=<matlab-path>/bin:"$PATH"

*cd to UPennDev/Tools/Matlab/util then make *cd to /Matlab/mex then make *cd to /Matlab and type matlab -nodesktop -nosplash to open MATLAB

  • After MATLAB starts

    startup

  • At this point, open another terminal and cd to /UPennDev/Player in your local computer. Run lua listen_monitor.lua

  • Go to the robot's terminal and the demo screen (screen -r demo) and then run lua test_vision.lua again. Press g and Make sure that your Broadcast : 1. Do not execute Monitor until you receive signals at listen_monitor.lua. You should see messages showing the frame rate at which the computer receives data. This means the computer is now listening to the data being sent by the robot.

  • Go to your MATLAB terminal and

Monitor

  • Then, you can see the monitor of MATLAB
  • Click LOG -> get image shots while changing the robot’s view or environments -> stop LOG -> Shut down the window
  • Go to the MATLAB terminal

clear all colortable (This should open a GUI where you can load logs and learn important colors.)

  • Go to the new window and click Load Montage. Your log files should be in /Matlab/logs. Open the one of the recent files.

  • Set the Threshold value: around 10 or below for tracking "orange"

  • The four buttons at the bottom of the GUI allow you to navigate frame-by-frame through the log.

  • Make the program learn a color by clicking on that pixel. We recommend this procedure-

    1. Start with the ball. Go through all the logs and learn all the colors corresponding to all shades of the ball. Save this log by clicking on Save Colors with a name as like ‘OP_GraspAug12-time.raw’.
    2. Repeat the same procedure for both the goalposts. Save the ball and goalpost colors.
    3. Mark everything else as field. Finally, save all the colors. Also create the look-up table corresponding to these colors by clicking on Save LUT.
    4. Close the colortable GUI.
  • Go to your PC’s terminal

clear all  (IMPORTANT) Then, you can see the file you saved at the /Matlab on your local computer.

Using these color tables on the Darwin OP robots

  • Copy the file to the robot, scp _yourfilename_.raw <robot username>@<robot IP>:~/UPennDev/Player/Data/ (robot username is 'darwin' except for Linus. Linus' username is 'linus')

  • Go to the robot’s terminal and Check the file at /Player/Data

  • cd to /Player/Config and view Config.lua

  • Check: “Location Specific Camera Parameters” part. params.Camera = “……” <- currently used. For example, if it is “Eindhoven_C_noon”, then cd to /Config/Camera and view Config_OP_Camera_Eindhoven_C_noon.lua Change the file as: --camera.lut_file = 'field_C_noon_corrected.raw'; camera.lut_file=‘colortable_filename.raw’;   <——what we want to use

*****For emergency, use Config_OP_Camera_Grasp_lowE_pink.lua' and (inside) camera.lut_file = 'lut_low_contrast_pink_n_green.raw’;`

Clone this wiki locally