Skip to content

Commit

Permalink
More changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaCensi committed Sep 28, 2018
1 parent 554b520 commit 8333518
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ keyboard control

On your laptop run:

laptop $ dts keyboard_control ![DUCKIEBOT_NAME]
laptop $ dts keyboard_control ![Duckiebot name]

Note: Currently not working for Mac OSX - the window pops up but the robot won't move - this is expected for now

Expand Down Expand Up @@ -99,7 +99,7 @@ Run the base image on the duckiebot:

Then when the container has started

duckiebot $ (docker) roslaunch duckietown joystick.launch veh:=![duckiebot name]
duckiebot $ (docker) roslaunch duckietown joystick.launch veh:=![Duckiebot name]


#### Controlling your robot with a joystick
Expand All @@ -112,7 +112,7 @@ You can now use your joystick to move things around
If you have cloned the repo on your laptop and installed ROS, then you can start the keyboard controller interface with


laptop $ make virjoy-![DUCKIEBOT_NAME]
laptop $ make virjoy-![Duckiebot name]


## Option 3 - Pure ROS {#make-it-move_ros status=deprecated}
Expand Down Expand Up @@ -158,7 +158,7 @@ ssh into your robot and run:
Now on your laptop run:


laptop $ make virjoy-![DUCKIEBOT_NAME]
laptop $ make virjoy-![Duckiebot name]


