diff --git a/demo/README.md b/demo/README.md index 173c882..b70451b 100644 --- a/demo/README.md +++ b/demo/README.md @@ -25,7 +25,7 @@ docker compose -f compose.yaml up ``` ## Simulation -If you don't have Nvidia GPU replace `*gpu-config` with `*cpu-config` in `rosbot` service inside `compose.simulation.yaml` file. +If you don't have Nvidia GPU replace `*gpu-config` with `*cpu-config` in `rosbot` service inside `compose.gazebo.yaml` file. In the PC's shell execute (in the `demo/` directory): ``` @@ -33,6 +33,12 @@ xhost local:root docker compose -f compose.gazebo.yaml up ``` +If you want to use multiple robots check the `compose.gazebo.multirobot.yaml` (in the `demo/` directory): +``` +xhost local:root +docker compose -f compose.gazebo.multiplerobot.yaml up +``` + ## Drive the ROSbot In another shell (if you use hardware use another ROSbot's shell) enter the docker container: ``` @@ -43,4 +49,9 @@ and run inside `teleop_twist_keyboard` to drive the ROSbot ros2 run teleop_twist_keyboard teleop_twist_keyboard ``` +In case of driving one of the robot running `compose.gazebo.multirobot.yaml` add the namespace to the `teleop_twist_keyboard`. For the `robot1`: +``` +ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r __ns:=/robot1 +``` + With keys `i`, `j`, `l`, `,` you can drive forward, counter clockwise, clockwise and backwards. If you are using macanum wheels (see `demo/.env` file) hold `Shift` key that way the ROSbot goes left and right with `j` and `l` keys instead rotates. diff --git a/demo/compose.gazebo.multirobot.yaml b/demo/compose.gazebo.multirobot.yaml new file mode 100644 index 0000000..ce3a4be --- /dev/null +++ b/demo/compose.gazebo.multirobot.yaml @@ -0,0 +1,33 @@ +# Quick Start +# +# 1. run `xhost +local:docker && docker compose -f compose.gazebo.multirobot.yaml up` on the laptop +# 2. open a shell inside a docker container `docker compose -f compose.gazebo.multirobot.yaml exec -it rosbot bash` +# 2. run for e. g. `ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r __ns:=/robot1` inside the container + +x-gpu-config: + &gpu-config + runtime: nvidia + environment: + - DISPLAY=${DISPLAY:?err} + - NVIDIA_VISIBLE_DEVICES=all + - NVIDIA_DRIVER_CAPABILITIES=all + +x-cpu-config: + &cpu-config + environment: + - DISPLAY=${DISPLAY:?err} + - LIBGL_ALWAYS_SOFTWARE=1 + +services: + rosbot: + image: husarion/rosbot-gazebo:humble-nightly + # build: + # context: ../ + # dockerfile: Dockerfile.gazebo + <<: [ *gpu-config] + volumes: + - /tmp/.X11-unix:/tmp/.X11-unix:rw + command: > + ros2 launch rosbot_gazebo simulation.launch.py + mecanum:=${MECANUM:-False} + robots:="robot1={y: -4.0}; robot2={y: -2.0}; robot3={y: 4.0};" diff --git a/demo/compose.gazebo.yaml b/demo/compose.gazebo.yaml index 52032cd..54c35c9 100644 --- a/demo/compose.gazebo.yaml +++ b/demo/compose.gazebo.yaml @@ -20,10 +20,10 @@ x-cpu-config: services: rosbot: - # image: husarion/rosbot-gazebo:humble - build: - context: ../ - dockerfile: Dockerfile.gazebo + image: husarion/rosbot-gazebo:humble + # build: + # context: ../ + # dockerfile: Dockerfile.gazebo <<: [ *gpu-config] volumes: - /tmp/.X11-unix:/tmp/.X11-unix:rw