Skip to content

Commit

Permalink
Cleanup new demos structure (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich authored and destogl committed Mar 8, 2023
1 parent aad8d5e commit 2d17124
Show file tree
Hide file tree
Showing 83 changed files with 459 additions and 4,382 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/ci-coverage-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ jobs:
import-token: ${{ secrets.GITHUB_TOKEN }}
# build all packages listed in the meta package
package-name:
diffbot_description
ros2_control_demo_bringup
ros2_control_demo_hardware
rrbot_description
ros2_control_demo_example_1
ros2_control_demo_example_2
ros2_control_demo_example_3
ros2_control_demo_example_4
ros2_control_demo_example_5
ros2_control_demo_example_6
ros2_control_demo_example_8

vcs-repo-file-url: |
https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/ros2_control_demos-not-released.${{ env.ROS_DISTRO }}.repos?token=${{ secrets.GITHUB_TOKEN }}
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/ci-ros-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ jobs:
distribution: rolling
linter: ${{ matrix.linter }}
package-name:
diffbot_description
ros2_control_demo_bringup
ros2_control_demo_hardware
rrbot_description

ros2_control_demo_example_1
ros2_control_demo_example_2
ros2_control_demo_example_3
ros2_control_demo_example_4
ros2_control_demo_example_5
ros2_control_demo_example_6
ros2_control_demo_example_8

ament_lint_100:
name: ament_${{ matrix.linter }}
Expand All @@ -40,7 +42,10 @@ jobs:
linter: cpplint
arguments: "--linelength=100 --filter=-whitespace/newline"
package-name:
diffbot_description
ros2_control_demo_bringup
ros2_control_demo_hardware
rrbot_description
ros2_control_demo_example_1
ros2_control_demo_example_2
ros2_control_demo_example_3
ros2_control_demo_example_4
ros2_control_demo_example_5
ros2_control_demo_example_6
ros2_control_demo_example_8
11 changes: 7 additions & 4 deletions .github/workflows/reusable-ros-tooling-source-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ jobs:
target-ros2-distro: ${{ inputs.ros_distro }}
# build all packages listed in the meta package
package-name:
diffbot_description
ros2_control_demo_bringup
ros2_control_demo_hardware
rrbot_description
ros2_control_demo_example_1
ros2_control_demo_example_2
ros2_control_demo_example_3
ros2_control_demo_example_4
ros2_control_demo_example_5
ros2_control_demo_example_6
ros2_control_demo_example_8

vcs-repo-file-url: |
https://raw.githubusercontent.com/ros2/ros2/${{ inputs.ros_distro }}/ros2.repos
Expand Down
190 changes: 3 additions & 187 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ It consists of simple implementations that demonstrate different concepts.

If you want to have rather step by step manual how to do things with `ros2_control` checkout [ros-control/roscon2022_workshop](https://github.com/ros-controls/roscon2022_workshop) repository.

### Goals

The repository has two other goals goals:

1. Implements the example configuration described in the `ros-controls/roadmap` repository file [components_architecture_and_urdf_examples](https://github.com/ros-controls/roadmap/blob/master/design_drafts/components_architecture_and_urdf_examples.md).
2. The repository is a validation environment for `ros2_control` concepts, which can only be tested during run-time (e.g., execution of controllers by the controller manager, communication between robot hardware and controllers).


## Getting started

Expand Down Expand Up @@ -44,79 +37,10 @@ The concepts in this package are demonstrated on the examples of *RRBot* and *Di
Those two world-known imaginary robots are trivial simulations to demonstrate and test `ros2_control` concepts.


## What you can Find in This Repository and Example Description

This repository demonstrates the following `ros2_control` concepts:

* Creating a `*HardwareInterface` for a System, Sensor, and Actuator.
* Creating a robot description in the form of URDF files.
* Loading the configuration and starting a robot using launch files.
* Control of a differential mobile base *DiffBot*.
* Control of two joints of *RRBot*.
* Using simulated robots and starting `ros2_control` with Gazebo simulator.
* Implementing a controller switching strategy for a robot.
* Using joint limits and transmission concepts in `ros2_control`.


### Example Overview

Check README file inside each example folder for detailed description.


##### Example 1

*RRBot* - or ''Revolute-Revolute Manipulator Robot'' - a simple position controlled robot with one hardware interface.


##### Example 2

*DiffBot*, or ''Differential Mobile Robot'', is a simple mobile base with differential drive.
The robot is basically a box moving according to differential drive kinematics.


##### Example 3

*RRBot* - or ''Revolute-Revolute Manipulator Robot'' with multiple interfaces


##### Example 4: "Industrial robot with integrated sensor"
*RRBot* - or ''Revolute-Revolute Manipulator Robot'' - a simple position controlled robot with an integrated sensor.


##### Example 5: "Industrial Robots with externally connected sensor"
*RRBot* - or ''Revolute-Revolute Manipulator Robot'' - a simple position controlled robot with an externally connected sensor.


##### Example 6: "Modular Robots with separate communication to each actuator"

The example shows how to implement robot hardware with separate communication to each actuator.


##### Example 8: Using transmissions
*RRBot* - or ''Revolute-Revolute Manipulator Robot'' - with an exposed transmission interface


## Quick Hints

These are some quick hints, especially for those coming from a ROS1 control background:

* There are now three categories of hardware components: *Sensor*, *Actuator*, and *System*.
*Sensor* is for individual sensors; *Actuator* is for individual actuators; *System* is for any combination of multiple sensors/actuators.
You could think of a Sensor as read-only.
All components are used as plugins and therefore exported using `PLUGINLIB_EXPORT_CLASS` macro.
* *ros(1)_control* only allowed three hardware interface types: position, velocity, and effort.
*ros2_control* allows you to create any interface type by defining a custom string. For example, you might define a `position_in_degrees` or a `temperature` interface.
The most common (position, velocity, acceleration, effort) are already defined as constants in hardware_interface/types/hardware_interface_type_values.hpp.
* Joint names in <ros2_control> tags in the URDF must be compatible with the controller's configuration.
* In ros2_control, all parameters for the driver are specified in the URDF.
The ros2_control framework uses the **<ros2_control>** tag in the URDF.
* Joint names in <ros2_control> tags in the URDF must be compatible with the controller's configuration.


## Build status

ROS2 Distro | Branch | Build status | Documentation
:---------: | :----: | :----------: | :-----------:
ROS 2 Distro | Branch | Build status | Documentation
:----------: | :----: | :----------: | :-----------:
**Rolling** | [`master`](https://github.com/ros-controls/ros2_control_demos/tree/rolling) | [![Rolling Binary Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/rolling-binary-build.yml/badge.svg?branch=master)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/rolling-binary-build.yml?branch=master) <br /> [![Rolling Semi-Binary Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/rolling-semi-binary-build.yml/badge.svg?branch=master)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/rolling-semi-binary-build.yml?branch=master) <br /> [![Rolling Source Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/rolling-source-build.yml/badge.svg?branch=master)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/rolling-source-build.yml?branch=master) | [Documentation](https://control.ros.org) <br /> [API Reference](https://control.ros.org/rolling/api/)
**Rolling - last Focal** | [`master`](https://github.com/ros-controls/ros2_control_demos/tree/rolling) | [![Rolling Binary Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/rolling-binary-build-last-focal.yml/badge.svg?branch=master)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/rolling-binary-build-last-focal.yml?branch=master) <br /> [![Rolling Semi-Binary Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/rolling-semi-binary-build-last-focal.yml/badge.svg?branch=master)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/rolling-semi-binary-build-last-focal.yml?branch=master) | [Documentation](https://control.ros.org) <br /> [API Reference](https://control.ros.org/rolling/api/)
**Galactic** | [`galactic`](https://github.com/ros-controls/ros2_control_demos/tree/galactic) | [![Galactic Binary Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/galactic-binary-build.yml/badge.svg?branch=galactic)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/galactic-binary-build.yml?branch=galactic) <br /> [![Galactic Semi-Binary Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/galactic-semi-binary-build.yml/badge.svg?branch=galactic)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/galactic-semi-binary-build.yml?branch=galactic) <br /> [![Galactic Source Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/galactic-source-build.yml/badge.svg?branch=galactic)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/galactic-source-build.yml?branch=galactic) | [Documentation](https://control.ros.org) <br /> [API Reference](https://control.ros.org/rolling/api/)
Expand Down Expand Up @@ -145,7 +69,7 @@ git clone https://github.com/ros-controls/ros2_controllers
git clone https://github.com/ros-controls/ros2_control_demos
```

**NOTE**: `ros2_control` and `ros2_controllers` packages are released for foxy and can be installed using a package manager.
**NOTE**: `ros2_control` and `ros2_controllers` packages are released and can be installed using a package manager.
We provide officially released and maintained debian packages, which can easily be installed via aptitude.
However, there might be cases in which not-yet released demos or features are only available through a source build in your own workspace.

Expand All @@ -160,111 +84,3 @@ However, there might be cases in which not-yet released demos or features are on
```

* Do not forget to source `setup.bash` from the `install` folder!


# Getting Started with demos

This repository provides the following simple example robots: a 2 degrees of freedom manipulator - *RRBot* - and a mobile differential drive base - *DiffBot*.
The first two examples demonstrate the minimal setup for those two robots to run.
Later examples show more details about `ros2_control`-concepts and some more advanced use-cases.

# Examples of ros2_control concepts

Each of the described example cases from the [roadmap](https://github.com/ros-controls/roadmap/blob/master/design_drafts/components_architecture_and_urdf_examples.md) has its own launch and URDF file.


### General notes about examples

1. Each example is started with a single launch file which starts up the robot hardware, loads controller configurations and it also opens `RViz`.

The `RViz` setup can be recreated following these steps:

- The robot models can be visualized using `RobotModel` display using `/robot_description` topic.
- Or you can simply open the configuration from `rviz` folder in `rrbot_description` or `diffbot_description` package manually or directly by executing:
```
rviz2 --display-config `ros2 pkg prefix rrbot_description`/share/rrbot_description/config/rrbot.rviz
```

1. To check that robot descriptions are working properly use following launch commands:
```
ros2 launch rrbot_description view_robot.launch.py
```
Optional arguments for specific example (the robot visualization will be the same for all examples):
```
description_file:=rrbot_system_multi_interface.urdf.xacro
```

**NOTE**: Getting the following output in terminal is OK: `Warning: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist`.
This happens because `joint_state_publisher_gui` node need some time to start.


1. To start an example open a terminal, source your ROS2-workspace and execute a launch file with:
```
ros2 launch ros2_control_demo_bringup <example_launch_file>
```

1. To stop RViz2 from auto-start use `start_rviz:=false` launch file argument.

1. To check if the hardware interface loaded properly, open another terminal and execute:
```
ros2 control list_hardware_interfaces
```
You should get something like:
```
command interfaces
joint1/position [unclaimed]
joint2/position [unclaimed]
state interfaces
joint1/position
joint2/position
```

1. Check which controllers are running using:
```
ros2 control list_controllers
```
You should get something like:
```
forward_position_controller[forward_command_controller/ForwardCommandController] unconfigured
joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster] active
```

1. Check [Controllers and moving hardware](#controllers-and-moving-hardware) section to move *RRBot*.


*NOTE:* The examples reuse the same, configurable base-launch file [`rrbot_base.launch.py`](ros2_control_demo_bringup/launch/rrbot_base.launch.py).
This also demonstrates how launch files are usually reused for different scenarios when working with `ros2_control`.


### Example 1: "Industrial Robots with only one interface"

Files:
- Launch file: [rrbot_system_position_only.launch.py](ros2_control_demo_bringup/launch/rrbot_system_position_only.launch.py)
- Controllers yaml: [rrbot_controllers.yaml](ros2_control_demo_bringup/config/rrbot_controllers.yaml)
- URDF: [rrbot_system_position_only.urdf.xacro](ros2_control_demos/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_position_only.urdf.xacro)
- `ros2_control` URDF tag: [rrbot_system_position_only.ros2_control.xacro](ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_position_only.ros2_control.xacro)

Interfaces:
- Command interfaces:
- joint1/position
- joint2/position
- State interfaces:
- joint1/position
- joint2/position

Available controllers:
- `joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster]`
- `forward_position_controller[forward_command_controller/ForwardCommandController]` (position)

Moving the robot:
- see below description of `forward_position_controller`

Available launch file options:
- `use_fake_hardware:=true` - start `FakeSystem` instead of hardware.
This is a simple simulation that mimics joint command to their states.
This is useful to test *ros2_control* integration and controllers without physical hardware.


### Example 1-Sim: "Industrial Robots with only one interface" (Gazebo simulation)

- **TBA**
103 changes: 103 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
.. _ros2_control_demos:

#################
Demos
#################

This `GitHub Repository <https://github.com/ros-controls/ros2_control_demos>`_
provides templates for the development of ros2_control-enabled robots and a simple simulations to demonstrate and prove ros2_control concepts.

If you want to have a rather step by step manual how to do things with ``ros2_control`` checkout `ros-control/roscon2022_workshop <https://github.com/ros-controls/roscon2022_workshop>`_ repository.

==========================================
What you can find in this repository
==========================================

This repository demonstrates the following ``ros2_control`` concepts:

* Creating a ``HardwareInterface`` for a System, Sensor, and Actuator.
* Creating a robot description in the form of URDF files.
* Loading the configuration and starting a robot using launch files.
* Control of a differential mobile base *DiffBot*.
* Control of two joints of *RRBot*.
* Implementing a controller switching strategy for a robot.
* Using joint limits and transmission concepts in ``ros2_control``.

=====================
Goals
=====================

The repository has two other goals:

1. Implements the example configuration described in the ``ros-controls/roadmap`` repository file `components_architecture_and_urdf_examples <https://github.com/ros-controls/roadmap/blob/master/design_drafts/components_architecture_and_urdf_examples.md>`_.
2. The repository is a validation environment for ``ros2_control`` concepts, which can only be tested during run-time (e.g., execution of controllers by the controller manager, communication between robot hardware and controllers).

=====================
Example Overview
=====================

* Example 1: RRBot

*RRBot* - or ''Revolute-Revolute Manipulator Robot'' - a simple position controlled robot with one hardware interface. This example also demonstrates the switching between different controllers.


* Example 2: DiffBot

*DiffBot*, or ''Differential Mobile Robot'', is a simple mobile base with differential drive.
The robot is basically a box moving according to differential drive kinematics.


* Example 3: "RRBot with multiple interfaces"

*RRBot* with multiple interfaces.


* Example 4: "Industrial robot with integrated sensor"

*RRBot* with an integrated sensor.


* Example 5: "Industrial Robots with externally connected sensor"

*RRBot* with an externally connected sensor.

* Example 6: "Modular Robots with separate communication to each actuator"

The example shows how to implement robot hardware with separate communication to each actuator.


* Example 8: Using transmissions

*RRBot* with an exposed transmission interface.

=====================
Quick Hints
=====================

These are some quick hints, especially for those coming from a ROS1 control background:

* There are now three categories of hardware components: *Sensor*, *Actuator*, and *System*.
*Sensor* is for individual sensors; *Actuator* is for individual actuators; *System* is for any combination of multiple sensors/actuators.
You could think of a Sensor as read-only.
All components are used as plugins and therefore exported using ``PLUGINLIB_EXPORT_CLASS`` macro.
* *ros(1)_control* only allowed three hardware interface types: position, velocity, and effort.
*ros2_control* allows you to create any interface type by defining a custom string. For example, you might define a ``position_in_degrees`` or a ``temperature`` interface.
The most common (position, velocity, acceleration, effort) are already defined as constants in hardware_interface/types/hardware_interface_type_values.hpp.
* Joint names in <ros2_control> tags in the URDF must be compatible with the controller's configuration.
* In ros2_control, all parameters for the driver are specified in the URDF.
The ros2_control framework uses the **<ros2_control>** tag in the URDF.
* Joint names in <ros2_control> tags in the URDF must be compatible with the controller's configuration.

=====================
Examples
=====================
.. toctree::
:titlesonly:

Example 1: RRBot <../example_1/doc/userdoc.rst>
Example 2: DiffBot <../example_2/doc/userdoc.rst>
Example 3: RRBot with multiple interfaces <../example_3/doc/userdoc.rst>
Example 4: Industrial robot with integrated sensor <../example_4/doc/userdoc.rst>
Example 5: Industrial Robots with externally connected sensor <../example_5/doc/userdoc.rst>
Example 6: Modular Robots with separate communication to each actuator <../example_6/doc/userdoc.rst>
Example 8: Using transmissions <../example_8/doc/userdoc.rst>
Loading

0 comments on commit 2d17124

Please sign in to comment.