-
 

gz_ros2_control repository

Repository Summary

Checkout URI https://github.com/ros-controls/gz_ros2_control.git
VCS Type git
VCS Version humble
Last Updated 2022-05-25
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

Name Version
ign_ros2_control 0.0.0
ign_ros2_control_demos 0.0.0

README

ign_ros2_control

This is a ROS 2 package for integrating the ros2_control controller architecture with the Ignition Gazebo 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.

Tested on:

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:

export IGNITION_VERSION=citadel
export IGNITION_VERSION=edifice
export IGNITION_VERSION=fortress

Then create a workspace, clone the repo and compile it:

mkdir -p ~/ros_ign/src
cd ~/ros_ign/src
git clone https://github.com/ignitionrobotics/ign_ros2_control
rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y
cd ~/ros2_ign
colcon build

Usage

Video + Pictures

Running

Modifying or building your own

cd Dockerfile
docker build -t ign_ros2_control .

To run the demo

Using Docker

Docker allows us to run the demo without the GUI if configured properly. The following command runs the demo without the GUI:

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

Then on your local machine, you can run the Gazebo client:

ign gazebo -g

Using Rocker

To run the demo with the GUI, we are going to use rocker, which is a tool to run docker 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 (make sure you meet all of the prerequisites).

The following command will launch Ignition:

rocker --x11 --nvidia --name ignition_ros2_control_demo ign_ros2_control:latest

The following commands allow the cart to be moved along the rail:

docker exec -it ignition_ros2_control_demo bash
source /home/ros2_ws/install/setup.bash
ros2 run ign_ros2_control_demos example_position

Add ros2_control tag to a URDF

To use ros2_control with your robot, you need to add some additional elements to your URDF. You should include the tag <ros2_control> to access and control the robot interfaces. We should include:

  • a specific <plugin> for our robot
  • <joint> tag including the robot controllers: commands and states.
<ros2_control name="IgnitionSystem" type="system">
  <hardware>
    <plugin>ign_ros2_control/IgnitionSystem</plugin>
  </hardware>
  <joint name="slider_to_cart">
    <command_interface name="effort">
      <param name="min">-1000</param>
      <param name="max">1000</param>
    </command_interface>
    <state_interface name="position">
      <param name="initial_value">1.0</param>
    </state_interface>
    <state_interface name="velocity"/>
    <state_interface name="effort"/>
  </joint>
</ros2_control>

Add the ign_ros2_control plugin

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 extensible via an additional plugin architecture to allow power users to create their own custom robot hardware interfaces between ros2_control and Gazebo.

<gazebo>
    <plugin filename="libign_ros2_control-system.so" name="ign_ros2_control">
      <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>
    </plugin>
</gazebo>

The ign_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

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.

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

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).

These plugins must inherit the ign_ros2_control::IgnitionSystemInterface, 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 robot model is loaded. For example, the following XML will load the default plugin:

<ros2_control name="IgnitionSystem" type="system">
  <hardware>
    <plugin>ign_ros2_control/IgnitionSystem</plugin>
  </hardware>
  ...
<ros2_control>
<gazebo>
  <plugin name="ign_ros2_control" filename="libign_ros2_control-system.so">
    ...
  </plugin>
</gazebo>

Set up controllers

Use the tag <parameters> inside <plugin> to set the YAML file with the controller configuration and use the tag <controller_manager_prefix_node_name> to set the controller manager node name.

<gazebo>
  <plugin name="ign_ros2_control" filename="libign_ros2_control-system.so">
    <parameters>$(find ign_ros2_control_demos)/config/cartpole_controller.yaml</parameters>
    <controller_manager_prefix_node_name>controller_manager</controller_manager_prefix_node_name>
  </plugin>
<gazebo>

This controller publishes the state of all resources registered to a hardware_interface::StateInterface to a topic of type sensor_msgs/msg/JointState. The following is a basic configuration of the controller.

joint_state_controller:
  ros__parameters:
    type: joint_state_controller/JointStateController

This controller creates an action called /cart_pole_controller/follow_joint_trajectory of type control_msgs::action::FollowJointTrajectory.

cart_pole_controller:
  ros__parameters:
    type: joint_trajectory_controller/JointTrajectoryController
    joints:
       - slider_to_cart
    write_op_modes:
       - slider_to_cart

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.

You can run some of the example configurations by running the following commands:

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

Send example commands:

When the Gazebo world is launched, you can run some of the following commands to move the cart.

ros2 run ign_ros2_control_demos example_position
ros2 run ign_ros2_control_demos example_velocity
ros2 run ign_ros2_control_demos example_effort

CONTRIBUTING

No CONTRIBUTING.md found.

Repository Summary

Checkout URI https://github.com/ros-controls/gz_ros2_control.git
VCS Type git
VCS Version jazzy
Last Updated 2024-12-27
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

README

gz_ros2_control

ROS2 Distro Build Status Package build
Licence Build Status Build Status

This is a ROS 2 package for integrating the ros2_control controller architecture with the Gazebo simulator. More information about ros2_control can be found here: https://control.ros.org/

This package provides a Gazebo-Sim system plugin which instantiates a ros2_control controller manager and connects it to a Gazebo model.

