Skip to content

Commit

Permalink
adding ros simulation in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
zcemycl committed Aug 9, 2024
1 parent 752ce3b commit 2b72a65
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ RUN echo "source /catkin_ws/devel/setup.bash" > ~/.bashrc
RUN pip install rospkg
RUN /bin/bash -c 'source /opt/ros/noetic/setup.bash; \
cd /catkin_ws/; catkin_make; source /catkin_ws/devel/setup.bash'
# WORKDIR /opt/ros/noetic
# RUN . setup.bash
# WORKDIR /catkin_ws
# RUN catkin_make
WORKDIR /
COPY ./run_gazebo.sh /run_gazebo.sh
9 changes: 9 additions & 0 deletions src/containers/docker/ros-simulation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## How to run?
1. Install this for remote visualisation from docker.
```
https://sourceforge.net/projects/vcxsrv/
```
2. Run docker compose
```
docker compose up
```
32 changes: 32 additions & 0 deletions src/containers/docker/ros-simulation/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
networks:
rosnet:
name: rosnet
driver: bridge
services:
roscore:
build:
context: .
dockerfile: Dockerfile.old
networks:
- rosnet
command: roscore -p 11311
ports:
- 11311:11311
gazebo:
build:
context: .
dockerfile: Dockerfile.old
networks:
- rosnet
command: /run_gazebo.sh
environment:
- ROS_MASTER_URI=http://roscore:11311/
- DISPLAY=host.docker.internal:0.0
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
window: 10s
depends_on:
- roscore
5 changes: 5 additions & 0 deletions src/containers/docker/ros-simulation/run_gazebo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
export TURTLEBOT3_MODEL=burger
source /opt/ros/noetic/setup.bash
source /catkin_ws/devel/setup.bash
roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch

0 comments on commit 2b72a65

Please sign in to comment.