DB21
DB21M
DB21
,DB21M
start_gui_tools
, ROS tools and no-vnc
DB17
DB18
DB19
Modified 2019-12-29 by ai404
This Demo provides general instructions to perform camera calibration in the Duckietown simulator.
Modified 2019-12-29 by ai404
Modified 2019-12-29 by ai404
$ git clone https://github.com/duckietown/challenge-aido_LF-baseline-duckietown
Modified 2019-12-29 by ai404
$ cd challenge-aido_LF-baseline-duckietown
Modified 2019-12-29 by ai404
.gitmodules
file.gitmodules
file.$ your_favourite_editor .gitmodules
change the url in line 3 from https://github.com/duckietown/gym-duckietown.git
to https://github.com/ai404/gym-duckietown.git
.
change the url in line 7 from https://github.com/duckietown/dt-core.git
to https://github.com/ai404/dt-core.git
.
save and close the file.
$ git submodule init
$ git submodule update --recursive
Don’t worry if you get an error saying that the “Server does not allow request for unadvertised object … Direct fetching of that commit failed.”
$ git submodule foreach "(git checkout daffy; git pull)"
Modified 2019-12-29 by ai404
Navigate to the 1_develop
directory and build the docker images:
$ cd 1_develop
$ docker-compose build
$ docker-compose up
Modified 2019-12-29 by ai404
If the docker image runs properly, you will be given a link to access a jupyter notebook connected to the now-running container. Open the jupyter notebook by following the link in a web browser. From the notebook, open a terminal, and perform the following commands in that terminal.
do not worry if you get a message saying “bash: catkin_ws/devel/setup.bash: No such file or directory” - we will deal with this in a couple of steps!
quickapp
$ pip install quickapp
systemCmd
to version 2.0
$ pip uninstall systemCmd
$ git clone --single-branch --branch p3 https://github.com/AndreaCensi/system_cmd
$ cd system_cmd
$ python setup.py install
$ cd ..
compmake
$ pip install -U git+https://github.com/AndreaCensi/compmake/
catkin_ws
$ catkin build --workspace catkin_ws
$ source catkin_ws/devel/setup.bash
Control-C the currently running Jupyter notebook. Manually kill the docker containers if necessary with docker ps
and docker kill CONTAINER ID
.
Modified 2019-12-29 by ai404
Modified 2019-12-29 by ai404
Change the map_name
parameter in 1_develop/utils/ros_helpers.py
from "loop_empty"
to "calibration_map_int"
.
Modified 2019-12-29 by ai404
From the 1_develop
directory, run
$ docker-compose up
Modified 2019-12-29 by ai404
Run the camera service in the Jupyter notebook terminal.
$ roslaunch pi_camera camera.launch veh:=default
Modified 2019-12-29 by ai404
$ xhost +
Modified 2019-12-29 by ai404
Get the container ID of the container running from the duckietown/dt-notebook:daffy
image. This can be done with the docker ps
command.
Modified 2019-12-29 by ai404
$ docker exec -it -u root -e DISPLAY=host.docker.internal:0 CONTAINER ID /bin/bash
In this terminal you now have a command prompt directly into the container. We do this (as opposed to using a terminal from the jupyter notebook) so that we can view the GUI for duckiebot calibration.
Modified 2019-12-29 by ai404
In this command prompt, run
$ roslaunch pi_camera intrinsic_calibration.launch veh:=default
When it launches you will get a window similar to the one you get when calibrating a real duckiebot. You can resize the window by dragging the bottom-right corner. The calibration will be performed automatically (it might take a minute!) (Figure 21.1)
When calibration has enough images, the CALIBRATE
button will turn from grey to green. Click on the CALIBRATE
button to perform distortion removal and intrinsic calibration. After calibration, the squares in the cube should appear rectified, and the horizon should appear flat. (Figure 21.2)
Once calibration has succeeded (Figure 21.3), the COMMIT
and SAVE
buttons will turn from grey to green:
SAVE
button generates a zip file at /tmp/calibrationdata.tar.gz
where you can find the images used to calibrate the camera’s intrinsics as well as a yaml file with calculated parameters.COMMIT
writes the calculated parameters directly to the apropriate path at /data/config/calibrations/camera_intrinsic/robot_name.yaml
using the set_camera_info
service.Note that the simulator uses a value of "default"
for robot_name
.
Control-C the currently running Jupyter notebook, and Control-D the currently running container. Manually kill the docker containers if necessary with docker ps
and docker kill CONTAINER ID
.
Modified 2019-12-29 by ai404
Modified 2019-12-29 by ai404
Change the map_name
parameter in 1_develop/utils/ros_helpers.py
to "calibration_map_ext"
.
From the 1_develop
directory, run
$ docker-compose up
and open a terminal in the resulting Jupyter notebook.
Modified 2019-12-29 by ai404
The default name of the robot will interfere with default homography. To avoid this issue, we rename the default homography file.
In the Jupyter notebook terminal, run
$ roslaunch pi_camera camera.launch veh:=default
Now, open a second Jupyter notebook terminal (from the same place you opened the first one, http://127.0.0.1:8888/tree), and run
$ cp /data/config/calibrations/camera_extrinsic/default.yaml /data/config/calibrations/camera_extrinsic/default_homography.yaml
Modified 2019-12-29 by ai404
To successfully save the calibration files, we must specify the project root folder. Again, in the Jupyter notebook terminal, run
$ export DUCKIETOWN_ROOT=/duckietown
Modified 2019-12-29 by ai404
Finally, in the Jupyter notebook terminal, run
$ rosrun complete_image_pipeline calibrate_extrinsics
To see the effect of the calibration, look in the duckietown/out-calibrate-extrinsics directory - there should now be new images similar to those shown below (Figure 21.4)
Control-C the currently running Jupyter notebook. Manually kill the docker containers if necessary with docker ps
and docker kill CONTAINER ID
.
Modified 2019-12-29 by ai404
Modified 2019-12-29 by ai404
Change the map_name
parameter in 1_develop/utils/ros_helpers.py
to "loop_empty"
.
$ docker-compose up
To successfully save the calibration files, we must specify the project root folder:
$ export DUCKIETOWN_ROOT=/duckietown
Modified 2019-12-29 by ai404
$ rosrun complete_image_pipeline single_image_pipeline
If calibration worked properly, you should see something like the following expected results (Figure 21.5)
The calculated extrinsic parameters are saved at /data/config/calibrations/camera_extrinsic/default.yaml
Control-C the Jupyter notebook. Manually kill the docker containers if necessary with docker ps
and docker kill CONTAINER ID
.