项目作者: vietanhdev

项目描述 :
Autonomous car source code for FPT Digital Race (Cuộc Đua Số) 2020 - Round 1 - Simulation Car.
高级语言: C++
项目地址: git://github.com/vietanhdev/autonomous-car-2020.git
创建时间: 2020-07-26T17:01:59Z
项目社区:https://github.com/vietanhdev/autonomous-car-2020

开源协议:

下载


Autonomous car - FPT Digital Race (Cuộc Đua Số) 2020

This is the source code for round 1 - simulation car.

Demonstration video



I. Project Info:

  • Team name: teamict

II. Environment Setup

  • Ubuntu 18.04
  • Miniconda or Anaconda
  • OpenCV 3.4.3:

4. Robot Operating System

5. Initialize Catkin workspace

We need to initialize catkin workspace at the first time (build folders for projects).

  1. cd main_ws
  2. catkin_make

Add workspace to PATH:

  1. echo "source !(pwd)/main_ws/devel/setup.bash" >> ~/.bashrc
  2. source ~/.bashrc

6. Create Conda environment

  1. cd main_ws
  2. conda env create -n cds -f environment.yml
  3. conda activate cds

7. Dependencies:

  • rosbridge-suite
  1. sudo apt-get install ros-melodic-rosbridge-server

III. Build and Run

Step 1. Build project

  1. cd main_ws
  2. catkin_make

Step 2. Run ROS server and services

NOTE: Don’t use conda environment here!!!

  1. roslaunch teamict server.launch

Step 3. Run the simulator

Enter Team name: teamict and server address: ws://localhost:9090.

Step 4. Run car controller

Open another Terminal and type:

  1. conda activate cds
  2. roslaunch teamict teamict.launch

OR

  1. conda activate cds
  2. rosrun teamict teamict_node.py

Step 5. Launch debug image viewer

Because we could not use cv2.imshow() to show image in this environment, is developed to view debug images.

Please use this command to open debug image viewer:

  1. rosrun rqt_image_view rqt_image_view

Folder structure and debugging

Code structure

  • Source code for running car (we will mainly work here): .
  • 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.

How to publish debug images?

  • Pass debug_stream instance created in teamict_node.py to any class you want to debug.
  • Create a stream for image using: debug_stream.create_stream('<stream_name>', '<topic_path>')
  1. debug_stream.create_stream('depth', 'debug/depth')
  • Publish image: debug_stream.update_image('<stream_name>', <image>)
  1. debug_stream.update_image('depth', depth_image)
  • Open debug image viewer:
  1. rosrun rqt_image_view rqt_image_view

Record video

Step 1: Record images

  1. mkdir video_rgb
  2. cd video_rgb
  3. rosrun image_view image_saver image:=/teamict/camera/rgb _image_transport:=compressed
  1. mkdir video_depth
  2. cd video_depth
  3. rosrun image_view image_saver image:=/teamict/camera/depth _image_transport:=compressed

Step 2: Convert to videos

In video_rgb:

  1. ffmpeg -framerate 25 -i left%04d.jpg -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p 01_rgb.mp4

In video_depth:

  1. ffmpeg -framerate 25 -i left%04d.jpg -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p 01_depth.mp4

BUGS: