A ROS2 package that simulates a camera, providing ROS messages from playing a static video or image.
- OpenCV
- ROS2 Jazzy Jalisco
Run the command below.
git clone https://github.com/cardboardcode/virtual_camera.git --branch jazzy_devel --single-branch --depth 1 && cd virtual_camera
source /opt/ros/jazzy/setup.bash && colcon build
Run the commands below to run virtual_camera
ROS 2 node:
# For running without image-viewer
./scripts/run.bash
# For running with image-viewer
./scripts/show_image.bash
# Jump into a folder called data
cd data
# Move your intended video/image into this folder
# Create a symbolic link to video.
ln -sf <video_file_name> input_data
# Or create a symbolic link to image.
ln -sf <image_file_name> input_data
# You can choose not to do it manually by running the following script:
# Input the number of the input image shown in the script -
./scripts/set_input_data.bash
Run the following command to control the speed of the video
ros2 param set /virtual_camera FPS <an integer>
# Eg. ros2 pararm set /virtual_camera FPS 24
This section is for users who do not want to worry about installing all dependencies stated above.
Build the docker image.
docker build --tag vcam_image:jazzy .
Run the docker image.
bash scripts/2_create_docker_container.bash