-
Notifications
You must be signed in to change notification settings - Fork 4
Tools
To sync to the robots, we use the nao_sync command. The best way to learn what it does is to read it (bin/nao_sync), but generally speaking you pass it a robot name and some flags depending on what you want to sync over. The important ones:
- -d: deletes what's on the robot
- -s: Does an initial sync (copies over the things we need in /etc/ for example).
- -a: Syncs libagent (note that on the robot you need to run
nao restart
if you change libagent) - -r: Syncs the runswift binary
Passing no args will sync the home folder of the robot over (which is all you need if you only change config files or python code): nao_sync myrobot
Many components of the perception code currently rely heavily on the colour calibration for the robot. For example, determining the robots on the fields uses the colours of the jersey's to determine the team they are on, as well as the field edge code using the green to determine where the edge of the field is. Therefore, a proper calibration of the robot is crucial to making sure that it is able to detect all components of the game.
One major constraint with a colour calibration is that it is so heavily dependent on the outside light. A change in the environment due to the sun being hidden by the clouds can cause significant loss in performance so trying to create a colour calibration that is highly adaptive can be a difficult task. It becomes easier the more you practice.
Note: it is recommended to connect to the robot via an Ethernet cable than the wireless as it is very slow to get the images
- File -> Connect to Nao
- Make sure that Raw Image is selected
- Select your Nao from the dropdown.
- Select the record button on the bottom left.
- You should now see movement on the overview tab
- When you are satisfied click stop, on the bottom left.
- File -> Save
- Save it as .ofn
You can now open this file to view it by going File -> Open.
There are two file concepts that need to be known when doing a colour calibration. The first is that the kernel represents all the colour matches that you have performed. An nnmc file is the outputted format that can be used for the robot. Simply the kernel is for editing the colour calibration and the nnmc is for using the colour calibration.
In the Kernel Options we can create a new kernel, load an old one or save the changes.
This creates a new kernel with no calibration settings, this would result in it thinking that any colour is unclassified. As you edit this it will start making changes in memory. To save these changes you can click save, this will overwrite your default kernel or save as to save it to a specific location. If you want to open a specific kernel you can use the open item. Note: You will only be making changes to the kernel that is selected in the radio boxes and using save/new will only affect the current camera. E.g. if I select save while top is selected only the top kernel is saved.
When saving the kernel an nnmc file is generated and placed into the correct position so the next time the robot is loaded it should have the latest calibration on it. If you use the kernel "Save as" the nnmc file is not generated.
If you want to save the changes of the current camera to an nnmc at a specific location you can select Calibration -> Save nnmc. ** This has the same behaviour as above in that it only saves the current camera you are on, either top or bottom. **
When you have your ofn file loaded you can now begin to make changes. The overlay section in the bottom right indicates what colour calibrations you are showing. For example:
- None: no calibrations shown (only the raw image)
- Selected: only the calibrated colour selected in the colour section will be shown
- Selected + Unclassified: currently selected colour and any unclassified colours
- All colours: all classified colours
- All + Unclassified: all classified colours and unclassified colours
The easiest way to assign a colour is to select the colour you want to define in the colour section, for example green, make sure that selected or selected + unclassified are set and click on the pixel that you think is green. When doing the colour calibration do not assign the colours by what you think the colour is but what the actual colour is. If your rights are coming out too red/green or blue you should look at changing your camera settings not adjusting you colour calibration to compensate for this.
When you click a pixel it will also change colours that are similar to this pixel to the assigned calibration as well. Therefore, you may see a lot of other pixels in the area or on other parts of the screen change to the selected colour. If it is defining to wide a range of pixel colours to the selected colour you can check the Auto-Weight Gaussians and this reduces the range of assignment, therefore good for fine tuning.
The default kernels loaded for the calibration are located at: /utils/kernels/top_kernel and /utils/kernels/bot_kernel. The nnmc files are located at /image/home/nao/data/top.nnmc.bz2 and /image/home/nao/data/bot.nnmc.bz2. Note the bz2 suffix So if you want to change the default calibrations those are the ones that you can replace. Use the default save does this automatically.
This use case can be when you have different calibrations for different robots because maybe one camera does not see certain colours as well, etc and you want to allow it to be version controlled and loaded independently depending on the robot that you are using.
The first approach is change the default for everyone. This can be done by changing options.cpp, e.g. the option vision.top_calibration to a different location.
You can also change the calibration used on the command line. @Sean how do you do this again in the command line runswift .
You can also define specific option files for specific robots in their config files. For example, in one of our robots we have defined the following config changes.
[player]
number=3
team=18
[vision]
bot_calibration=/home/nao/data/starbuck.nnmc
[touch]
gyrXOffset=-1.08
gyrYOffset=1.4
angleXOffset=-0.28
angleYOffset=-0.495
[kinematics]
cameraYawBottom=-1.2
cameraPitchBottom=2
cameraRollBottom=0
cameraYawTop=1.1
cameraPitchTop=0.65
cameraRollTop=-0.17
bodyPitch=2.12`
You can see that we have defined a specific bottom camera calibration for our starbuck robot. These are located at /image/home/nao/data/configs/<robotname>.cfg