Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zcemycl committed Aug 7, 2024
1 parent 4355396 commit c572166
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 19 deletions.
22 changes: 3 additions & 19 deletions src/containers/docker/ros-gazebo-rviz-turtlebot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
FROM osrf/ros:noetic-desktop-full
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install wget git python3-pip python3-catkin-tools -y
RUN apt-get install ros-noetic-joy ros-noetic-control-toolbox \
ros-noetic-robot-controllers ros-noetic-gazebo-ros \
ros-noetic-gazebo-plugins ros-noetic-rgbd-launch -y
WORKDIR /
RUN mkdir -p catkin_ws/src/
WORKDIR /catkin_ws/src/
RUN git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
RUN git clone -b noetic-devel https://github.com/ROBOTIS-GIT/turtlebot3.git
RUN git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
RUN echo "export TURTLEBOT3_MODEL=burger" > ~/.bashrc
RUN echo "source /opt/ros/noetic/setup.bash" > ~/.bashrc
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 /
FROM ros:noetic-ros-core
RUN apt-get update && apt-get install -y \
ros-noetic-foxglove-bridge
19 changes: 19 additions & 0 deletions src/containers/docker/ros-gazebo-rviz-turtlebot/Dockerfile.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM osrf/ros:noetic-desktop-full
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install wget git python3-pip python3-catkin-tools -y
RUN apt-get install ros-noetic-joy ros-noetic-control-toolbox \
ros-noetic-robot-controllers ros-noetic-gazebo-ros \
ros-noetic-gazebo-plugins ros-noetic-rgbd-launch -y
WORKDIR /
RUN mkdir -p catkin_ws/src/
WORKDIR /catkin_ws/src/
RUN git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
RUN git clone -b noetic-devel https://github.com/ROBOTIS-GIT/turtlebot3.git
RUN git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
RUN echo "export TURTLEBOT3_MODEL=burger" > ~/.bashrc
RUN echo "source /opt/ros/noetic/setup.bash" > ~/.bashrc
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 /
5 changes: 5 additions & 0 deletions src/containers/docker/ros-gazebo-rviz-turtlebot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch # initialize the gazeb
export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
```

## References

1. https://foxglove.dev/blog/installing-ros1-on-macos-with-docker
2. https://foxglove.dev/blog/installing-ros2-on-macos-with-docker
88 changes: 88 additions & 0 deletions src/containers/docker/ros-gazebo-rviz-turtlebot/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
x-ros-common: &ros_common
build:
context: .
dockerfile: Dockerfile
networks:
- rosnet
networks:
rosnet:
name: rosnet
driver: bridge
services:
roscore:
<<: *ros_common
ports:
- 11311:11311
command: roscore -p 11311

rostopic-list:
<<: *ros_common
environment:
- ROS_MASTER_URI=http://roscore:11311/
command: rostopic list
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
window: 10s
depends_on:
- roscore

rostopic-pub:
<<: *ros_common
environment:
- ROS_MASTER_URI=http://roscore:11311/
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
window: 10s
depends_on:
- roscore
- rostopic-list
command:
[
"rostopic",
"pub",
"/chatter",
"std_msgs/String",
"data: hello",
"-r",
"1",
]

rostopic-sub:
<<: *ros_common
environment:
- ROS_MASTER_URI=http://roscore:11311/
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
window: 10s
depends_on:
- roscore
- rostopic-list
- rostopic-pub
command: ["rostopic", "echo", "/chatter"]

roslaunch-foxglove-bridge:
<<: *ros_common
environment:
- ROS_MASTER_URI=http://roscore:11311/
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
window: 10s
ports:
- 8765:8765
depends_on:
- roscore
- rostopic-list
- rostopic-pub
command: ["roslaunch", "foxglove_bridge", "foxglove_bridge.launch"]

0 comments on commit c572166

Please sign in to comment.