Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
124 changes: 11 additions & 113 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,15 @@ The important files to check in each example are:
The concepts in this package are demonstrated on the examples of *RRBot* and *DiffBot*.
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 `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`.

Expand All @@ -63,37 +61,36 @@ This repository demonstrates the following `ros2_control` concepts:
Check README file inside each example folder for detailed description.


##### Example 1
##### Example 1: RRBot

*RRBot* - or ''Revolute-Revolute Manipulator Robot'' - a simple position controlled robot with one hardware interface.
*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
##### 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
##### Example 3: "RRBot with multiple interfaces"

*RRBot* - or ''Revolute-Revolute Manipulator Robot'' with multiple interfaces
*RRBot* 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.
*RRBot* 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.
*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* - or ''Revolute-Revolute Manipulator Robot'' - with an exposed transmission interface
*RRBot* with an exposed transmission interface.


## Quick Hints
Expand All @@ -115,7 +112,7 @@ These are some quick hints, especially for those coming from a ROS1 control back

## 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/)
Expand Down Expand Up @@ -145,7 +142,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 @@ -162,109 +159,10 @@ 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**
7 changes: 7 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. _ros2_control_demos:

#################
Demos
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which infos should we move from README.md to this rst file? All except build instructions and build?

If someone starts from control.ros.org with installed debian packages, the Getting started section is maybe not necessary in the documentation but only in the readme if the repo is checked out?

What about the figures in the doc folder, they are at least not up-to-date?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a suggestion, feel free to comment.
I had to rename the README.rst to doc/userdoc.rst, because it would be excluded otherwise. Is there a reason for that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I think rst would be upset about the too many ###?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sphinx did not complain. I think the type of character does not matter.

#################

This repository provides templates for the development of ros2_control-enabled robots and a simple simulations to demonstrate and prove ros2_control concepts.
52 changes: 21 additions & 31 deletions example_1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
cmake_minimum_required(VERSION 3.5)
project(ros2_control_demo_example_1)
cmake_minimum_required(VERSION 3.16)
project(ros2_control_demo_example_1 LANGUAGES CXX)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
add_compile_options(-Wall -Wextra)
endif()

Expand All @@ -27,17 +22,17 @@ endforeach()

## COMPILE
add_library(
${PROJECT_NAME}
ros2_control_demo_example_1
SHARED
hardware/rrbot.cpp
)
target_include_directories(
${PROJECT_NAME}
PRIVATE
hardware/include
target_compile_features(ros2_control_demo_example_1 PUBLIC cxx_std_17)
target_include_directories(ros2_control_demo_example_1 PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/hardware/include>
$<INSTALL_INTERFACE:include/ros2_control_demo_example_1>
)
ament_target_dependencies(
${PROJECT_NAME}
ros2_control_demo_example_1 PUBLIC
${THIS_PACKAGE_INCLUDE_DEPENDS}
)

Expand All @@ -49,35 +44,30 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_EXAMPLE_1_
pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_example_1.xml)

# INSTALL
install(
TARGETS ${PROJECT_NAME}
DESTINATION lib
)
install(
DIRECTORY hardware/include/
DESTINATION include
DESTINATION include/ros2_control_demo_example_1
)
install(
DIRECTORY description/launch description/ros2_control description/urdf description/rviz description/meshes
DESTINATION share/${PROJECT_NAME}
DIRECTORY description/launch description/ros2_control description/urdf description/rviz
DESTINATION share/ros2_control_demo_example_1
)
install(
DIRECTORY bringup/launch bringup/config
DESTINATION share/${PROJECT_NAME}
DESTINATION share/ros2_control_demo_example_1
)
install(TARGETS ros2_control_demo_example_1
EXPORT export_ros2_control_demo_example_1
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
endif()

## EXPORTS
ament_export_include_directories(
include
)
ament_export_libraries(
${PROJECT_NAME}
)
ament_export_dependencies(
${THIS_PACKAGE_INCLUDE_DEPENDS}
)
ament_export_targets(export_ros2_control_demo_example_1 HAS_LIBRARY_TARGET)
ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS})
ament_package()
Loading