This is the source code for round 1 - simulation car.
- Repository for car system: https://github.com/vietanhdev/autonomous-car-2020.
- Repository for road segmentation: https://github.com/vietanhdev/autonomous-car-2020-road-seg.
- Repository for traffic sign detection: https://github.com/vietanhdev/autonomous-car-2020-sign-detection.
- Previous version (2018 - with Watershed, Flood fill and HOG_SVM): https://github.com/vietanhdev/autonomous-car-2018.
- Resources: https://1drv.ms/u/s!Av71xxzl6mYZgdZp4HaKuMV4vIzqcA?e=eHUjyr.
- Team name: teamict
- Ubuntu 18.04
- Miniconda or Anaconda
- OpenCV 3.4.3: <scripts/install_opencv_3.sh>
- Install ROS Melodic - full desktop version: http://wiki.ros.org/melodic/Installation/Ubuntu
We need to initialize catkin workspace at the first time (build folders for projects).
cd main_ws
catkin_make
Add workspace to PATH:
echo "source !(pwd)/main_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
cd main_ws
conda env create -n cds -f environment.yml
conda activate cds
- rosbridge-suite
sudo apt-get install ros-melodic-rosbridge-server
cd main_ws
catkin_make
NOTE: Don't use conda environment here!!!
roslaunch teamict server.launch
Enter Team name: teamict
and server address: ws://localhost:9090
.
Open another Terminal and type:
conda activate cds
roslaunch teamict teamict.launch
OR
conda activate cds
rosrun teamict teamict_node.py
Because we could not use cv2.imshow()
to show image in this environment, <main_ws/src/teamict/src/debug_stream.py> is developed to view debug images.
Please use this command to open debug image viewer:
rosrun rqt_image_view rqt_image_view
- Source code for running car (we will mainly work here): <main_ws/src/teamict/src>.
- In that folder:
- teamict_node.py: main node file
- config.py: configuration file
- debug_stream.py: stream of debug images. Please see the usage in teamict_node.py
- image_processor.py: where to receive images and process.
- Pass
debug_stream
instance created inteamict_node.py
to any class you want to debug. - Create a stream for image using:
debug_stream.create_stream('<stream_name>', '<topic_path>')
debug_stream.create_stream('depth', 'debug/depth')
- Publish image:
debug_stream.update_image('<stream_name>', <image>)
debug_stream.update_image('depth', depth_image)
- Open debug image viewer:
rosrun rqt_image_view rqt_image_view
mkdir video_rgb
cd video_rgb
rosrun image_view image_saver image:=/teamict/camera/rgb _image_transport:=compressed
mkdir video_depth
cd video_depth
rosrun image_view image_saver image:=/teamict/camera/depth _image_transport:=compressed
In video_rgb
:
ffmpeg -framerate 25 -i left%04d.jpg -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p 01_rgb.mp4
In video_depth
:
ffmpeg -framerate 25 -i left%04d.jpg -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p 01_depth.mp4