-
Notifications
You must be signed in to change notification settings - Fork 93
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
Renamed ign to gz (backport #67) #126
base: humble
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
<<<<<<< HEAD | ||
ENV IGNITION_VERSION fortress | ||
======= | ||
ENV GZ_VERSION fortress | ||
ENV ROS_DISTRO rolling | ||
>>>>>>> ab810e7 (Renamed ign to gz (#67)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bad merge artifact |
||
|
||
# Make sure everything is up to date before building from source | ||
RUN apt-get update \ | ||
|
@@ -39,4 +44,4 @@ RUN cd /home/ros2_ws/ \ | |
COPY entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
CMD ros2 launch ign_ros2_control_demos cart_example_position.launch.py | ||
CMD ros2 launch gz_ros2_control_demos cart_example_position.launch.py |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
# ign_ros2_control | ||
# gz_ros2_control | ||
|
||
<<<<<<< HEAD | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Artifact of a bad merge/rebase. |
||
======= | ||
ROS2 Distro | Build Status | Package build | | ||
:---------: | :----: | :----------: | | ||
[![Licence](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) | [![Build Status](http://build.ros2.org/buildStatus/icon?job=Hdev__ign_ros2_control__ubuntu_focal_amd64)](http://build.ros2.org/job/Hdev__ign_ros2_control__ubuntu_focal_amd64) | [![Build Status](http://build.ros2.org/buildStatus/icon?job=Hbin_uF64__ign_ros2_control__ubuntu_focal_amd64__binary)](http://build.ros2.org/job/Hbin_uF64__ign_ros2_control__ubuntu_focal_amd64__binary) | | ||
|
||
>>>>>>> ab810e7 (Renamed ign to gz (#67)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. artifact of bad merge/rebase |
||
This is a ROS 2 package for integrating the `ros2_control` controller architecture with the [Ignition Gazebo](http://ignitionrobotics.org/) simulator. | ||
More information about `ros2_control` can be found here: https://control.ros.org/ | ||
|
||
This package provides an Ignition Gazebo system plugin which instantiates a `ros2_control` controller manager and connects it to a Gazebo model. | ||
This package provides a Gazebo-Sim system plugin which instantiates a `ros2_control` controller manager and connects it to a Gazebo model. | ||
|
||
Tested on: | ||
|
||
|
@@ -17,12 +24,11 @@ If you want to run this with `ROS 2 Foxy` please check the branch `foxy`. | |
|
||
# Compile from source | ||
|
||
If you want compile this from source, you should choose the Ignition version. The default one is `citadel`: | ||
If you want compile this from source, you should choose the Gazebo version. The default one is `garden`: | ||
|
||
```bash | ||
export IGNITION_VERSION=citadel | ||
export IGNITION_VERSION=edifice | ||
export IGNITION_VERSION=fortress | ||
export GZ_VERSION=fortress | ||
export GZ_VERSION=garden | ||
``` | ||
|
||
Then create a workspace, clone the repo and compile it: | ||
|
@@ -40,7 +46,7 @@ colcon build | |
|
||
## Video + Pictures | ||
|
||
![](img/ign_ros2_control.gif) | ||
![](img/gz_ros2_control.gif) | ||
|
||
![](img/diff_drive.gif) | ||
|
||
|
@@ -51,7 +57,7 @@ colcon build | |
|
||
```bash | ||
cd Dockerfile | ||
docker build -t ign_ros2_control . | ||
docker build -t gz_ros2_control . | ||
``` | ||
|
||
### To run the demo | ||
|
@@ -61,7 +67,7 @@ docker build -t ign_ros2_control . | |
Docker allows us to run the demo without the GUI if configured properly. The following command runs the demo without the GUI: | ||
|
||
```bash | ||
docker run -it --rm --name ignition_ros2_control_demo --net host ign_ros2_control ros2 launch ign_ros2_control_demos cart_example_position.launch.py gui:=false | ||
docker run -it --rm --name gz_ros2_control_demo --net host gz_ros2_control ros2 launch gz_ros2_control_demos cart_example_position.launch.py gui:=false | ||
``` | ||
|
||
Then on your local machine, you can run the Gazebo client: | ||
|
@@ -76,18 +82,18 @@ To run the demo with the GUI, we are going to use [rocker](https://github.com/os | |
images with customized local support injected for things like nvidia support. Rocker also supports user id specific files for cleaner | ||
mounting file permissions. You can install this tool with the following [instructions](https://github.com/osrf/rocker/#installation) (make sure you meet all of the [prerequisites](https://github.com/osrf/rocker/#prerequisites)). | ||
|
||
The following command will launch Ignition: | ||
The following command will launch Gazebo: | ||
|
||
```bash | ||
rocker --x11 --nvidia --name ignition_ros2_control_demo ign_ros2_control:latest | ||
rocker --x11 --nvidia --name gz_ros2_control_demo gz_ros2_control:latest | ||
``` | ||
|
||
The following commands allow the cart to be moved along the rail: | ||
|
||
```bash | ||
docker exec -it ignition_ros2_control_demo bash | ||
docker exec -it gz_ros2_control_demo bash | ||
source /home/ros2_ws/install/setup.bash | ||
ros2 run ign_ros2_control_demos example_position | ||
ros2 run gz_ros2_control_demos example_position | ||
``` | ||
|
||
## Add ros2_control tag to a URDF | ||
|
@@ -100,9 +106,9 @@ include: | |
- `<joint>` tag including the robot controllers: commands and states. | ||
|
||
```xml | ||
<ros2_control name="IgnitionSystem" type="system"> | ||
<ros2_control name="GazeboSimSystem" type="system"> | ||
<hardware> | ||
<plugin>ign_ros2_control/IgnitionSystem</plugin> | ||
<plugin>gz_ros2_control/GazeboSimSystem</plugin> | ||
</hardware> | ||
<joint name="slider_to_cart"> | ||
<command_interface name="effort"> | ||
|
@@ -118,56 +124,100 @@ include: | |
</ros2_control> | ||
``` | ||
|
||
<<<<<<< HEAD | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are bunch of these. |
||
## Add the ign_ros2_control plugin | ||
======= | ||
|
||
### Using mimic joints in simulation | ||
|
||
To use `mimic` joints in `gz_ros2_control` you should define its parameters to your URDF. | ||
We should include: | ||
|
||
- `<mimic>` tag to the mimicked joint ([detailed manual(https://wiki.ros.org/urdf/XML/joint)) | ||
- `mimic` and `multiplier` parameters to joint definition in `<ros2_control>` tag | ||
|
||
```xml | ||
<joint name="left_finger_joint" type="prismatic"> | ||
<mimic joint="right_finger_joint"/> | ||
<axis xyz="0 1 0"/> | ||
<origin xyz="0.0 0.48 1" rpy="0.0 0.0 3.1415926535"/> | ||
<parent link="base"/> | ||
<child link="finger_left"/> | ||
<limit effort="1000.0" lower="0" upper="0.38" velocity="10"/> | ||
</joint> | ||
``` | ||
|
||
```xml | ||
<joint name="left_finger_joint"> | ||
<param name="mimic">right_finger_joint</param> | ||
<param name="multiplier">1</param> | ||
<command_interface name="position"/> | ||
<state_interface name="position"/> | ||
<state_interface name="velocity"/> | ||
<state_interface name="effort"/> | ||
</joint> | ||
``` | ||
|
||
|
||
## Add the gz_ros2_control plugin | ||
>>>>>>> ab810e7 (Renamed ign to gz (#67)) | ||
|
||
In addition to the `ros2_control` tags, a Gazebo plugin needs to be added to your URDF that | ||
actually parses the `ros2_control` tags and loads the appropriate hardware interfaces and | ||
controller manager. By default the `ign_ros2_control` plugin is very simple, though it is also | ||
controller manager. By default the `gz_ros2_control` plugin is very simple, though it is also | ||
extensible via an additional plugin architecture to allow power users to create their own custom | ||
robot hardware interfaces between `ros2_control` and Gazebo. | ||
|
||
```xml | ||
<gazebo> | ||
<<<<<<< HEAD | ||
<plugin filename="libign_ros2_control-system.so" name="ign_ros2_control"> | ||
======= | ||
<plugin filename="libgz_ros2_control-system.so" name="gz_ros2_control::GazeboSimROS2ControlPlugin"> | ||
>>>>>>> ab810e7 (Renamed ign to gz (#67)) | ||
<robot_param>robot_description</robot_param> | ||
<robot_param_node>robot_state_publisher</robot_param_node> | ||
<parameters>$(find ign_ros2_control_demos)/config/cartpole_controller.yaml</parameters> | ||
<parameters>$(find gz_ros2_control_demos)/config/cartpole_controller.yaml</parameters> | ||
</plugin> | ||
</gazebo> | ||
``` | ||
|
||
The `ign_ros2_control` `<plugin>` tag also has the following optional child elements: | ||
The `gz_ros2_control` `<plugin>` tag also has the following optional child elements: | ||
|
||
- `<parameters>`: YAML file with the configuration of the controllers | ||
|
||
#### Default ign_ros2_control Behavior | ||
#### Default gz_ros2_control Behavior | ||
|
||
By default, without a `<plugin>` tag, `ign_ros2_control` will attempt to get all of the information it needs to interface with a ros2_control-based controller out of the URDF. This is sufficient for most cases, and good for at least getting started. | ||
By default, without a `<plugin>` tag, `gz_ros2_control` will attempt to get all of the information it needs to interface with a ros2_control-based controller out of the URDF. This is sufficient for most cases, and good for at least getting started. | ||
|
||
The default behavior provides the following ros2_control interfaces: | ||
|
||
- hardware_interface::JointStateInterface | ||
- hardware_interface::EffortJointInterface | ||
- hardware_interface::VelocityJointInterface | ||
|
||
#### Advanced: custom ign_ros2_control Simulation Plugins | ||
#### Advanced: custom gz_ros2_control Simulation Plugins | ||
|
||
The `ign_ros2_control` Gazebo plugin also provides a pluginlib-based interface to implement custom interfaces between Gazebo and `ros2_control` for simulating more complex mechanisms (nonlinear springs, linkages, etc). | ||
The `gz_ros2_control` Gazebo plugin also provides a pluginlib-based interface to implement custom interfaces between Gazebo and `ros2_control` for simulating more complex mechanisms (nonlinear springs, linkages, etc). | ||
|
||
These plugins must inherit the `ign_ros2_control::IgnitionSystemInterface`, which implements a simulated `ros2_control` | ||
These plugins must inherit the `gz_ros2_control::GazeboSimSystemInterface`, which implements a simulated `ros2_control` | ||
`hardware_interface::SystemInterface`. SystemInterface provides API-level access to read and command joint properties. | ||
|
||
The respective IgnitionSystemInterface sub-class is specified in a URDF model and is loaded when the | ||
The respective GazeboSimSystemInterface sub-class is specified in a URDF model and is loaded when the | ||
robot model is loaded. For example, the following XML will load the default plugin: | ||
```xml | ||
<ros2_control name="IgnitionSystem" type="system"> | ||
<ros2_control name="GazeboSimSystem" type="system"> | ||
<hardware> | ||
<plugin>ign_ros2_control/IgnitionSystem</plugin> | ||
<plugin>gz_ros2_control/GazeboSimSystem</plugin> | ||
</hardware> | ||
... | ||
<ros2_control> | ||
<gazebo> | ||
<<<<<<< HEAD | ||
<plugin name="ign_ros2_control" filename="libign_ros2_control-system.so"> | ||
======= | ||
<plugin name="gz_ros2_control::GazeboSimROS2ControlPlugin" filename="libgz_ros2_control-system"> | ||
>>>>>>> ab810e7 (Renamed ign to gz (#67)) | ||
... | ||
</plugin> | ||
</gazebo> | ||
|
@@ -180,8 +230,13 @@ and use the tag `<controller_manager_prefix_node_name>` to set the controller ma | |
|
||
```xml | ||
<gazebo> | ||
<<<<<<< HEAD | ||
<plugin name="ign_ros2_control" filename="libign_ros2_control-system.so"> | ||
<parameters>$(find ign_ros2_control_demos)/config/cartpole_controller.yaml</parameters> | ||
======= | ||
<plugin name="gz_ros2_control::GazeboSimROS2ControlPlugin" filename="libgz_ros2_control-system"> | ||
<parameters>$(find gz_ros2_control_demos)/config/cartpole_controller.yaml</parameters> | ||
>>>>>>> ab810e7 (Renamed ign to gz (#67)) | ||
<controller_manager_prefix_node_name>controller_manager</controller_manager_prefix_node_name> | ||
</plugin> | ||
<gazebo> | ||
|
@@ -210,26 +265,44 @@ cart_pole_controller: | |
``` | ||
#### Executing the examples | ||
|
||
There are some examples in the `ign_ros2_control_demos` package. These examples allow to launch a cart in a 30 meter rail. | ||
There are some examples in the `gz_ros2_control_demos` package. These examples allow to launch a cart in a 30 meter rail. | ||
|
||
You can run some of the example configurations by running the following commands: | ||
|
||
```bash | ||
ros2 launch ign_ros2_control_demos cart_example_position.launch.py | ||
ros2 launch ign_ros2_control_demos cart_example_velocity.launch.py | ||
ros2 launch ign_ros2_control_demos cart_example_effort.launch.py | ||
ros2 launch ign_ros2_control_demos diff_drive_example.launch.py | ||
ros2 launch ign_ros2_control_demos tricycle_drive_example.launch.py | ||
ros2 launch gz_ros2_control_demos cart_example_position.launch.py | ||
ros2 launch gz_ros2_control_demos cart_example_velocity.launch.py | ||
ros2 launch gz_ros2_control_demos cart_example_effort.launch.py | ||
ros2 launch gz_ros2_control_demos diff_drive_example.launch.py | ||
ros2 launch gz_ros2_control_demos tricycle_drive_example.launch.py | ||
``` | ||
|
||
Send example commands: | ||
|
||
When the Gazebo world is launched, you can run some of the following commands to move the cart. | ||
|
||
```bash | ||
ros2 run ign_ros2_control_demos example_position | ||
ros2 run ign_ros2_control_demos example_velocity | ||
ros2 run ign_ros2_control_demos example_effort | ||
ros2 run ign_ros2_control_demos example_diff_drive | ||
ros2 run ign_ros2_control_demos example_tricycle_drive | ||
ros2 run gz_ros2_control_demos example_position | ||
ros2 run gz_ros2_control_demos example_velocity | ||
ros2 run gz_ros2_control_demos example_effort | ||
ros2 run gz_ros2_control_demos example_diff_drive | ||
ros2 run gz_ros2_control_demos example_tricycle_drive | ||
``` | ||
<<<<<<< HEAD | ||
======= | ||
|
||
The following example shows parallel gripper with mimic joint: | ||
|
||
![](img/gripper.gif) | ||
|
||
|
||
```bash | ||
ros2 launch gz_ros2_control_demos gripper_mimic_joint_example.launch.py | ||
``` | ||
|
||
Send example commands: | ||
|
||
```bash | ||
ros2 run gz_ros2_control_demos example_gripper | ||
``` | ||
>>>>>>> ab810e7 (Renamed ign to gz (#67)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad merge artifact