We aim to do map-free lane following in this project. We change the existing Duckietown lane following stack by introducing trajectory generation and a pure pursuit controller.
To test the code, first clone the project GitHub repository.
git clone git@github.com:kumaradityag/fp-controlThese instructions assume you have the following:
- A duckietown-shell. You can verify that you have sucessfully installed
it using
dts --version. If that’s not the case, please follow the instructions here - You have created your virtual duckiebot. You can verify that your
virtual duckie exists with the command
dts duckiebot virtual start vbotand thendts fleet discover.vbotis the name of our virtual duckie, but feel free to replace it with your own virtual duckie name - You have your real life duckiebot setup. This step is only required if you want to test the demo in real life. If you want to get your duckie hardware, see the official documentation here
The most important directories of our projects are
packages/trajectory_planner and packages/pure_pursuit_control, which
are where our trajectory generation code and our pure pursuit code live.
Virtual and physical duckiebot can behave slightly differently because of real-world physics, so they respond to the same parameters differently. Additionally, in our current setup, driving in the inner or outter lane also require different parameters. Therefore, you will probably need to tune your parameters for your own duckiebot.
The configs for the trajectory planner and the pure pursuit controller
can be found respectively inside
packages/trajectory_planner/config/trajectory_planner_node/default.yaml
and
packages/pure_pursuit_control/config/pure_pursuit_control_node/default.yaml.
Additional config information is present at the bottom.
You will need at least three terminals to spin and view everything
needed. Replace <duckie_name> with your duckiebot name.
Preliminaries (in every terminal):
# Set robot name
export ROBOT_NAME=<duckie_name>Preliminaries for the matrix (if needed):
dts matrix run --standalone --map ./assets/duckiematrix/map/loop/
dts matrix attach $ROBOT_NAME map_0/vehicle_0All these other commands need to run from the project repository:
In terminal 1:
dts devel build -H $ROBOT_NAME -fIn terminal 2:
# To view the debug images
dts duckiebot image_viewer $ROBOT_NAMEIn terminal 3:
# For emergency stop
dts duckiebot keyboard_control $ROBOT_NAMEIn terminal 4:
# If you want to manually change some of the param values
ssh duckie@<duckie_name>.local
# After logging into your duckiebot:
docker exec -it ros-interface bash
rosparam list | grep <param_search_query>
rosparam set <param_name> <value>In terminal 1:
# For physical duckie
dts devel run -H $ROBOT_NAME -L lane-following-carrot-physical-outer
dts devel run -H $ROBOT_NAME -L lane-following-carrot-physical-inner
# For virtual duckie
dts devel run -H $ROBOT_NAME -L lane-following-carrot-virtual-outer
dts devel run -H $ROBOT_NAME -L lane-following-carrot-virtual-inner# For physical duckie
dts devel run -H $ROBOT_NAME -L lane-following-tangent-physical-outer
dts devel run -H $ROBOT_NAME -L lane-following-tangent-physical-inner
# For virtual duckie
dts devel run -H $ROBOT_NAME -L lane-following-tangent-virtual-outer
dts devel run -H $ROBOT_NAME -L lane-following-tangent-virtual-innerThe trajectory planner node has the following config parameters:
min_forward: minimum distance at which we consider trajectory pointsmax_forward: maximum distance at which we consider trajectory pointsn_samples: number of samples used for ransaclane_width: width of the lane in metersepsilon: error around lane widthyellow_pts_threshold: minimum points in the trajectory for the yellow lane to be validwhite_pts_threshold: minimum points in the trajectory for the white lane to be validdefault_mode: relying on WHITE/YELLOW laneransac_max_iterations: number of iterations for ransac to compute inliersransac_distance_threshold: max error to separate inliers from outliers (in m)poly_degree: polynomial degree for ransacbuffer_size: number of previous trajectory saved in bufferbuffer_smooth_alpha: float number between 0-1 used to smooth out current trajectory based on the previous onebuffer_theta_threshold: theta angle threshold for heading change in degrees
The pure pursuit control node has the following config parameters:
lookahead_distance: distance at which the pure pursuit controller look ahead (in cm)v_bar: linear velocityv_bar_max: maximal linear velocityv_bar_min: minimal linear velocitywidth: chassis width of the duckie. Should stay 0.1omega_factor: how hard we want the duckie to turn