diff --git a/Dockerfile b/Dockerfile index 2071bf7..bb1b4c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ RUN apt-get update && apt-get install -y \ python3-pip \ && rm -rf /var/lib/apt/lists/* +# Install ROS2 plugins RUN apt-get install -y \ ros-foxy-ros2bag \ ros-foxy-rosbag2-converter-default-plugins \ @@ -26,8 +27,7 @@ RUN mkdir -p /bag_files # Install python packages RUN pip3 install --upgrade pip -RUN pip3 install numpy matplotlib scipy scikit-learn -RUN pip3 install h5py torchvision==0.16.2 torch==2.1.2+cpu -f https://download.pytorch.org/whl/torch_stable.html +RUN pip3 install numpy RUN rm -rf /root/.cache/pip # Clone the ros2-vicon-receiver package diff --git a/README.md b/README.md index ffe13f2..7297070 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ This Docker image is designed to provide a pre-configured environment for roboti ## Features - ROS2 Foxy desktop installation + - Python 3.8 (installed with ROS2 docker image) - Vicon SDK and necessary dependencies - Pre-configured for integration between ROS2 and Vicon systems - Suitable for robotics research and development involving motion capture @@ -69,6 +70,7 @@ To find more details on how to use Docker, please refer Docker's official docume | ------------ | ------------ | ----------- | | `-i` | | keeps `STDIN` open even if not attached, allowing for interactive use | | `-t` | | allocates a pseudo-TTY, which provides an interactive shell in the container | + | `-v` | `:` | Mount the host volume to container | | `--rm` | | automatically removes the container when it exits. It's useful for creating temporary containers that clean up after themselves | | `--entrypoint` | `bash` | overrides the default entrypoint of the container with bash. It means that instead of running whatever command was specified as the default in the `Dockerfile`, the container will start a bash shell. | | | `` | name of the Docker image to use for creating the container. @@ -160,44 +162,62 @@ docker run -it --rm ros2 launch vicon_receiver mock_client.launch.py ``` -#### Ros2bag +### Record using Ros2bag More documentation can be found [here](https://docs.ros.org/en/foxy/Tutorials/Beginner-CLI-Tools/Recording-And-Playing-Back-Data/Recording-And-Playing-Back-Data.html). -The docker image includes the directory `/bag_files` for users to save the file. To use directory as your working directory for `ros2bag`, you will need to use two terminals. +#### Save in the host folder + +Using the docker `-v` flag which mounts the host directory, data can be directly saved in host file system. -In the first one, create a container ```zsh -docker run -it --rm -``` -and when you want to start the record, run -```bash -ros2 bag record -o bag_files/ /topic1 /topic2 /topic3 +docker run -it --rm \ + -v :/bag_files \ + \ + ros2 bag record -o /bag_files/ /topic1 /topic2 /topic3 ``` -where `-o` tag means output file directory. -To finish the recording, press `control+c` directly. -This will stop the recording and save the data in the folder `` directly under the `bag_files` directory. +#### Save in the container folder -To move the recording outside of the container, run the following command in the second terminal -```zsh -docker cp :/bag_files/ /path/to/your/local/directory -``` -and you are done! +
+ Click me for more detail. -To move the recording `` from your local end into the container, run -```zsh -docker cp /path/to/your/local/directory/ :/bag_files/ -``` + The docker image includes the directory `/bag_files` for users to save the file. To use directory as your working directory for `ros2bag`, you will need to use two terminals. -To replay the recording `` in the container, run -```bash -ros2 bag play bag_files/ -``` + In the first one, create a container + ```zsh + docker run -it --rm + ``` + and when you want to start the record, run + ```bash + ros2 bag record -o bag_files/ /topic1 /topic2 /topic3 + ``` + where `-o` tag means output file directory. + + To finish the recording, press `control+c` directly. + This will stop the recording and save the data in the folder `` directly under the `bag_files` directory. + + To move the recording outside of the container, run the following command in the second terminal + ```zsh + docker cp :/bag_files/ + ``` + and you are done! + + To move the recording `` from your local end into the container, run + ```zsh + docker cp / :/bag_files/ + ``` + + To replay the recording `` in the container, run + ```bash + ros2 bag play bag_files/ + ``` + + > When you use `ros2bag`, make sure you download the saved `bag_files` before exiting or removing the docker container. -> When you use `ros2bag`, make sure you download the saved `bag_files` before exiting or removing the docker container. +
-#### Ros2 Tips +### Other Ros2 Tips More commands are available in official ROS2 documentation. Here, I'm providing few that will be useful to debug the `docker` container.