diff --git a/README.md b/README.md index 66b9485..25c85d2 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,8 @@ on discourse. # Setup & Building -:warning: As this is a project under construction, these instructions are likely to change rapidly. +> [!WARNING] +> As this is a project under construction, these instructions are likely to change rapidly. ## Pre-requisites @@ -48,7 +49,7 @@ on discourse.
- Method 2: Using a container (click here) + Method 2: Using distrobox (click here) > We pre-build base containers with all the dependencies you can use `rocker`, `distrobox`, `podman` or any other oci compliant tool to get a base dev environment. For the purposes of this set of instructions we use distrobox: > ```bash @@ -57,6 +58,15 @@ on discourse. > ```
+
+ Method 3: Using docker container (click here) + +> If you prefer to build the base Docker image from scratch. Please use the following command: +> ```bash +> docker build --load -t ros2_rust_base:jazzy -f docker/Dockerfile.base . +> ``` +
+ ### 2. Import Workspace Dependencies Create a workspace and clone the repo: ```bash @@ -85,7 +95,10 @@ Verify core scenario coordination and robust following behavior: colcon test --packages-select rmf_path_server_test --event-handlers console_direct+ ``` -## Running the Interactive Web Demonstration +## Running Interactive Web Demonstration + +> [!NOTE] +> This provides a lightweight visualization of how `next_gen_prototype` utilizes `mapf` to guide multiple robot agents towards their goal while managing their traffic. https://github.com/user-attachments/assets/d5793eee-515d-49a9-a92c-9926617b48ed @@ -98,3 +111,10 @@ ros2 launch rmf_path_server_demo demo.launch.py 2. Click **Add Robot** to drop active participants onto the canvas. 3. Select a robot and click a cell to place its goal. 4. Click **Send Scenario** to observe multi-agent trajectory generation and live execution progress. + +## Running Nav2 Integration Demonstration + +> [!NOTE] +> This shows users how `next_gen_prototype`'s prototype messages and traffic management design is used for multi-robot coordinations through [Nav2](https://docs.nav2.org/) navigation system. + +Follow instructions in [nav2_integration/README.md](./nav2_integration/README.md). \ No newline at end of file diff --git a/docker/Dockerfile.base b/docker/Dockerfile.base index 122af87..bec6f97 100644 --- a/docker/Dockerfile.base +++ b/docker/Dockerfile.base @@ -17,7 +17,8 @@ RUN apt-get update && apt-get upgrade -y && \ python3-colcon-cargo\ libssl-dev \ pkg-config \ - && rm -rf /var/lib/apt/lists/* + ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \ + ros-${ROS_DISTRO}-rmw-zenoh-cpp # Install colcon extensions for Rust RUN pip3 install --no-cache-dir --break-system-packages colcon-ros-cargo @@ -30,7 +31,6 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no cargo install cargo-ament-build && \ chmod -R a+rwX /usr/local/cargo /usr/local/rustup - # Initialize Underlay Workspace WORKDIR /opt/ros2_rust_ws @@ -38,19 +38,21 @@ WORKDIR /opt/ros2_rust_ws COPY . /tmp/next_gen_prototype # Install ROS 2 dependencies via rosdep for both underlay and prototype branch -RUN apt-get update && \ - rosdep init || true && \ +RUN rosdep init || true && \ rosdep update && \ rosdep install --from-paths /tmp/next_gen_prototype --ignore-src -yr --skip-keys="rclrs ament_cargo ament_python" && \ - rm -rf /var/lib/apt/lists/* && \ - rm -rf /tmp/next_gen_prototype + rm -rf /var/lib/apt/lists/* + +WORKDIR /nav2_traffic_ws # Build the Underlay Workspace -#RUN /bin/bash -c "source /opt/ros/jazzy/setup.bash && \ -# colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release" +RUN mkdir src && mv /tmp/next_gen_prototype /nav2_traffic_ws/src/next_gen_prototype +RUN /bin/bash -c "source /opt/ros/${ROS_DISTRO}/setup.bash && \ + colcon build --packages-up-to sp_demo_nav2_bringup rmf_nav2_traffic rmf_path_server_demo rmf_path_server_test --cmake-args -DCMAKE_BUILD_TYPE=Release && \ + rm -rf build/ log/ src/" # Provide automatic sourcing entrypoint configuration inside ~/.bashrc -RUN echo "source /opt/ros/jazzy/setup.bash" >> /root/.bashrc -#echo "source /opt/ros2_rust_ws/install/setup.bash" >> /root/.bashrc +RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /root/.bashrc +RUN echo "source /nav2_traffic_ws/install/setup.bash" >> /root/.bashrc CMD ["/bin/bash"] diff --git a/nav2_integration/README.md b/nav2_integration/README.md index 54d7ef8..17aada6 100644 --- a/nav2_integration/README.md +++ b/nav2_integration/README.md @@ -91,8 +91,23 @@ graph TD ## Try out the demo +### Docker Setup -### Setup +Follow the steps below to use pre-made `docker/Dockerfile.base` to run the demo containerized without fuss: + +
+ Click here 🐳. + +```bash +docker build --load -t ros2_rust_base:jazzy -f docker/Dockerfile.base . +``` + +
+ +> [!WARNING] +> This process typically takes about **20 minutes**, depending on internet connectivity strength. + +### Manual Setup Do a fresh update & upgrade: ``` @@ -133,18 +148,86 @@ colcon build --packages-up-to sp_demo_nav2_bringup rmf_nav2_traffic rmf_path_ser With the workspace built and sourced, run the following nodes: Spin up the Nav2 simulation: -``` +```bash ros2 launch sp_demo_nav2_bringup cloned_multi_tb3_simulation_launch.py robots:="robot0={x: 0.0, y: 5.0, yaw: 0.0}; robot1={x: 3.0, y: 5.0, yaw: 0.0};" ``` -In a separate terminal, run the demo launch file containing the path server, plan executor, destination server, path visualizer and Nav2 traffic nodes: +
+ Click here if running in docker container (GPU + X11) 🐳. + +```bash +xhost +local:docker + +docker run -it --rm \ +--name ros2_rust_base_c \ +--gpus all \ +--env="DISPLAY" \ +--env="QT_X11_NO_MITSHM=1" \ +-v /tmp/.X11-unix:/tmp/.X11-unix \ +--device=/dev/dri \ +ros2_rust_base:jazzy \ +bash -c "source /nav2_traffic_ws/install/setup.bash && \ +ros2 launch sp_demo_nav2_bringup cloned_multi_tb3_simulation_launch.py \ +robots:=\"robot0={x: 0.0, y: 5.0, yaw: 0.0}; robot1={x: 3.0, y: 5.0, yaw: 0.0};\"" +``` +
+ +
+ Click here if running in docker container (GPU + Wayland) 🐳. + +```bash +xhost +local:docker + +docker run -it --rm \ +--name ros2_rust_base_c \ +--gpus all \ +--env="DISPLAY=${DISPLAY}" \ +--env="QT_X11_NO_MITSHM=1" \ +-v /tmp/.X11-unix:/tmp/.X11-unix:rw \ +--device=/dev/dri \ +ros2_rust_base:jazzy \ +bash -c "source /nav2_traffic_ws/install/setup.bash && \ + ros2 launch sp_demo_nav2_bringup cloned_multi_tb3_simulation_launch.py \ + robots:=\"robot0={x: 0.0, y: 5.0, yaw: 0.0}; robot1={x: 3.0, y: 5.0, yaw: 0.0};\"" +``` +
+ +
+ Click here if running in docker container (CPU) 🐳. + +```bash +xhost +local:docker + +docker run -it --rm \ +--name ros2_rust_base_c \ +--env="DISPLAY=${DISPLAY}" \ +--env="QT_X11_NO_MITSHM=1" \ +-v /tmp/.X11-unix:/tmp/.X11-unix:rw \ +--device=/dev/dri \ +ros2_rust_base:jazzy \ +bash -c "source /nav2_traffic_ws/install/setup.bash && \ + ros2 launch sp_demo_nav2_bringup cloned_multi_tb3_simulation_launch.py \ + robots:=\"robot0={x: 0.0, y: 5.0, yaw: 0.0}; robot1={x: 3.0, y: 5.0, yaw: 0.0};\"" ``` +
+ +In a separate terminal, run the demo launch file containing the path server, plan executor, destination server, path visualizer and Nav2 traffic nodes: +```bash ros2 launch rmf_path_server_demo demo_nav2.launch.py robots:="robot0 robot1" ``` -Send action goals to the robots: +
+ Click here if running in docker container 🐳. +```bash +docker exec -it ros2_rust_base_c bash -c "source /nav2_traffic_ws/install/setup.bash && ros2 launch rmf_path_server_demo demo_nav2.launch.py robots:=\"robot0 robot1\"" ``` + +
+ +Send action goals to the robots: + +```bash ros2 action send_goal robot0/navigate_to_pose nav2_msgs/action/NavigateToPose "{ pose: { header: { @@ -158,8 +241,28 @@ ros2 action send_goal robot0/navigate_to_pose nav2_msgs/action/NavigateToPose "{ } }" ``` - +
+ Click here if running in docker container 🐳. + +```bash +docker exec -it ros2_rust_base_c bash -c "source /nav2_traffic_ws/install/setup.bash && \ + ros2 action send_goal robot0/navigate_to_pose nav2_msgs/action/NavigateToPose \"{ + pose: { + header: { + stamp: {sec: 0, nanosec: 0}, + frame_id: 'map' + }, + pose: { + position: {x: 5.0, y: 5.0, z: 0.0}, + orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0} + } + } + }\" +" ``` +
+ +```bash ros2 action send_goal robot1/navigate_to_pose nav2_msgs/action/NavigateToPose "{ pose: { header: { @@ -174,9 +277,30 @@ ros2 action send_goal robot1/navigate_to_pose nav2_msgs/action/NavigateToPose "{ }" ``` +
+ Click here if running in docker container 🐳. + +```bash +docker exec -it ros2_rust_base_c bash -c "source /nav2_traffic_ws/install/setup.bash && \ + ros2 action send_goal robot1/navigate_to_pose nav2_msgs/action/NavigateToPose \"{ + pose: { + header: { + stamp: {sec: 0, nanosec: 0}, + frame_id: 'map' + }, + pose: { + position: {x: 0.0, y: 3.0, z: 0.0}, + orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0} + } + } + }\" +" +``` +
+ Alternate navigation goals: -``` +```bash ros2 action send_goal robot0/navigate_to_pose nav2_msgs/action/NavigateToPose "{ pose: { header: { @@ -191,7 +315,28 @@ ros2 action send_goal robot0/navigate_to_pose nav2_msgs/action/NavigateToPose "{ }" ``` +
+ Click here if running in docker container 🐳. + +```bash +docker exec -it ros2_rust_base_c bash -c "source /nav2_traffic_ws/install/setup.bash && \ + ros2 action send_goal robot0/navigate_to_pose nav2_msgs/action/NavigateToPose \"{ + pose: { + header: { + stamp: {sec: 0, nanosec: 0}, + frame_id: 'map' + }, + pose: { + position: {x: 9.0, y: 3.0, z: 0.0}, + orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0} + } + } + }\" +" ``` +
+ +```bash ros2 action send_goal robot1/navigate_to_pose nav2_msgs/action/NavigateToPose "{ pose: { header: { @@ -205,3 +350,24 @@ ros2 action send_goal robot1/navigate_to_pose nav2_msgs/action/NavigateToPose "{ } }" ``` + +
+ Click here if running in docker container 🐳. + +```bash +docker exec -it ros2_rust_base_c bash -c "source /nav2_traffic_ws/install/setup.bash && \ + ros2 action send_goal robot1/navigate_to_pose nav2_msgs/action/NavigateToPose \"{ + pose: { + header: { + stamp: {sec: 0, nanosec: 0}, + frame_id: 'map' + }, + pose: { + position: {x: 9.0, y: 6.0, z: 0.0}, + orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0} + } + } + }\" +" +``` +
\ No newline at end of file