Competition task: A real small car has to do at least 3 loops (a long loop to keep the lane or a loop to avoid obstacles) in a row without human intervention.
Robocar uses ROS1 Noetic and DonkeyCar. For testing and training purposes it can be run across multiple machines, when a car sends camera images and on computer I can visualize and work with them.
- Sensors:
- RaspberryPi Camera
- Motors (recieve only PWM signals):
- Throttle
- Steering
Currently on PC without a car a bagfile can be used.
-
Install on PC
-
Download bagfiles directory to
robocar_ws/src/path_from_image
-
Install tensorflow 2.2 (not the latest) with
pip install tensorflow==2.2
-
For GPU acceleration also install CUDA Toolkit 10.1 and CuDNN. Unzip to a suitable location and copy files to corresponding folders in
NVIDIA GPU Computing Toolkit\CUDA\v10.1
Check withpython -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
-
I could possibly forget some dependancies to be installed, like
scikit-learn
etc. -
Make all
.py
files executable. (Some files could be commited from Windows PC) -
Add empty
CATKIN_IGNORE
file toraspicam_node
so it will be not build -
Launch in
robocar_ws
# make sure catkin_make was executed prior
source devel/setup.bash
# launch bag-play, image-view and rviz
# to change bag-file just edit src/donkeycar/launch/bagdonkey.launch file
roslaunch donkeycar bagdonkey.launch
# in separate terminal
source devel/setup.bash
# and launch lane detection, which needs GPU acceleration
roslaunch donkeycar lanedetect.launch
-
Installation on PC and on a car
- Resolve connectivity problems if there are any.
-
(optional) Running ROS across multiple machines
-
Camera calibration. All data should be added to
robocar_ws/src/donkeycar/config/camera_info.yaml
-
Steering and throttle calibration. All channels and PWM values should be added to
robocar_ws/src/donkey_actuator/config/servos.yaml
-
Setup joystick control
-
Record bagfiles
- !!! On the competition site resolve all connectivity problems
- publish TF messages from URDF model
- URDF model of a car is in
src/donkeycar/config/car.xacro
- add
optical_camera_link
in the model due to different axis orientation - add
joint_state_publisher
androbot_state_publisher
nodes to the launch file to publish static TF messages. Transfomation betweenbase_footprint
andcamera_link_optical
should be possible
- URDF model of a car is in
- send image from camera
-
raspicam_node
publishesImageCompressed
andCameraInfo
messages with 30Hz rate. With a flag can also publishImageRaw
-
- image processing
- make undistortion faster as 20Hz, because it slows down everything else
- Lane detection, 2 variants
- Neural network
- get lots of images (bag)
- train network
- Traditional Computer Vision approach
- get matrices for transformation into 'top-view'
- make a binary treshold
- with a sliding window get points of lanes, make it faster then 25 Hz
- lanes are not always seen in the image
- fit polynomials
- draw a filled polygon
- get middle line points and draw them
- unwarp polygon image
- combine with weights original image with a filled polygon
- publish image with lane polygon and middle line points in the
camera_link_optical
frame - transform middle line points from
camera_link_optical
tobase_footprint
and publishPath
message
- Neural network
-
controller_node
get first point fromPath
message and transform toTwist
message (linear.x and angular.z) -
donkey_actuator_node
transformsTwist
message to PWM signals