ROS version Gazebo version Branch Binaries hosted at APT key
Humble Fortress humble https://packages.ros.org ros-humble-ign-ros2-control
Jazzy Harmonic jazzy https://packages.ros.org ros-jazzy-gz-ros2-control
Rolling Harmonic master https://packages.ros.org ros-rolling-gz-ros2-control

Build status

ROS 2 Distro Branch Build status Documentation
Rolling rolling gazebo_ros2_control CI - Rolling Documentation
API Reference
Jazzy jazzy gazebo_ros2_control CI - Jazzy Documentation
API Reference
Humble humble ign_ros2_control CI - Humble Documentation
API Reference

Documentation

See the documentation file or control.ros.org

Compile from source

Note that gz_ros2_control depends on the version of Gazebo that is provided by the Gazebo Vendor packages gz_plugin_vendor and gz_sim_vendor. Currently, for ROS 2 Jazzy and Rolling, the Gazebo version is Harmonic.

To compile gz_ros2_control from source, create a workspace, clone the correct branch of this repo and compile it:

mkdir -p ~/gz_ros2_control_ws/src
cd ~/gz_ros2_control_ws/src
git clone https://github.com/ros-controls/gz_ros2_control -b {ROS_DISTRO}
rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y
cd ~/gz_ros2_control_ws
colcon build

CONTRIBUTING

No CONTRIBUTING.md found.

Repository Summary

Checkout URI https://github.com/ros-controls/gz_ros2_control.git
VCS Type git
VCS Version rolling
Last Updated 2024-12-23
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

README

gz_ros2_control

ROS2 Distro Build Status Package build
Licence Build Status Build Status

This is a ROS 2 package for integrating the ros2_control controller architecture with the Gazebo simulator. More information about ros2_control can be found here: https://control.ros.org/

This package provides a Gazebo-Sim system plugin which instantiates a ros2_control controller manager and connects it to a Gazebo model.

ROS version Gazebo version Branch Binaries hosted at APT key
Humble Fortress humble https://packages.ros.org ros-humble-ign-ros2-control
Jazzy Harmonic jazzy https://packages.ros.org ros-jazzy-gz-ros2-control
Rolling Harmonic rolling https://packages.ros.org ros-rolling-gz-ros2-control

Build status

ROS 2 Distro Branch Build status Documentation
Rolling rolling gazebo_ros2_control CI - Rolling Documentation
API Reference
Jazzy jazzy gazebo_ros2_control CI - Jazzy Documentation
API Reference
Humble humble ign_ros2_control CI - Humble Documentation
API Reference

Documentation

See the documentation file or control.ros.org

Compile from source

Note that gz_ros2_control depends on the version of Gazebo that is provided by the Gazebo Vendor packages gz_plugin_vendor and gz_sim_vendor. Currently, for ROS 2 Jazzy and Rolling, the Gazebo version is Harmonic.

To compile gz_ros2_control from source, create a workspace, clone the correct branch of this repo and compile it:

mkdir -p ~/gz_ros2_control_ws/src
cd ~/gz_ros2_control_ws/src
git clone https://github.com/ros-controls/gz_ros2_control -b {ROS_DISTRO}
rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y
cd ~/gz_ros2_control_ws
colcon build

CONTRIBUTING

No CONTRIBUTING.md found.

Repository Summary

Checkout URI https://github.com/ros-controls/gz_ros2_control.git
VCS Type git
VCS Version iron
Last Updated 2024-11-01
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

README

gz_ros2_control

ROS2 Distro Build Status Package build
Licence Build Status Build Status

This is a ROS 2 package for integrating the ros2_control controller architecture with the Gazebo simulator. More information about ros2_control can be found here: https://control.ros.org/

This package provides a Gazebo-Sim system plugin which instantiates a ros2_control controller manager and connects it to a Gazebo model.

ROS version Gazebo version Branch Binaries hosted at APT key
Humble Fortress humble https://packages.ros.org ros-humble-ign-ros2-control
Iron Edifice iron only from source  
Iron Fortress iron https://packages.ros.org ros-iron-gz-ros2-control
Iron Garden iron only from source  
Iron Harmonic iron only from source  
Jazzy Harmonic master https://packages.ros.org ros-jazzy-gz-ros2-control
Rolling Harmonic master https://packages.ros.org ros-rolling-gz-ros2-control

Build status

ROS 2 Distro | Branch | Build status | Documentation :———-: | :—-: | :———-: | :———–: Rolling | master | gazebo_ros2_control CI - Rolling | Documentation
API Reference Iron | iron | gazebo_ros2_control CI - Iron | Documentation
API Reference Humble | humble | ign_ros2_control CI - Humble | Documentation
API Reference

Documentation

See the documentation file or control.ros.org

Compile from source

If you want compile this from source, you should choose the Gazebo version. The default one is garden:

export GZ_VERSION=fortress
export GZ_VERSION=garden
export GZ_VERSION=harmonic

Then create a workspace, clone the correct branch of this repo and compile it:

mkdir -p ~/gz_ros2_control_ws/src
cd ~/gz_ros2_control_ws/src
git clone https://github.com/ros-controls/gz_ros2_control -b iron
rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y
cd ~/gz_ros2_control_ws
colcon build

CONTRIBUTING

No CONTRIBUTING.md found.