Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added multirobot demo and set using prebuilt imags as default for gazebo #48

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,20 @@ 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):
```
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:
```
Expand All @@ -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.
33 changes: 33 additions & 0 deletions demo/compose.gazebo.multirobot.yaml
Original file line number Diff line number Diff line change
@@ -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};"
8 changes: 4 additions & 4 deletions demo/compose.gazebo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading