rosRoboCar: Calibration and Setup
Roadmap
- Installation
- Calibration and Setup
- How it works
Camera calibration
-
Print a checkboard.
-
Make 10-15 camera images in different angles, distance from camera and position in the image.
-
Run a simple code.
-
Camera matrix, projection matrix and distortion coefficients should be printed in terminal.
-
Now the image can be undistorted.
All data should be added to
robocar_ws/src/donkeycar/config/camera_info.yaml
Steering a throttle calibration
Follow instructions.
All channels and PWM values should be added to
robocar_ws/src/donkey_actuator/config/servos.yaml
Add teleoperation
Keyboard control
Just install ros-noetic-teleop-twist-keyboard
Joystick control
-
Connect your joystick to a car.
-
test your joystick with original
donkey
software-
run
donkey createjs
command in~/mycar
directory -
map buttons with actions
-
modify
myconfig.py
to setCONTROLLER_TYPE="custom"
to use yourmy_joystick.py
controller -
run your car with
python3 manage.py drive --js
command
-
Record bag files
- Launch donkeycar on the car
roslaunch donkeycar teleop.launch
- On PC go to the folder
robocar_ws/src/path_from_image/bagfiles/
and record messages
rosbag record -a
# to record only image topic
rosbag record -O subset /raspicam/image/compressed
- If bag file has several topics , but you need only one, just filter rosbag with
rosbag filter subset.bag <NEW_NAME>.bag 'topic == "<YOUR_TOPIC>"'
- to extract image files from bag a create launch file with
<launch>
<node pkg="rosbag" type="play" name="rosbag" required="true" args="$(find path_from_image)/bagfiles/subset.bag"/>
<node name="extract" pkg="image_view" type="extract_images" respawn="false" required="true" output="screen" cwd="<FOLDER_TO_SAVE_IMAGES>">
<remap from="image" to="raspicam/image_raw"/>
</node>
</launch>
- to decompress images also run in terminal
rosrun image_transport republish compressed in:=raspicam/image raw out:=raspicam/image_raw