Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Commit d4f6e70

Browse files
ahcordechapulina
andauthored
Added dockerfile and instructions (#29)
* Added dockerfile and instructions Signed-off-by: ahcorde <[email protected]> * Added rocker instructions Signed-off-by: ahcorde <[email protected]> * Update Dockerfile and instructions Signed-off-by: ahcorde <[email protected]> * Install realtime-tools and xacro from packages Signed-off-by: ahcorde <[email protected]> * Fixed Dockerfile Signed-off-by: ahcorde <[email protected]> * Added Docker instructions Signed-off-by: ahcorde <[email protected]> Co-authored-by: Louise Poubel <[email protected]>
1 parent c70a6a1 commit d4f6e70

File tree

4 files changed

+98
-0
lines changed

4 files changed

+98
-0
lines changed

Docker/Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
FROM osrf/ros:foxy-desktop
2+
3+
# Make sure everything is up to date before building from source
4+
RUN apt-get update \
5+
&& apt-get upgrade -y \
6+
&& apt-get clean
7+
8+
RUN apt-get update && apt-get install -q -y --no-install-recommends \
9+
dirmngr \
10+
gnupg2 \
11+
lsb-release \
12+
python3-colcon-ros \
13+
&& apt-get clean
14+
15+
RUN mkdir -p /home/ros2_ws/src \
16+
&& cd /home/ros2_ws/src/ \
17+
&& git clone https://github.com/ros-simulation/gazebo_ros2_control \
18+
&& git clone https://github.com/ros-controls/ros2_control \
19+
&& git clone https://github.com/ros-controls/control_toolbox -b ros2-master \
20+
&& git clone https://github.com/ros-controls/ros2_controllers \
21+
&& git clone https://github.com/ddengster/ros2_control/ -b coffeebot_deps ros2_control_ddengster \
22+
&& touch ros2_control_ddengster/COLCON_IGNORE \
23+
&& cp -r ros2_control_ddengster/joint_limits_interface ros2_control_ddengster/transmission_interface ros2_control \
24+
&& sed -i '/rclcpp/d' ros2_control/joint_limits_interface/CMakeLists.txt \
25+
&& sed -i '/rclcpp/d' ros2_control/joint_limits_interface/package.xml \
26+
&& rosdep update \
27+
&& rosdep install --from-paths ./ -i -y --rosdistro foxy \
28+
--ignore-src
29+
30+
RUN cd /home/ros2_ws/ \
31+
&& . /opt/ros/foxy/setup.sh \
32+
&& export CMAKE_PREFIX_PATH=$AMENT_PREFIX_PATH:$CMAKE_PREFIX_PATH \
33+
&& colcon build
34+
35+
COPY entrypoint.sh /entrypoint.sh
36+
ENTRYPOINT ["/entrypoint.sh"]
37+
38+
CMD ros2 launch gazebo_ros2_control_demos cart_example_position.launch.py

Docker/entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
. /opt/ros/foxy/setup.sh
4+
. /home/ros2_ws/install/setup.sh
5+
exec "$@"

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,66 @@
11
# gazebo_ros2_control
22

3+
34
This is a ROS 2 package for integrating the `ros2_control` controller architecture with the [Gazebo](http://gazebosim.org/) simulator.
45

56
This package provides a Gazebo plugin which instantiates a `ros2_control` controller manager and connects it to a Gazebo model.
67

78
# Usage
89

10+
This repository contains the contents for testing gazebo_ros2_control
11+
12+
It is running Gazebo and some other ROS 2 nodes.
13+
14+
## Video + Pictures
15+
16+
![](img/gazebo_ros2_control_position_pid.gif)
17+
18+
## Running
19+
20+
### Modifying or building your own
21+
22+
```bash
23+
cd Docker
24+
docker build -t gazebo_ros2_control .
25+
```
26+
27+
### To run the demo
28+
29+
#### Using Docker
30+
31+
Docker allows us to run the demo without GUI if we don't configure it properly. The following command runs the demo without GUI:
32+
33+
```bash
34+
docker run -it --rm --name gazebo_ros2_control_demo --net host gazebo_ros2_control ros2 launch gazebo_ros2_control_demos cart_example_position.launch.py gui:=false
35+
```
36+
37+
The in your local machine you can run the Gazebo client:
38+
39+
```bash
40+
gzclient
41+
```
42+
43+
#### Using Rocker
44+
45+
To run the demo with GUI we are going to use [rocker](https://github.com/osrf/rocker/) which is a tool to run docker
46+
images with customized local support injected for things like nvidia support. And user id specific files for cleaner
47+
mounting file permissions. You can install this tool with the following [instructions](https://github.com/osrf/rocker/#installation).
48+
49+
The following command will launch Gazebo:
50+
51+
```bash
52+
rocker --x11 --nvidia --name gazebo_ros2_control_demo gazebo_ros2_control:latest
53+
```
54+
55+
The following commands allow to move the cart in the rail:
56+
57+
```bash
58+
docker exec -it gazebo_ros2_control_demo bash
59+
source /home/ros2_ws/install/setup.bash
60+
ros2 run gazebo_ros2_control_demos example_position
61+
```
62+
63+
964
## Add transmission elements to a URDF
1065

1166
To use `ros2_control` with your robot, you need to add some additional elements to your URDF. The `<transmission>` element is used to link actuators to joints, see the `<transmission>` spec for exact XML format.
247 KB
Loading

0 commit comments

Comments
 (0)