Lane following (LF)
Contents
Lane following (LF
)#
What you will need
An assembled and initialized Duckiebot;
Wheels calibration completed;
Camera calibration completed;
Joystick demo has been successfully launched;
A Duckietown city loop, as detailed in the appearance specifications.
What you will get
A Duckiebot driving autonomously in a Duckietown city loop, without other vehicles, intersections, or obstacles.
Duckietown setup notes#
Before getting started, make sure your Duckietown is ready to go:
The layout adheres to the The Duckietown Operation Manual;
The lighting is “good”: ideally white diffused light. This demo relies on images from the camera and color detections, so avoid colored lights, reflections or other conditions that might confuse or blind the onboard image sensor;
Duckiebot setup notes#
Duckiebot in configuration DB21M, DB21J, or DB19.
The Duckiebot is powered on and connected to your network. You should be able to successfully ping it from your base station;
You are able to see what the Duckiebot sees;
You are able to remote control your Duckiebot;
The camera is calibrated;
Pre-flight checklist#
Place the Duckiebot inside a lane (driving on the right-hand side of the road), making sure it sees the lane lines;
Make sure no containers are running on the Duckiebot which use either the camera or the joystick. We will run these ROS nodes in a new container.
Demo instructions#
Start the lane following demo#
To start the lane following (LF
) demo:
dts duckiebot demo --demo_name lane_following --duckiebot_name ![DUCKIEBOT_NAME] --package_name duckietown_demos
It will take a minute for the demo to launch. You can check Portainer if all the containers started successfully, and their logs if any issues arise.
Start driving autonomously#
Run the keyboard controller (not necessary if you have a joystick set up instead) and press the indicated key to initialize the driving behavior:
dts duckiebot keyboard_control ![DUCKIEBOT_NAME]
Controls |
Joystick |
Keyboard |
---|---|---|
Start Lane Following |
R1 |
a |
Stop Lane Following |
L1 |
s |
In case intersections and/or red lines are present in the city layout, they will be neglected. The Duckiebot will drive across them like it is a normal lane.
You can regain control of the Duckiebot at any moment by stopping the demo using the (virtual) joystick. The demo can be resumed by pressing the start button.
Visualize the detected line segments#
This step is optional, and it provides a visualization of the line segments that the Duckiebot detects, and is useful to debug eventual weird behaviors.
Make the
lane_filter_node
publish all the image topics. Thestart_gui_tools
will provide a shell that is connected to the ROS agent:
dts start_gui_tools ![DUCKIEBOT_NAME]
Run
rqt_image_view
and select the/ROBOT_NAME/line_detector_node/debug/segments/compressed
. You should see something like this:Outcome of the line detector node
In
rqt_image_view
by selecting the/ROBOT_NAME/ground_projection_node/debug/ground_projection_image/compressed
you should see a top-down view of the detected segments:
Troubleshooting#
Troubleshooting
SYMPTOM
The demo does not respond why pressing the start or stop buttons
RESOLUTION
Make sure the keyboard controller window is actively selected
Troubleshooting
SYMPTOM
The Duckiebot does not move
RESOLUTION
Check if you can manually drive the Duckiebot
Try re-launching
dts duckiebot keyboard_control ![hostname]
Check if ROS messages are received on the robot on the
![hostname]/joy
topic
Troubleshooting
SYMPTOM
The Duckiebot does not stay in the lane, or overall exhibits a bad driving behavior
RESOLUTION
This can be due to a number of issues, e.g.: bad robot calibrations, bad perception of lines due to inappropriate lighting or non-respected appearance specifications of the town, and/or bad tunining of the lane PID controller. The best way to debug this is to:
Check
rqt_image_view
and look atimage_with_lines
.Check if you see enough segments. If not enough segments are visible, reset the Anti-Instagram filter.
Check if you see more segments and the color of the segments are according to the color of the lines in Duckietown
Check your camera calibrations are good.
Troubleshooting
SYMPTOM
The Duckiebot does not drive nicely through intersections
RESOLUTION
For this demo, there should not be any intersections in the city layout. Duckiebots will interpret intersections as “broken” lanes, perceiving less salient features, potentially compromising the state estimate hence causing the driving troubles.
Troubleshooting
SYMPTOM
The Duckiebot does not drive nicely through intersections
RESOLUTION
For this demo, there should not be any intersections in the city layout. Duckiebots will interpret intersections as “broken” lanes, perceiving less salient features, potentially compromising the state estimate hence causing the driving troubles.
Troubleshooting
SYMPTOM
The Duckiebot cuts white line while driving on inner curves (advanced)
RESOLUTION
This might be due to wrongly constructed lanes or bad Duckiebot calibrations. Fortunately, feedback control should take care of most of these problems.
While running the demo modify the PID controller gains from the base station through:
rosparam set /![DUCKIEBOT_NAME]/lane_controller_node/k_d -45
rosparam set /![DUCKIEBOT_NAME]/lane_controller_node/k_theta -11