Description 💬
While dockerizing virtual_camera allows the code to be future-proofed, running it the ROS 2 node in a docker currently disallows it from communicating it with ROS systems outside of its container.
This defeats the purpose of dockerizing since virtual_camera would not be able to communicate with any ROS 2 systems when dockerized. Need to address to justify its use in future systems.
Steps To Reproduce 🔨
- Download the repository.
cd $HOME
git clone https://github.com/cardboardcode/virtual_camera.git --depth 1
- Build the docker image and container
# Build docker image
docker build --tag vcam_image .
# Build docker container
docker run -ti \
--name vcam_test_container \
-v $(pwd):/home/user/virtual_camera \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-u 0 \
vcam_image:latest /bin/bash
You should now be in the bash shell within the docker container.
- Build the package within docker container:
cd virtual_camera
bash scripts/build.bash
- Run virtual_camera ROS 2 node within docker container:
cd virtual_camera
bash scripts/run.bash
- In host, run showimage ROS 2 node of image_tools package:
source /opt/ros/humble/setup.bash
ros2 run image_tools showimage --ros-args --remap /image:=/virtual_camera/image_raw
Author's Notes: image_tools is a package that exists in ros2/demos
Expected Behaviour 🟢
An image should be displayed in the OpenCV window created by showimage ROS 2 node in host.
Actual Behaviour 🔴
No image was displayed by showimage ROS 2 node in host. When running ros2 topic list in host, unable to properly detect /virtual_camera/image_raw topic in host from container.
Remarks
This is in relation to a past issue the author have investigated before. Should be a quick fix.
Description 💬
While dockerizing virtual_camera allows the code to be future-proofed, running it the ROS 2 node in a docker currently disallows it from communicating it with ROS systems outside of its container.
This defeats the purpose of dockerizing since virtual_camera would not be able to communicate with any ROS 2 systems when dockerized. Need to address to justify its use in future systems.
Steps To Reproduce 🔨
You should now be in the bash shell within the docker container.
cd virtual_camera bash scripts/build.bashcd virtual_camera bash scripts/run.bashsource /opt/ros/humble/setup.bash ros2 run image_tools showimage --ros-args --remap /image:=/virtual_camera/image_rawExpected Behaviour 🟢
An image should be displayed in the OpenCV window created by showimage ROS 2 node in host.
Actual Behaviour 🔴
No image was displayed by showimage ROS 2 node in host. When running ros2 topic list in host, unable to properly detect /virtual_camera/image_raw topic in host from container.
Remarks
This is in relation to a past issue the author have investigated before. Should be a quick fix.