Note: you need to have `pygame` installed, see the [README](https://github.com/duckietown/Software/tree/master18/misc/virtualJoy)
Expand Down Expand Up @@ -254,7 +254,7 @@ Don't worry though, we can still see the printouts using `rqt_console`.
On the laptop run:


laptop $ dts start_gui_tools ![DUCKIEBOT_NAME]
laptop $ dts start_gui_tools ![Duckiebot name]



Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See What Your Duckiebot Sees {#read-camera-data status=ready}
# See what your Duckiebot sees {#read-camera-data status=ready}


<div class='requirements' markdown='1'>
Expand Down Expand Up @@ -68,7 +68,7 @@ You should see of output that ends with:
Now start the GUI tools container in a different terminal:


laptop $ dts start_gui_tools ![DUCKIEBOT_NAME]
laptop $ dts start_gui_tools ![Duckiebot name]


The container will start. At the prompt, run:
Expand All @@ -80,7 +80,7 @@ The container will start. At the prompt, run:
The command should open a window where you can view the image.
You have to select the right topic from the dropdown menu.

## Verifying the output by
## Verifying the output by using the ROS utilities

Close the `rqt_image_view` window and type the next commands in the same
window.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# Camera calibration and validation {#camera-calib status=ready}

<div class='requirements' markdown='1'>
This section describes the instrinsics and extrinsics calibration procedures.

<div class='requirements' markdown='1'>

Requires: You can see the camera image on the laptop. The procedure is documented in
[](#read-camera-data).

Results: Calibration for the robot camera.

</div>


## Intrinsic Camera Calibration {#intrinsic-camera-calibration}
## Materials

### Setup
Download and print a PDF of the calibration checkerboard:

- [US Letter](https://github.com/duckietown/Software/blob/master18/catkin_ws/src/00-infrastructure/duckietown/config/baseline/calibration/camera_intrinsic/calibration_pattern.pdf).

TODO: create the A4 version

Download and print a PDF of the calibration checkerboard [US Letter](https://github.com/duckietown/Software/blob/master18/catkin_ws/src/00-infrastructure/duckietown/config/baseline/calibration/camera_intrinsic/calibration_pattern.pdf)).
Fix the checkerboard to a planar surface.

<div figure-id="fig:calibration_checkerboard" figure-caption="">
<img src="calibration_checkerboard.png" style='width: 20em'/>
Expand All @@ -26,31 +28,42 @@ Download and print a PDF of the calibration checkerboard.

Note: the squares must have side equal to 0.031 m = 3.1 cm. Please measure this, as having the wrong size will make your Duckiebot crash.

Note: If you live in Europe you probably have A4 paper. Print with scale = 100%. And do measure the sides of the squares before calibration.

Fix the checkerboard to a rigid planar surface that you can move around.

Warning: If the pattern is not rigid the calibration will be useless.


Fix the checkerboard to a planar surface.
### Optional material

### Calibration
You will also need a "lane" during the extrinsics calibration procedure.
This is not 100% necessary.


## Start calibration program

Make sure your Duckiebot is on, and both your laptop and Duckiebot are connected to the duckietown network.

These commands assume that you have completed the steps in [](#docker-setup),
and in particular that you set `DOCKER_HOST` correctly and can use `docker ps` successfully.

and in particular that you set `DOCKER_HOST` correctly.

#### Docker

Make sure your camera is on and the images are being published to ROS
using the `rpi-duckiebot-ros-picam` container:

laptop $ docker run -it --name ros-picam --net host --privileged -v /data:/data duckietown/rpi-duckiebot-ros-picam:master18
laptop $ docker run -it --name ros-picam --network=host --device /dev/vchiq -v /data:/data duckietown/rpi-duckiebot-ros-picam:master18

Note in particular the switch `-v /data:/data`. It was not really needed before, but now it is essential because it is this container that will save the intrinsic calibration files to the `/data` directory.

On your laptop run:

laptop $ dts calibrate ![DUCKIEBOT_NAME]
laptop $ dts calibrate ![Duckiebot name]

Hit <kbd>Enter</kbd>.
Hit <kbd>Enter</kbd> and follow the instructions.


<!--
#### ROS {status=deprecated}
Expand All @@ -68,15 +81,20 @@ In the second laptop terminal run the camera calibration:
laptop $ cd ![duckietown root]
laptop $ source environment.sh
laptop $ source set_ros_master.sh ![robot name]
laptop $ roslaunch duckietown intrinsic_calibration.launch veh:=![duckiebot name]
laptop $ roslaunch duckietown intrinsic_calibration.launch veh:=![Duckiebot name]
-->

Whether you did the Docker way or the ROS way you should see a display screen open on the laptop ([](#fig:intrinsic_callibration_pre)).
## Perform intrinsics calibration {#intrinsic-camera-calibration}

You should see a display screen open on the laptop ([](#fig:intrinsic_callibration_pre)).

<div figure-id="fig:intrinsic_callibration_pre" figure-caption="">
<img src="intrinsic_callibration_pre.png" style='width: 30em'/>
</div>

### Calibration dance

Position the checkerboard in front of the camera until you see colored lines
overlaying the checkerboard. You will only see the colored lines if the entire
checkerboard is within the field of view of the camera.
Expand All @@ -92,7 +110,8 @@ current range of the checkerboard in the camera's field of view:

Also, make sure to focus the image by rotating the mechanical focus ring on the lens of the camera.

Comment: Do not change the focus during or after the calibration, otherwise your calibration is no longer valid. I'd also suggest to not to use the lens cover anymore; removing the lens cover changes the focus. -MK
Warning: Do not touch the focus anymore, ever, as it will invalidate calibration.


Now move the checkerboard right/left, up/down, and tilt the checkerboard
through various angles of relative to the image plane. After each movement,
Expand All @@ -106,6 +125,8 @@ Calibration may take a few moments. Note that the screen may dim. Don't worry, t
<img src="intrinsic_calibration_calibratestep.png" style='width: 30em'/>
</div>



### Save the calibration results

If you are satisfied with the calibration, you can save the results by pressing the "COMMIT" button in the side bar. (You never need to click the "SAVE" button.)
Expand All @@ -117,40 +138,51 @@ If you are satisfied with the calibration, you can save the results by pressing
This will automatically save the calibration results on your Duckiebot:

```
/data/config calibrations/camera_intrinsic/![duckiebot name].yaml
/data/config/calibrations/camera_intrinsic/![Duckiebot name].yaml
```

If you are running the file server through docker you can view or download the calibration file at the address: `http://![duckiebot name].local:8082/config/calibrations/camera_intrinsic/![duckiebot name].yaml`
If you are running the file server through docker you can view or download the calibration file at the address: `http://![Duckiebot name].local:8082/config/calibrations/camera_intrinsic/![Duckiebot name].yaml`


### Keeping your calibration valid

Warning: Do not change the focus during or after the calibration, otherwise your calibration is no longer valid.

Warning: Do not use the lens cover anymore; removing the lens cover changes the focus.

## Extrinsic Camera Calibration {#extrinsic-camera-calibration}


### Setup {#camera-calib-jan18-extrinsics-setup}

Arrange the Duckiebot and checkerboard according to [](#fig:extrinsic_setup2). Note that the axis of the wheels should be aligned with the y-axis ([](#fig:extrinsic_setup2)).
Arrange the Duckiebot and checkerboard according to [](#fig:extrinsic_setup2). Note that the axis of the wheels should be aligned with the y-axis.

<div figure-id="fig:extrinsic_setup2" figure-caption="">
<img src="extrinsic_setup.jpg" style='width: 30em'/>
</div>


[](#fig:extrinsic_view2) shows a view of the calibration checkerboard from the Duckiebot. To ensure proper calibration there should be no clutter in the background and two A4 papers should be aligned next to each other.
[](#fig:extrinsic_view2) shows a view of the calibration checkerboard from the Duckiebot. To ensure proper calibration there should be no clutter in the background.

<div figure-id="fig:extrinsic_view2" figure-caption="">
<img src="extrinsic_view.jpg" style='width: 30em'/>
</div>



### Calibration
### Docker

If you ran

$ dts calibrate ![Duckiebot name]

### Docker
then the same terminal will immediately take you into the extrinsic calibration step. After the following Setup step, push <kbd>Enter</kbd>.

If you ran `dts calibrate ![duckiebot name]` then the same terminal will immediately take you into the extrinsic calibration step. After the following Setup step, push <kbd>Enter</kbd>.
TODO: make this a separate procedure, so that we can re-do the extrinsics without re-doing the intrinsics.


<!--
### ROS - Extrinsic calibration procedure {#camera-calib-jan18-extrinsics status=deprecated}
Run the following on the Duckiebot:
Expand All @@ -160,21 +192,28 @@ Run the following on the Duckiebot:
Followed by the following command for verification:
duckiebot $ rosrun complete_image_pipeline single_image_pipeline

-->

### Verifying the Results

#### Docker
If you are running the file server you can view or download the files at

If you are running the file server you can view or download the files at `http://![duckiebot name].local:8082/`
In that directory there are the results of the testing and the actual calibration files. The calibration file is at `http://![duckiebot name].local:8082/config/calibrations/camera_extrinsic/![duckiebot name].yaml`
http://![Duckiebot name].local:8082/


TODO: and what if not? need to put here instructions, or make it a default container.

You can also see the output of the diagnostics at `http://![duckiebot name].local:8082/out-calibrate-extrinsics-YYYYMMDDHHMMSS/`
In that directory there are the results of the testing and the actual calibration files. The calibration file is at

http://![Duckiebot name].local:8082/config/calibrations/camera_extrinsic/![Duckiebot name].yaml

It should look like [](#fig:calibrate_extrinsics1).
You can also see the output of the diagnostics at

http://![Duckiebot name].local:8082/out-calibrate-extrinsics-YYYYMMDDHHMMSS/


It should look like [](#fig:calibrate_extrinsics1).

<div figure-id="fig:calibrate_extrinsics1" figure-caption="">
<img src="2_2_2_camera/calibrate_extrinsics1.jpg" style='width: 90%'/>
</div>
Expand Down Expand Up @@ -215,12 +254,14 @@ It usual achieves impressive calibration results!
</div>
-->

### Optional verification step

Next Place the robot in a lane.

This step needs a Duckietown lane. If you don't have it, skip it.

Place the robot in a lane when instructed.

What this does is taking one snapshot and performing localization on that single image.

The output will be useful to check that everything is ok.

[](#fig:oneshot1_all) is an example in which the calibration was correct, and the robot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,4 @@ The first time you save the parameters, this command will create the file
### Final Check to make sure it's stored


Assuming your are running an HTTP server, point your browser to `http://![duckiebot name].local:8082/config/calibrations/kinematics/![duckiebot_name].yaml`
Assuming your are running an HTTP server, point your browser to `http://![Duckiebot name].local:8082/config/calibrations/kinematics/![Duckiebot name].yaml`

0 comments on commit 8333518

Please sign in to comment.