Demonstrate how to use shared memory with image processing algorithms.
Note this is highly experimental and requires much clean up. It may still serve as an inspiration how to set up a computer vision app in ROS 2 with shared memory for high transmission efficiency.
As of today this package only supports ROS 2 Rolling.
ROS 2 Galactic is not supported due to some cmake command changes.
Also require yolov3 object detection parameters which are automatically downloaded at build time using the scripts/download_yolo_weights.sh
script.
TODO: more detail
-
Install ROS 2 Rolling
-
Clone the
shm_vision_demo
repo into yourcolcon_ws/src
directory -
Clone the
iceoryx
repo into yourcolcon_ws/src
directory - parallel with the repo you just cloned in step number two -
Build using
colcon build --packages-up-to shm_vision_demo
. While building it will automatically fetch theyolov3.weights
file from https://pjreddie.com/darknet/yolo/ and copy them to theshm_vision_demo/config
directory. The weights file is fairly large so it is not included in the repository but automatically downloaded during the build.
The following files are needed in the config/
directory:
coco.names
yolov3.cfg
yolov3.weights
(YOLOv3-320 for the right image size)
- Adapt the
ros2_ws
variable in thescripts/demo.sh
andscripts/shm_demo.sh
scripts as needed.ros2_ws
needs to point to the ROS 2 rolling workspace whereshm_vision_demo
andiceoryx
are located.
By default the provided demo.sh
and shm_demo.sh
scripts will try to use your devices camera running live. If for some reason you do not wish to use your camera, you may pass in an argument to each script specifying an .mp4
file to use instead.
cd shm_vision_demo/scripts
# to run on live camera connected to device
./shm_demo.sh
# to run demo on pre-recorded video
./shm_demo.sh ~/videos/my_cool_video.mp4
Ensure you are in the scripts directory: cd shm_vision_demo/scripts/
Run the ./demo.sh
script, it should start all applications and show the corresponding outputs.
Alternatively all (or a subset of) the applications can be started on their own (cf. parameterization in the script).
stop_demo.sh
stops all applications and the tmux session or alternatively enter ctrl+b
then kill-session
to kill the running tmux
session.
Run the shm_demo.sh
script, it should start all applications and show the corresponding outputs. This will automatically load the cyclonedds.xml
configuration. In addition the RouDi shared memory daemon will be started with the configuration roudi_config.toml
-
stop_demo.sh
stops all applications and the tmux session or alternatively enter ctrl+b
then kill-session
to kill the running tmux
session.
- more detailed explanation and system description
- clean up code and add more documentation
- proper installation (scripts, config, yolo etc.)
- extend to image pipeline, use ROS 2 executor (?)