Sources for TurtleBot3 Auto - AutoRace 2017
This source code is for AutoRace 2017.
-
TurtleBot3 Burger
- ROS and dependent ROS packages needs to be installed in the robot
- All functions of TurtleBot3 Burger which is described in TurtleBot3 E-Manual needs to be tested before running TurtleBot3 Auto source code
-
Remote PC (Laptop, Desktop, etc.)
- ROS and dependent ROS packages needs to be installed in the computer
- All functions of TurtleBot3 Burger which is described in TurtleBot3 E-Manual needs to be tested before running TurtleBot3 Auto source code
-
Add-ons on TurtleBot3 Burger
- Raspberry Pi Camera Type G (Fisheye Lens) : Available Here
- See
Features of 4 screw holes
in the page very carefully before mounting on the frame of any conductive materials
- See
- Raspberry Pi Camera Mount
- Raspberry Pi Camera Type G (Fisheye Lens) : Available Here
- Track structure and Accessories, such as Traffic Signs, Traffic Lights, and other objects.
- Get Sources of AutoRace Referee system from autorace_referee
- Get 3D CAD model data of the race track from autorace_track
[Remote PC & TurtleBot SBC] Open new terminal, then enter
$ sudo apt-get install ros-kinetic-image-transport ros-kinetic-cv-bridge ros-kinetic-vision-opencv python-opencv libopencv-dev ros-kinetic-image-proc
-
- [Remote PC] Open new terminal, then enter
$ roscore
-
- [TurtleBot SBC] Open new terminal, then enter
$ roslaunch turtlebot3_autorace_camera turtlebot3_autorace_camera_pi.launch
-
- [Remote PC] Open new terminal, then enter
$ rqt_image_view
then, click /camera/image/compressed
or /camera/image/
topic in the select box. If everything works fine, the screen should show you the view from the robot.
-
- [Remote PC] Open new terminal, then enter
$ rosrun rqt_reconfigure rqt_reconfigure
then, click camera
, adjust the parameter value that makes the camera show clean, enough bright image to you. After that, overwrite each values on to the turtlebot3_autorace_camera/calibration/camera_calibration/camera.yaml
. This will make the camera set its parameters as you set here from next launching.
-
- [Remote PC] Open new terminal, then enter
$ roscore
-
- [TurtleBot SBC] Open new terminal, then enter
$ roslaunch turtlebot3_autorace_camera turtlebot3_autorace_camera_pi.launch
-
- [Remote PC] Print checkerboard for camera calibration on A4 size paper. The checkerboard is in
turtlebot3_autorace_camera/data/checkerboard_for_calibration.pdf
. See Calibration manual and modify the parameter value written inturtlebot3_autorace_camera/launch/turtlebot3_autorace_intrinsic_camera_calibration.launch
.
- [Remote PC] Print checkerboard for camera calibration on A4 size paper. The checkerboard is in
-
- [Remote PC] Open new terminal, then enter
$ export AUTO_IN_CALIB=calibration
$ roslaunch turtlebot3_autorace_camera turtlebot3_autorace_intrinsic_camera_calibration.launch
-
- [Remote PC] After finishing the calibration, intrinsic camera calibration file will be saved in
turtlebot3_autorace_camera/calibration/intrinsic_calibration/camerav2_320x240_30fps.yaml
.
- [Remote PC] After finishing the calibration, intrinsic camera calibration file will be saved in
-
- [Remote PC] Open new terminal, then enter
$ roscore
-
- [TurtleBot SBC] Open new terminal, then enter
$ roslaunch turtlebot3_autorace_camera turtlebot3_autorace_camera_pi.launch
-
- [TurtleBot SBC] Open new terminal, then enter
$ export AUTO_IN_CALIB=action
$ roslaunch turtlebot3_autorace_camera turtlebot3_autorace_intrinsic_camera_calibration.launch
-
- [Remote PC] Open new terminal, then enter
$ export AUTO_EX_CALIB=calibration
$ roslaunch turtlebot3_autorace_camera turtlebot3_autorace_extrinsic_camera_calibration.launch
-
- [Remote PC] Open new terminal, then enter
$ rqt
clicking plugins -> visualization -> Image view on the top of the screen will make extra monnitor for camera view. Make 2 extra monitor in the rqt plate by following it. Then, choose /camera/image_extrinsic_calib/compressed
and /camera/image_projected_compensated
topics on each of extra monitors. If everything works fine, one of the screen will show the image with red rectangle, and other one will show the ground projected view (bird's eye view) which is based on the one another.
-
- [Remote PC] Open new terminal, then enter
$ rosrun rqt_reconfigure rqt_reconfigure
then, adjust the parameter value in /camera/image_projection
and /camera/image_compensation_projection
that carries out visual modifications on the image. The parameter image_projection
will change the shape of the red rectangle of /camera/image_extrinsic_calib/compressed
image. Intrinsic camera calibration will transform the image surrounded by the red rectangle, and will show the image that looks from over the lane. After that, overwrite each values on to the yaml
files in turtlebot3_autorace_camera/calibration/extrinsic_calibration/
. This will make the camera set its parameters as you set here from next launching.
Until now, all the preprocess of image must have been tested.
-
- [Remote PC] Open new terminal, then enter
$ roscore
-
- [TurtleBot SBC] Open new terminal, then enter
$ roslaunch turtlebot3_autorace_camera turtlebot3_autorace_camera_pi.launch
-
- [TurtleBot SBC] Open new terminal, then enter
$ export AUTO_IN_CALIB=action
$ roslaunch turtlebot3_autorace_camera turtlebot3_autorace_intrinsic_camera_calibration.launch
-
- [Remote PC] Open new terminal, then enter
$ export AUTO_EX_CALIB=action
$ roslaunch turtlebot3_autorace_camera turtlebot3_autorace_extrinsic_camera_calibration.launch
From now, the following descriptions will mainly adjust feature detector / color filter
for object recognition. Every adjustment after here is independent to each other's process. However, to make sure, if you want to adjust each parameters in series, finish every adjustment perfectly, then continue to next.
-
- Put the robot on the lane. If you placed the robot correctly,
yellow line
should be placed on the left side of the robot, and of course,white line
should be placed on the right side of the robot. Make sure thatturtlebot3_robot
node ofturtlebot3_bringup
package is not yet launched. If it is on running, the robot will suddenly runs on the track.
- Put the robot on the lane. If you placed the robot correctly,
-
- [Remote PC] Open new terminal, then enter
$ export AUTO_DT_CALIB=calibration
$ roslaunch turtlebot3_autorace_detect turtlebot3_autorace_detect_lane.launch
-
- [Remote PC] Open new terminal, then enter
$ rqt
clicking plugins -> visualization -> Image view on the top of the screen will make extra monnitor for camera view. Make 3 extra monitor in the rqt plate by following it. Then, choose /detect/image_yellow_lane_marker/compressed
, /detect/image_lane/compressed
and /detect/image_white_lane_marker/compressed
topics on each of extra monitors. If everything works fine, left and right screen will show the filtered image of the yellow line and the white line, and the center screen will show the lane of where the robot should go. In the calibration mode, left and right screen will show white, and the center screen may show abnormal result. From here, you should adjust the filter parameters to show up correct lines and the direction.
-
- [Remote PC] Open new terminal, then enter
$ rosrun rqt_reconfigure rqt_reconfigure
then, adjust the parameter value in /camera/image_projection
and /camera/image_compensation_projection
that carries out visual modifications on the image. The parameter image_projection
will change the shape of the red rectangle of /camera/image_extrinsic_calib/compressed
image. Intrinsic camera calibration will transform the image surrounded by the red rectangle, and will show the image that looks from over the lane. After that, overwrite value on to the lane.yaml
file in turtlebot3_autorace_detect/param/lane/
. This will make the camera set its parameters as you set here from next launching.
Tip: calibration process of line color filtering is sometimes so-so difficult because of your physical environment which includes the luminance of light in the room, etc. Hence, you should have patience to carry out this procedure. To make everything quickly, put the value of turtlebot3_autorace_detect/param/lane/lane.yaml
on the reconfiguration parameter, then start calibration. Calibrate hue low - high value at first. (1) Hue value means the color, and every colors, like yellow
, white
, have their own region of hue value (refer to hsv map). Then calibrate saturation low - high value. (2) Every colors have also their own field of saturation. Finally, calibrate the lightness low - high value. (3) In the source code, however, have auto-adjustment function, so calibrating lightness low value is meaningless. Just put the lightness high value to 255. Clearly filtered line image will give you clear result of the lane.
-
- [Remote PC] After overwriting the calibration file, close
rqt_rconfigure
andturtlebot3_autorace_detect_lane
, then enter
- [Remote PC] After overwriting the calibration file, close
$ export AUTO_DT_CALIB=action
$ roslaunch turtlebot3_autorace_detect turtlebot3_autorace_detect_lane.launch
-
- Check if the results come out well by entering
[Remote PC]
$ roslaunch turtlebot3_autorace_control turtlebot3_autorace_control_lane.launch
[TurtleBot SBC]
$ roslaunch turtlebot3_bringup turtlebot3_robot.launch
After entering these commands, the robot will kick-off to run.
-
- Traffic sign detection needs some pictures of the traffic sign. Take their pictures by using
rqt_image_view
node and edit their size, shape by any ofphoto editor
available in linux. The node finds the traffic sign withSIFT algorithm
, so if you want to use your customized traffic signs ( which is not introduced in theautorace_track
), just be aware ofMore edges in the traffic sign gives better recognition results from SIFT
.
- Traffic sign detection needs some pictures of the traffic sign. Take their pictures by using
-
- Put the robot on the lane. At this time, the traffic sign should be placed to where the robot can see it easily. Make sure that
turtlebot3_robot
node ofturtlebot3_bringup
package is not yet launched. If it is on run, the robot may suddenly run on the track.
- Put the robot on the lane. At this time, the traffic sign should be placed to where the robot can see it easily. Make sure that
-
- [Remote PC] Open new terminal, then enter
$ rqt_image_view
then, click /camera/image_compensated
topic in the select box. If everything works fine, the screen should show you the view from the robot.
-
- [Remote PC] Take the picture by alt + print screen, edit the captured with your preferred photo editor. After that, place the picture to
[where the turtlebot3_autorace package you've placed]/turtlebot3_autorace/turtlebot3_autorace_detect/file/detect_sign/
and rename it as you want. (Although, you should change the file name written in the sourcedetect_sign.py
, if you want to change the default file names.)
- [Remote PC] Take the picture by alt + print screen, edit the captured with your preferred photo editor. After that, place the picture to
-
- [Remote PC] Open new terminal, then enter
$ roslaunch turtlebot3_autorace_detect turtlebot3_autorace_detect_sign.launch
-
- [Remote PC] Open new terminal, then enter
$ rqt_image_view
then, click /detect/image_traffic_sign/compressed
topic in the select box. If everything works fine, the screen will show the result of traffic sign detection, if it succeeds to recognize it.
-
- Put the robot on the lane. If you placed the robot correctly,
yellow line
should be placed on the left side of the robot, and of course,white line
should be placed on the right side of the robot. Make sure thatturtlebot3_robot
node ofturtlebot3_bringup
package is not yet launched. If it is on running, the robot will suddenly runs on the track.
- Put the robot on the lane. If you placed the robot correctly,
-
- [Remote PC] Open new terminal, then enter
$ export AUTO_DT_CALIB=calibration
$ roslaunch turtlebot3_autorace_detect turtlebot3_autorace_detect_traffic_light.launch
-
- [Remote PC] Open new terminal, then enter
$ rqt
clicking plugins -> visualization -> Image view on the top of the screen will make extra monnitor for camera view. Make 3 extra monitor in the rqt plate by following it. Then, choose /detect/image_yellow_light
, /detect/image_yellow_light
, /detect/image_yellow_light
and /detect/image_traffic_light
topics on each of extra monitors. If everything works fine, three screen will show the filtered image of the red / yellow / green light, and the other one will show the recognized color with short string. In the calibration mode, three screen will show white, and the other screen may show plain result. From here, you should adjust the filter parameters to show up correct lines and the direction.
-
- [Remote PC] Open new terminal, then enter
$ rosrun rqt_reconfigure rqt_reconfigure
then, adjust the parameter value in /detect_traffic_light
. Changing the value of color filter will show the change of filtered view on each color's screen. After that, overwrite value on to the traffic_light.yaml
file in turtlebot3_autorace_detect/param/traffic_light/
. This will set its parameters as you set here from next launching.
Tip: same as 1.3.4.1
-
- [Remote PC] After overwriting the calibration file, close
rqt_rconfigure
andturtlebot3_autorace_detect_traffic_light
, then enter
- [Remote PC] After overwriting the calibration file, close
$ export AUTO_DT_CALIB=action
$ roslaunch turtlebot3_autorace_detect turtlebot3_autorace_detect_traffic_light.launch
-
- Use
rqt_image_view
node, and check if the results come out well
- Use
-
Parking
needs only one preparation, traffic sign recognition.
-
- Place the dummy robot on either of parking lot.
-
- Place the robot on the lane appropriately.
-
- Level Crossing finds 3 red rectangles on the level, and calculates whether the level is opened or closed, and how much near the robot is come.
-
- Put the robot on the lane correctly. Then, bring the robot in front of closed level.
-
- [Remote PC] Open new terminal, then enter
$ export AUTO_DT_CALIB=calibration
$ roslaunch turtlebot3_autorace_detect turtlebot3_autorace_detect_level.launch
-
- [Remote PC] Open new terminal, then enter
$ rqt
clicking plugins -> visualization -> Image view on the top of the screen will make extra monnitor for camera view. Make 3 extra monitor in the rqt plate by following it. Then, choose /detect/image_level_color_filtered
and /detect/image_level
topics on each of extra monitors. If everything works fine, three screen will show the filtered image of the red rectangles, and another one will draw a line which connects the rectangles. In the calibration mode, a screen will show white, and the other screen may show plain result. From here, you should adjust the filter parameters to show up correct lines and the direction.
-
- [Remote PC] Open new terminal, then enter
$ rosrun rqt_reconfigure rqt_reconfigure
then, adjust the parameter value in /detect_level
. Changing the value of color filter will show the change of filtered view on each color's screen. After that, overwrite value on to the level.yaml
file in turtlebot3_autorace_detect/param/level/
. This will set its parameters as you set here from next launching.
Tip: same as 1.3.4.1
-
- [Remote PC] After overwriting the calibration file, close
rqt_rconfigure
andturtlebot3_autorace_detect_level
, then enter
- [Remote PC] After overwriting the calibration file, close
$ export AUTO_DT_CALIB=action
$ roslaunch turtlebot3_autorace_detect turtlebot3_autorace_detect_level.launch
-
- Use
rqt_image_view
node, and check if the results come out well
- Use
-
- Tunnel node will bring you from the entrance to the exit by using turtlebot3 navigation package. What you should calibrate is mapping the tunnel (or if you are using the autorace track as it is, you don't need to modify it by yourself) and check the
pose
of how the robot should be posed right before it comes out from tunnel (this is also unnecessary when you are using the default map).
- Tunnel node will bring you from the entrance to the exit by using turtlebot3 navigation package. What you should calibrate is mapping the tunnel (or if you are using the autorace track as it is, you don't need to modify it by yourself) and check the
-
- [Remote PC] Check the
pose
ofexit
on RViz, while theSLAM
orNavigation
package is running. After that, overwrite value on to thedetect_tunnel.py
fileline 144
- [Remote PC] Check the
-
- From now, all the related nodes will be run in
action mode
. Close allROS-related programs
andterminals
onRemote PC
andTurtleBot SBC
, if some were not closed yet. Then, put the robot on the lane correctly.
- From now, all the related nodes will be run in
-
- [Remote PC] Open new terminal, then enter
$ roscore
-
- [TurtleBot SBC] Open new terminal, then enter
$ roslaunch turtlebot3_bringup turtlebot3_robot.launch
-
- [TurtleBot SBC] Open new terminal, then enter
$ roslaunch turtlebot3_autorace_camera turtlebot3_autorace_camera_pi.launch
-
- [TurtleBot SBC] Open new terminal, then enter
$ export AUTO_IN_CALIB=action
$ roslaunch turtlebot3_autorace_camera turtlebot3_autorace_intrinsic_camera_calibration.launch
-
- [Remote PC] Open new terminal, then enter
$ export AUTO_EX_CALIB=action
$ roslaunch turtlebot3_autorace_camera turtlebot3_autorace_extrinsic_camera_calibration.launch
-
- [Remote PC] Open new terminal, then enter
$ export TURTLEBOT3_MODEL=burger
$ roslaunch turtlebot3_autorace_core turtlebot3_autorace_core.launch
-
- [Remote PC] Open new terminal, then enter
$ rostopic pub -1 /core/decided_mode std_msgs/UInt8 "data: 2"
turtlebot3_autorace_core will control all system in the package (open and close the launch, nodes in the package.)