diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 000000000..05a48fc65
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,13 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for all configuration options:
+# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ # Workflow files stored in the
+ # default location of `.github/workflows`
+ directory: "/"
+ schedule:
+ interval: "weekly"
diff --git a/.github/reviewer-lottery.yml b/.github/reviewer-lottery.yml
index fbaf95434..a6a949fb7 100644
--- a/.github/reviewer-lottery.yml
+++ b/.github/reviewer-lottery.yml
@@ -14,28 +14,22 @@ groups:
reviewers: 5
usernames:
- rosterloh
- - kellyprankin
- progtologist
- arne48
- DasRoteSkelett
- - a10263790
- Serafadam
- harderthan
- jaron-l
- malapatiravi
- - erickisos
- - ShawnSchaerer
- - Briancbn
- - TomoyaFujita2016
- homalozoa
+ - erickisos
- anfemosa
- - jackcenter
- VX792
- mhubii
- livanov93
- aprotyas
- peterdavidfagan
- - UsamaHamayun1
- duringhof
- bijoua29
- - kasiceo
+ - lm2292
+ - mcbed
diff --git a/.github/workflows/ci-coverage-build.yml b/.github/workflows/ci-coverage-build.yml
index 8e3685fd5..ebd5e1709 100644
--- a/.github/workflows/ci-coverage-build.yml
+++ b/.github/workflows/ci-coverage-build.yml
@@ -38,7 +38,7 @@ jobs:
}
colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
skip-tests: true
- - uses: codecov/codecov-action@v1.0.14
+ - uses: codecov/codecov-action@v3.1.1
with:
file: ros_ws/lcov/total_coverage.info
flags: unittests
diff --git a/.github/workflows/ci-format.yml b/.github/workflows/ci-format.yml
index 77c35301d..2d0286518 100644
--- a/.github/workflows/ci-format.yml
+++ b/.github/workflows/ci-format.yml
@@ -13,11 +13,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- - uses: actions/setup-python@v2
+ - uses: actions/setup-python@v4.4.0
with:
- python-version: 3.9.7
+ python-version: '3.10'
- name: Install system hooks
- run: sudo apt install -qq clang-format-11 cppcheck
- - uses: pre-commit/action@v2.0.3
+ run: sudo apt install -qq clang-format-14 cppcheck
+ - uses: pre-commit/action@v3.0.0
with:
extra_args: --all-files --hook-stage manual
diff --git a/.github/workflows/rolling-rhel-binary-build.yml b/.github/workflows/rolling-rhel-binary-build.yml
index 6df1dfbbc..341f4e2fa 100644
--- a/.github/workflows/rolling-rhel-binary-build.yml
+++ b/.github/workflows/rolling-rhel-binary-build.yml
@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
env:
ROS_DISTRO: rolling
- container: jaronl/ros:rolling-alma
+ container: ghcr.io/ros-controls/ros:${{ env.ROS_DISTRO }}-rhel
steps:
- uses: actions/checkout@v3
with:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index afead9e0c..c401416a7 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -15,7 +15,7 @@
repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.1.0
+ rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-ast
@@ -33,26 +33,26 @@ repos:
# Python hooks
- repo: https://github.com/asottile/pyupgrade
- rev: v2.31.1
+ rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/psf/black
- rev: 22.1.0
+ rev: 22.12.0
hooks:
- id: black
args: ["--line-length=99"]
- # PEP 257
- - repo: https://github.com/FalconSocial/pre-commit-mirrors-pep257
- rev: v0.3.3
+ # PyDocStyle
+ - repo: https://github.com/PyCQA/pydocstyle
+ rev: 6.2.3
hooks:
- - id: pep257
+ - id: pydocstyle
args: ["--ignore=D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404"]
- repo: https://github.com/pycqa/flake8
- rev: 4.0.1
+ rev: 6.0.0
hooks:
- id: flake8
args: ["--ignore=E501"]
@@ -63,7 +63,7 @@ repos:
- id: clang-format
name: clang-format
description: Format files with ClangFormat.
- entry: clang-format-10
+ entry: clang-format-14
language: system
files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$
args: ['-fallback-style=none', '-i']
@@ -119,7 +119,7 @@ repos:
# Docs - RestructuredText hooks
- repo: https://github.com/PyCQA/doc8
- rev: 0.10.1
+ rev: v1.1.1
hooks:
- id: doc8
args: ['--max-line-length=100', '--ignore=D001']
@@ -136,7 +136,7 @@ repos:
# Spellcheck in comments and docs
# skipping of *.svg files is not working...
- repo: https://github.com/codespell-project/codespell
- rev: v2.1.0
+ rev: v2.2.2
hooks:
- id: codespell
args: ['--write-changes']
diff --git a/README.md b/README.md
index d5ba25d92..b2eaaf571 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,15 @@
This repository provides templates for the development of `ros2_control`-enabled robots and a simple simulations to demonstrate and prove `ros2_control` concepts.
+### First-Time Users
+
+If you're just starting out, we suggest to look at the minimal example: `ros2_control_demo_bringup/launch/rrbot_system_position_only.launch.py`.
+
+Also pay attention to these files:
+
+- `ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_position_only.ros2_control.xacro` -- this file defines the ros2_control interfaces for each joint, e.g. position or velocity. The simulation can be launched with Gazebo or simulated with RViz only.
+- `rrbot_controllers.yaml` -- list the controllers that will be launched.
+
### Goals
The repository has three goals:
@@ -14,12 +23,12 @@ The repository has three goals:
## Build status
-ROS2 Distro | Branch | Build status | Documentation | Released packages
-:---------: | :----: | :----------: | :-----------: | :---------------:
-**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)
[![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)
[![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)
[API Reference](https://control.ros.org/rolling/api/) | [ros2_control_demos](https://index.ros.org/p/ros2_control_demos/#rolling)
-**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)
[![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)
[API Reference](https://control.ros.org/rolling/api/) | [ros2_control_demos](https://index.ros.org/p/ros2_control_demos/#rolling)
-**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)
[![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)
[![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)
[API Reference](https://control.ros.org/rolling/api/) | [ros2_control_demos](https://index.ros.org/p/ros2_control_demos/#galactic)
-**Foxy** | [`foxy`](https://github.com/ros-controls/ros2_control_demos/tree/foxy) | [![Foxy Binary Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/foxy-binary-build.yml/badge.svg?branch=foxy)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/foxy-binary-build.yml?branch=foxy)
[![Foxy Semi-Binary Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/foxy-semi-binary-build.yml/badge.svg?branch=foxy)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/foxy-semi-binary-build.yml?branch=foxy)
[![Foxy Source Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/foxy-source-build.yml/badge.svg?branch=foxy)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/foxy-source-build.yml?branch=foxy) | [Documentation](https://control.ros.org)
[API Reference](https://control.ros.org/rolling/api/) | [ros2_control_demos](https://index.ros.org/p/ros2_control_demos/#foxy)
+ROS2 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)
[![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)
[![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)
[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)
[![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)
[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)
[![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)
[![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)
[API Reference](https://control.ros.org/rolling/api/)
+**Foxy** | [`foxy`](https://github.com/ros-controls/ros2_control_demos/tree/foxy) | [![Foxy Binary Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/foxy-binary-build.yml/badge.svg?branch=foxy)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/foxy-binary-build.yml?branch=foxy)
[![Foxy Semi-Binary Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/foxy-semi-binary-build.yml/badge.svg?branch=foxy)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/foxy-semi-binary-build.yml?branch=foxy)
[![Foxy Source Build](https://github.com/ros-controls/ros2_control_demos/actions/workflows/foxy-source-build.yml/badge.svg?branch=foxy)](https://github.com/ros-controls/ros2_control_demos/actions/workflows/foxy-source-build.yml?branch=foxy) | [Documentation](https://control.ros.org)
[API Reference](https://control.ros.org/rolling/api/)
### Explanation of different build types
@@ -122,13 +131,13 @@ The *RRBot* URDF files can be found in the `urdf` folder of `rrbot_description`
The `joint_state_publisher_gui` provides a GUI to generate a random configuration for rrbot. It is immediately displayed in `Rviz`.
-1. To start *RRBot* example open open a terminal, source your ROS2-workspace and execute its launch file with:
+1. To start *RRBot* example open a terminal, source your ROS2-workspace and execute its launch file with:
```
ros2 launch ros2_control_demo_bringup rrbot.launch.py
```
The launch file loads and starts the robot hardware, controllers and opens `RViz`.
In starting terminal you will see a lot of output from the hardware implementation showing its internal states.
- This is only of exemplary purpuses and should be avoided as much as possible in a hardware interface implementation.
+ This is only of exemplary purposes and should be avoided as much as possible in a hardware interface implementation.
If you can see two orange and one yellow rectangle in in `RViz` everything has started properly.
Still, to be sure, let's introspect the control system before moving *RRBot*.
@@ -244,7 +253,7 @@ The *DiffBot* URDF files can be found in `urdf` folder of `diffbot_description`
1. If everything is fine, now you can send a command to *Diff Drive Controller* using ros2 cli interface:
```
- ros2 topic pub --rate 30 /cmd_vel geometry_msgs/msg/Twist "linear:
+ ros2 topic pub --rate 30 /diffbot_base_controller/cmd_vel_unstamped geometry_msgs/msg/Twist "linear:
x: 0.7
y: 0.0
z: 0.0
@@ -346,6 +355,7 @@ This also demonstrates how launch files are usually reused for different scenari
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:
@@ -379,6 +389,7 @@ Available launch file options:
Files:
- Launch file: [rrbot_system_multi_interface.launch.py](ros2_control_demo_bringup/launch/rrbot_system_multi_interface.launch.py)
- Controllers yaml: [rrbot_multi_interface_forward_controllers.yaml](ros2_control_demo_bringup/config/rrbot_multi_interface_forward_controllers.yaml)
+ - URDF: [rrbot_system_multi_interface.urdf.xacro](ros2_control_demo_description/rrbot_description/urdf/rrbot_system_multi_interface.urdf.xacro)
- `ros2_control` URDF tag: [rrbot_system_multi_interface.ros2_control.xacro](ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_multi_interface.ros2_control.xacro)
Interfaces:
@@ -434,7 +445,8 @@ Useful launch-file options:
### Example 3: "Industrial robot with integrated sensor"
- Launch file: [rrbot_system_with_sensor.launch.py](ros2_control_demo_bringup/launch/rrbot_system_with_sensor.launch.py)
-- URDF: [rrbot_system_with_sensor.urdf.xacro](ros2_control_demo_bringup/config/rrbot_with_sensor_controllers.yaml)
+- Controllers: [rrbot_with_sensor_controllers.yaml](ros2_control_demo_bringup/config/rrbot_with_sensor_controllers.yaml)
+- URDF: [rrbot_system_with_sensor.urdf.xacro](ros2_control_demo_description/rrbot_description/urdf/rrbot_system_with_sensor.urdf.xacro)
- ros2_control URDF: [rrbot_system_with_sensor.ros2_control.xacro](ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_with_sensor.ros2_control.xacro)
- Command interfaces:
@@ -465,8 +477,11 @@ ros2 topic echo /fts_broadcaster/wrench
### Example 4: "Industrial Robots with externally connected sensor"
- Launch file: [rrbot_system_with_external_sensor.launch.py](ros2_control_demo_bringup/launch/rrbot_system_with_external_sensor.launch.py)
-- URDF: [rrbot_with_external_sensor_controllers.urdf.xacro](ros2_control_demo_bringup/config/rrbot_with_external_sensor_controllers.yaml)
-- ros2_control URDF: [external_rrbot_force_torque_sensor.ros2_control.xacro](ros2_control_demo_description/rrbot_description/ros2_control/external_rrbot_force_torque_sensor.ros2_control.xacro)
+- Controllers: [rrbot_with_external_sensor_controllers.yaml](ros2_control_demo_bringup/config/rrbot_with_external_sensor_controllers.yaml)
+- URDF: [rrbot_with_external_sensor_controllers.urdf.xacro](ros2_control_demo_description/rrbot_description/urdf/rrbot_with_external_sensor_controllers.urdf.xacro)
+- ros2_control URDF:
+ - robot: [rrbot_system_position_only.ros2_control.xacro](ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_position_only.ros2_control.xacro)
+ - sensor: [external_rrbot_force_torque_sensor.ros2_control.xacro](ros2_control_demo_description/rrbot_description/ros2_control/external_rrbot_force_torque_sensor.ros2_control.xacro)
- Command interfaces:
- joint1/position
@@ -497,7 +512,8 @@ ros2 topic echo /fts_broadcaster/wrench
### Example 5: "Modular Robots with separate communication to each actuator"
- Launch file: [rrbot_modular_actuators.launch.py](ros2_control_demo_bringup/launch/rrbot_modular_actuators.launch.py)
-- URDF: [rrbot_modular_actuators.urdf.xacro](ros2_control_demo_bringup/config/rrbot_modular_actuators.yaml)
+- Controllers: [rrbot_modular_actuators.yaml](ros2_control_demo_bringup/config/rrbot_modular_actuators.yaml)
+- URDF: [rrbot_modular_actuators.urdf.xacro](ros2_control_demo_description/rrbot_description/urdf/rrbot_modular_actuators.urdf.xacro)
- ros2_control URDF: [rrbot_modular_actuators.ros2_control.xacro](ros2_control_demo_description/rrbot_description/ros2_control/rrbot_modular_actuators.ros2_control.xacro)
- Command interfaces:
@@ -517,7 +533,7 @@ Commanding the robot: see the commands below.
## Controllers and moving hardware
To move the robot you should load and start controllers.
-The `JointStateController` is used to publish the joint states to ROS topics.
+The `JointStateBroadcaster` is used to publish the joint states to ROS topics.
Direct joint commands are sent to this robot via the `ForwardCommandController` and `JointTrajectoryController`.
The sections below describe their usage.
Check the [Results](##result) section on how to ensure that things went well.
@@ -528,11 +544,11 @@ ros2 control list_controllers
```
-### JointStateController
+### JointStateBroadcaster
-Open another terminal and load, configure and start `joint_state_controller`:
+Open another terminal and load, configure and start `joint_state_broadcaster`:
```
-ros2 control set_controller_state joint_state_controller start
+ros2 control set_controller_state joint_state_broadcaster start
```
Check if controller is loaded properly:
```
@@ -540,7 +556,7 @@ ros2 control list_controllers
```
You should get the response:
```
-joint_state_controller[joint_state_controller/JointStateController] active
+joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster] active
```
Now you should also see the *RRbot* represented correctly in `RViz`.
@@ -580,7 +596,7 @@ Now you should also see the *RRbot* represented correctly in `RViz`.
```
You should get `active` in the response:
```
- joint_state_controller[joint_state_controller/JointStateController] active
+ joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster] active
forward_position_controller[forward_command_controller/ForwardCommandController] active
```
@@ -623,13 +639,13 @@ Now you should also see the *RRbot* represented correctly in `RViz`.
```
You should get `active` in the response:
```
- joint_state_controller[joint_state_controller/JointStateController] active
+ joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster] active
position_trajectory_controller[joint_trajectory_controller/JointTrajectoryController] active
```
-3. Send a command to the controller using demo node which sends two goals every 5 seconds in a loop:
+3. Send a command to the controller using demo node which sends four goals every 6 seconds in a loop:
```
- ros2 launch ros2_control_demo_bringup test_forward_position_controller.launch.py
+ ros2 launch ros2_control_demo_bringup test_joint_trajectory_controller.launch.py
```
You can adjust the goals in [rrbot_joint_trajectory_publisher.yaml](ros2_control_demo_bringup/config/rrbot_joint_trajectory_publisher.yaml).
@@ -683,7 +699,7 @@ ros2 launch ros2_control_demo_bringup test_forward_position_controller.launch.py
Switch controller to use `position_trajectory_controller` (`JointTrajectoryController`):
```
-ros2 control switch_controllers -c /rrbot/controller_manager --stop forward_position_controller --start position_trajectory_controller
+ros2 control switch_controllers -c /rrbot/controller_manager --deactivate forward_position_controller --activate position_trajectory_controller
```
Commanding the robot using `JointTrajectoryController` (name: `/rrbot/position_trajectory_controller`)
@@ -734,8 +750,8 @@ ros2 launch ros2_control_demo_bringup test_multi_controller_manager_forward_posi
Switch controller to use `position_trajectory_controller`s (`JointTrajectoryController`) - alternatively start main launch file with argument `robot_controller:=position_trajectory_controller`:
```
-ros2 control switch_controllers -c /rrbot_1/controller_manager --stop forward_position_controller --start position_trajectory_controller
-ros2 control switch_controllers -c /rrbot_2/controller_manager --stop forward_position_controller --start position_trajectory_controller
+ros2 control switch_controllers -c /rrbot_1/controller_manager --deactivate forward_position_controller --activate position_trajectory_controller
+ros2 control switch_controllers -c /rrbot_2/controller_manager --deactivate forward_position_controller --activate position_trajectory_controller
```
Commanding the robot using `JointTrajectoryController` (`position_trajectory_controller`):
diff --git a/ros2_control_demo_bringup/config/multi_controller_manager_forward_position_publisher.yaml b/ros2_control_demo_bringup/config/multi_controller_manager_forward_position_publisher.yaml
index 2e853b690..0a3afff56 100644
--- a/ros2_control_demo_bringup/config/multi_controller_manager_forward_position_publisher.yaml
+++ b/ros2_control_demo_bringup/config/multi_controller_manager_forward_position_publisher.yaml
@@ -1,7 +1,8 @@
/rrbot_1/publisher_forward_position_controller:
ros__parameters:
- controller_name: "rrbot_1/forward_position_controller"
+
+ publish_topic: "forward_position_controller/commands"
wait_sec_between_publish: 5
goal_names: ["pos1", "pos2", "pos3", "pos4"]
@@ -14,7 +15,7 @@
/rrbot_2/publisher_forward_position_controller:
ros__parameters:
- controller_name: "rrbot_2/forward_position_controller"
+ publish_topic: "forward_position_controller/commands"
wait_sec_between_publish: 5
goal_names: ["pos1", "pos2", "pos3", "pos4"]
diff --git a/ros2_control_demo_bringup/config/multi_controller_manager_joint_trajectory_publisher.yaml b/ros2_control_demo_bringup/config/multi_controller_manager_joint_trajectory_publisher.yaml
index 34d13ccfd..3792fa61e 100644
--- a/ros2_control_demo_bringup/config/multi_controller_manager_joint_trajectory_publisher.yaml
+++ b/ros2_control_demo_bringup/config/multi_controller_manager_joint_trajectory_publisher.yaml
@@ -5,10 +5,14 @@
wait_sec_between_publish: 6
goal_names: ["pos1", "pos2", "pos3", "pos4"]
- pos1: [0.785, 0.785]
- pos2: [0.0, 0.0]
- pos3: [-0.785, -0.785]
- pos4: [0.0, 0.0]
+ pos1:
+ positions: [0.785, 0.785]
+ pos2:
+ positions: [0.0, 0.0]
+ pos3:
+ positions: [-0.785, -0.785]
+ pos4:
+ positions: [0.0, 0.0]
joints:
- rrbot_1_joint1
@@ -27,10 +31,14 @@
wait_sec_between_publish: 6
goal_names: ["pos1", "pos2", "pos3", "pos4"]
- pos1: [-0.785, 0.0]
- pos2: [0.0, -0.785]
- pos3: [+0.785, -1.57]
- pos4: [+1.57, -0.785]
+ pos1:
+ positions: [-0.785, 0.0]
+ pos2:
+ positions: [0.0, -0.785]
+ pos3:
+ positions: [+0.785, -1.57]
+ pos4:
+ positions: [+1.57, -0.785]
joints:
- rrbot_2_joint1
diff --git a/ros2_control_demo_bringup/config/rrbot_namespace_forward_position_publisher.yaml b/ros2_control_demo_bringup/config/rrbot_namespace_forward_position_publisher.yaml
index 88b2f573d..c022d0873 100644
--- a/ros2_control_demo_bringup/config/rrbot_namespace_forward_position_publisher.yaml
+++ b/ros2_control_demo_bringup/config/rrbot_namespace_forward_position_publisher.yaml
@@ -1,9 +1,10 @@
publisher_forward_position_controller:
ros__parameters:
- controller_name: "rrbot/forward_position_controller"
wait_sec_between_publish: 5
+ publish_topic: /rrbot/forward_position_controller/commands
+
goal_names: ["pos1", "pos2", "pos3", "pos4"]
pos1: [0.785, 0.785]
pos2: [0, 0]
diff --git a/ros2_control_demo_bringup/config/rrbot_namespace_joint_trajectory_publisher.yaml b/ros2_control_demo_bringup/config/rrbot_namespace_joint_trajectory_publisher.yaml
index 6a85e4a10..8b357deec 100644
--- a/ros2_control_demo_bringup/config/rrbot_namespace_joint_trajectory_publisher.yaml
+++ b/ros2_control_demo_bringup/config/rrbot_namespace_joint_trajectory_publisher.yaml
@@ -5,10 +5,14 @@ publisher_joint_trajectory_controller:
wait_sec_between_publish: 6
goal_names: ["pos1", "pos2", "pos3", "pos4"]
- pos1: [0.785, 0.785]
- pos2: [0, 0]
- pos3: [-0.785, -0.785]
- pos4: [0, 0]
+ pos1:
+ positions: [0.785, 0.785]
+ pos2:
+ positions: [0.0, 0.0]
+ pos3:
+ positions: [-0.785, -0.785]
+ pos4:
+ positions: [0.0, 0.0]
joints:
- joint1
diff --git a/ros2_control_demo_bringup/launch/diffbot.launch.py b/ros2_control_demo_bringup/launch/diffbot.launch.py
index 7dbdf8b90..cef13b492 100644
--- a/ros2_control_demo_bringup/launch/diffbot.launch.py
+++ b/ros2_control_demo_bringup/launch/diffbot.launch.py
@@ -49,10 +49,7 @@ def generate_launch_description():
package="controller_manager",
executable="ros2_control_node",
parameters=[robot_description, robot_controllers],
- output={
- "stdout": "screen",
- "stderr": "screen",
- },
+ output="both",
)
robot_state_pub_node = Node(
package="robot_state_publisher",
diff --git a/ros2_control_demo_bringup/launch/multi_controller_manager_example_two_rrbots.launch.py b/ros2_control_demo_bringup/launch/multi_controller_manager_example_two_rrbots.launch.py
index 8f1affb5f..8a48ec3a6 100644
--- a/ros2_control_demo_bringup/launch/multi_controller_manager_example_two_rrbots.launch.py
+++ b/ros2_control_demo_bringup/launch/multi_controller_manager_example_two_rrbots.launch.py
@@ -81,7 +81,7 @@ def generate_launch_description():
"position_trajectory_controller",
"-c",
"/rrbot_1/controller_manager",
- "--stopped",
+ "--inactive",
],
)
@@ -108,7 +108,7 @@ def generate_launch_description():
"position_trajectory_controller",
"-c",
"/rrbot_2/controller_manager",
- "--stopped",
+ "--inactive",
],
)
diff --git a/ros2_control_demo_bringup/launch/rrbot.launch.py b/ros2_control_demo_bringup/launch/rrbot.launch.py
index 8a7773d09..3ce2b90d8 100644
--- a/ros2_control_demo_bringup/launch/rrbot.launch.py
+++ b/ros2_control_demo_bringup/launch/rrbot.launch.py
@@ -60,10 +60,7 @@ def generate_launch_description():
"/position_commands",
),
],
- output={
- "stdout": "screen",
- "stderr": "screen",
- },
+ output="both",
)
robot_state_pub_node = Node(
package="robot_state_publisher",
diff --git a/ros2_control_demo_bringup/launch/rrbot_base.launch.py b/ros2_control_demo_bringup/launch/rrbot_base.launch.py
index c93cdd11c..4d182701e 100644
--- a/ros2_control_demo_bringup/launch/rrbot_base.launch.py
+++ b/ros2_control_demo_bringup/launch/rrbot_base.launch.py
@@ -73,7 +73,7 @@ def generate_launch_description():
)
declared_arguments.append(
DeclareLaunchArgument(
- "use_sim",
+ "use_gazebo",
default_value="false",
description="Start robot in Gazebo simulation.",
)
@@ -87,7 +87,7 @@ def generate_launch_description():
)
declared_arguments.append(
DeclareLaunchArgument(
- "fake_sensor_commands",
+ "mock_sensor_commands",
default_value="false",
description="Enable fake command interfaces for sensors used for simple simulations. \
Used only if 'use_fake_hardware' parameter is true.",
@@ -128,9 +128,9 @@ def generate_launch_description():
description_package = LaunchConfiguration("description_package")
description_file = LaunchConfiguration("description_file")
prefix = LaunchConfiguration("prefix")
- use_sim = LaunchConfiguration("use_sim")
+ use_gazebo = LaunchConfiguration("use_gazebo")
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
- fake_sensor_commands = LaunchConfiguration("fake_sensor_commands")
+ mock_sensor_commands = LaunchConfiguration("mock_sensor_commands")
slowdown = LaunchConfiguration("slowdown")
controller_manager_name = LaunchConfiguration("controller_manager_name")
robot_controller = LaunchConfiguration("robot_controller")
@@ -148,14 +148,14 @@ def generate_launch_description():
"prefix:=",
prefix,
" ",
- "use_sim:=",
- use_sim,
+ "use_gazebo:=",
+ use_gazebo,
" ",
"use_fake_hardware:=",
use_fake_hardware,
" ",
- "fake_sensor_commands:=",
- fake_sensor_commands,
+ "mock_sensor_commands:=",
+ mock_sensor_commands,
" ",
"slowdown:=",
slowdown,
@@ -179,10 +179,7 @@ def generate_launch_description():
executable="ros2_control_node",
namespace=namespace,
parameters=[robot_description, robot_controllers],
- output={
- "stdout": "screen",
- "stderr": "screen",
- },
+ output="both",
)
robot_state_pub_node = Node(
package="robot_state_publisher",
diff --git a/ros2_control_demo_bringup/launch/rrbot_namespace.launch.py b/ros2_control_demo_bringup/launch/rrbot_namespace.launch.py
index b8716a6ae..91c4dad89 100644
--- a/ros2_control_demo_bringup/launch/rrbot_namespace.launch.py
+++ b/ros2_control_demo_bringup/launch/rrbot_namespace.launch.py
@@ -100,7 +100,7 @@ def generate_launch_description():
"position_trajectory_controller",
"-c",
"/rrbot/controller_manager",
- "--stopped",
+ "--inactive",
],
)
diff --git a/ros2_control_demo_bringup/launch/rrbot_system_multi_interface.launch.py b/ros2_control_demo_bringup/launch/rrbot_system_multi_interface.launch.py
index 3dd4834d5..2f132402d 100644
--- a/ros2_control_demo_bringup/launch/rrbot_system_multi_interface.launch.py
+++ b/ros2_control_demo_bringup/launch/rrbot_system_multi_interface.launch.py
@@ -55,7 +55,7 @@ def generate_launch_description():
"description_file": "rrbot_system_multi_interface.urdf.xacro",
"prefix": prefix,
"use_fake_hardware": "false",
- "fake_sensor_commands": "false",
+ "mock_sensor_commands": "false",
"slowdown": slowdown,
"robot_controller": robot_controller,
}.items(),
diff --git a/ros2_control_demo_bringup/launch/rrbot_system_position_only.launch.py b/ros2_control_demo_bringup/launch/rrbot_system_position_only.launch.py
index fc579b9d1..bbd15d7aa 100644
--- a/ros2_control_demo_bringup/launch/rrbot_system_position_only.launch.py
+++ b/ros2_control_demo_bringup/launch/rrbot_system_position_only.launch.py
@@ -39,7 +39,7 @@ def generate_launch_description():
)
declared_arguments.append(
DeclareLaunchArgument(
- "fake_sensor_commands",
+ "mock_sensor_commands",
default_value="false",
description="Enable fake command interfaces for sensors used for simple simulations. \
Used only if 'use_fake_hardware' parameter is true.",
@@ -68,7 +68,7 @@ def generate_launch_description():
# Initialize Arguments
prefix = LaunchConfiguration("prefix")
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
- fake_sensor_commands = LaunchConfiguration("fake_sensor_commands")
+ mock_sensor_commands = LaunchConfiguration("mock_sensor_commands")
slowdown = LaunchConfiguration("slowdown")
robot_controller = LaunchConfiguration("robot_controller")
start_rviz = LaunchConfiguration("start_rviz")
@@ -79,7 +79,7 @@ def generate_launch_description():
"description_file": "rrbot_system_position_only.urdf.xacro",
"prefix": prefix,
"use_fake_hardware": use_fake_hardware,
- "fake_sensor_commands": fake_sensor_commands,
+ "mock_sensor_commands": mock_sensor_commands,
"slowdown": slowdown,
"robot_controller": robot_controller,
"start_rviz": start_rviz,
diff --git a/ros2_control_demo_bringup/launch/rrbot_system_position_only_gazebo.launch.py b/ros2_control_demo_bringup/launch/rrbot_system_position_only_gazebo.launch.py
index 7630a00d9..4436958c7 100644
--- a/ros2_control_demo_bringup/launch/rrbot_system_position_only_gazebo.launch.py
+++ b/ros2_control_demo_bringup/launch/rrbot_system_position_only_gazebo.launch.py
@@ -41,7 +41,7 @@ def generate_launch_description():
"rrbot_system_position_only.urdf.xacro",
]
),
- " use_sim:=true",
+ " use_gazebo:=true",
]
)
robot_description = {"robot_description": robot_description_content}
diff --git a/ros2_control_demo_bringup/launch/rrbot_system_with_external_sensor.launch.py b/ros2_control_demo_bringup/launch/rrbot_system_with_external_sensor.launch.py
index 9c482c75e..2487b98f7 100755
--- a/ros2_control_demo_bringup/launch/rrbot_system_with_external_sensor.launch.py
+++ b/ros2_control_demo_bringup/launch/rrbot_system_with_external_sensor.launch.py
@@ -42,7 +42,7 @@ def generate_launch_description():
)
declared_arguments.append(
DeclareLaunchArgument(
- "fake_sensor_commands",
+ "mock_sensor_commands",
default_value="false",
description="Enable fake command interfaces for sensors used for simple simulations. \
Used only if 'use_fake_hardware' parameter is true.",
@@ -60,7 +60,7 @@ def generate_launch_description():
# Initialize Arguments
prefix = LaunchConfiguration("prefix")
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
- fake_sensor_commands = LaunchConfiguration("fake_sensor_commands")
+ mock_sensor_commands = LaunchConfiguration("mock_sensor_commands")
slowdown = LaunchConfiguration("slowdown")
base_launch = IncludeLaunchDescription(
@@ -70,7 +70,7 @@ def generate_launch_description():
"description_file": "rrbot_system_with_external_sensor.urdf.xacro",
"prefix": prefix,
"use_fake_hardware": use_fake_hardware,
- "fake_sensor_commands": fake_sensor_commands,
+ "mock_sensor_commands": mock_sensor_commands,
"slowdown": slowdown,
}.items(),
)
diff --git a/ros2_control_demo_bringup/launch/rrbot_system_with_sensor.launch.py b/ros2_control_demo_bringup/launch/rrbot_system_with_sensor.launch.py
index 6c30f641f..7503cfb89 100755
--- a/ros2_control_demo_bringup/launch/rrbot_system_with_sensor.launch.py
+++ b/ros2_control_demo_bringup/launch/rrbot_system_with_sensor.launch.py
@@ -42,7 +42,7 @@ def generate_launch_description():
)
declared_arguments.append(
DeclareLaunchArgument(
- "fake_sensor_commands",
+ "mock_sensor_commands",
default_value="false",
description="Enable fake command interfaces for sensors used for simple simulations. \
Used only if 'use_fake_hardware' parameter is true.",
@@ -59,7 +59,7 @@ def generate_launch_description():
# Initialize Arguments
prefix = LaunchConfiguration("prefix")
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
- fake_sensor_commands = LaunchConfiguration("fake_sensor_commands")
+ mock_sensor_commands = LaunchConfiguration("mock_sensor_commands")
slowdown = LaunchConfiguration("slowdown")
base_launch = IncludeLaunchDescription(
@@ -69,7 +69,7 @@ def generate_launch_description():
"description_file": "rrbot_system_with_sensor.urdf.xacro",
"prefix": prefix,
"use_fake_hardware": use_fake_hardware,
- "fake_sensor_commands": fake_sensor_commands,
+ "mock_sensor_commands": mock_sensor_commands,
"slowdown": slowdown,
}.items(),
)
diff --git a/ros2_control_demo_bringup/launch/test_forward_position_controller.launch.py b/ros2_control_demo_bringup/launch/test_forward_position_controller.launch.py
index e35685db7..03b9d5d79 100644
--- a/ros2_control_demo_bringup/launch/test_forward_position_controller.launch.py
+++ b/ros2_control_demo_bringup/launch/test_forward_position_controller.launch.py
@@ -46,14 +46,11 @@ def generate_launch_description():
return LaunchDescription(
[
Node(
- package="ros2_control_test_nodes",
+ package="ros2_controllers_test_nodes",
executable="publisher_forward_position_controller",
name="publisher_forward_position_controller",
parameters=[position_goals],
- output={
- "stdout": "screen",
- "stderr": "screen",
- },
+ output="both",
)
]
)
diff --git a/ros2_control_demo_bringup/launch/test_joint_trajectory_controller.launch.py b/ros2_control_demo_bringup/launch/test_joint_trajectory_controller.launch.py
index f8752b6c3..cddcbcb59 100644
--- a/ros2_control_demo_bringup/launch/test_joint_trajectory_controller.launch.py
+++ b/ros2_control_demo_bringup/launch/test_joint_trajectory_controller.launch.py
@@ -46,14 +46,11 @@ def generate_launch_description():
return LaunchDescription(
[
Node(
- package="ros2_control_test_nodes",
+ package="ros2_controllers_test_nodes",
executable="publisher_joint_trajectory_controller",
name="publisher_joint_trajectory_controller",
parameters=[position_goals],
- output={
- "stdout": "screen",
- "stderr": "screen",
- },
+ output="both",
)
]
)
diff --git a/ros2_control_demo_description/diffbot_description/ros2_control/diffbot_system.ros2_control.xacro b/ros2_control_demo_description/diffbot_description/ros2_control/diffbot_system.ros2_control.xacro
index 8473503a4..e071a2035 100644
--- a/ros2_control_demo_description/diffbot_description/ros2_control/diffbot_system.ros2_control.xacro
+++ b/ros2_control_demo_description/diffbot_description/ros2_control/diffbot_system.ros2_control.xacro
@@ -1,13 +1,13 @@
-
+
- fake_components/GenericSystem
- ${fake_sensor_commands}
+ mock_components/GenericSystem
+ ${mock_sensor_commands}
0.0
diff --git a/ros2_control_demo_description/diffbot_description/urdf/diffbot_system.urdf.xacro b/ros2_control_demo_description/diffbot_description/urdf/diffbot_system.urdf.xacro
index 30fc1b632..eb00ec4d0 100644
--- a/ros2_control_demo_description/diffbot_description/urdf/diffbot_system.urdf.xacro
+++ b/ros2_control_demo_description/diffbot_description/urdf/diffbot_system.urdf.xacro
@@ -5,11 +5,11 @@ Copied and modified from ROS1 example -
https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/diffbot_description/urdf/diffbot.xacro
-->
-
+
-
+
@@ -30,6 +30,6 @@ https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/diffbot_de
+ mock_sensor_commands="$(arg mock_sensor_commands)"/>
diff --git a/ros2_control_demo_description/rrbot_description/ros2_control/external_rrbot_force_torque_sensor.ros2_control.xacro b/ros2_control_demo_description/rrbot_description/ros2_control/external_rrbot_force_torque_sensor.ros2_control.xacro
index 53d4059c2..ce91bbfe1 100644
--- a/ros2_control_demo_description/rrbot_description/ros2_control/external_rrbot_force_torque_sensor.ros2_control.xacro
+++ b/ros2_control_demo_description/rrbot_description/ros2_control/external_rrbot_force_torque_sensor.ros2_control.xacro
@@ -1,13 +1,13 @@
-
+
- fake_components/GenericSystem
- ${fake_sensor_commands}
+ mock_components/GenericSystem
+ ${mock_sensor_commands}
0.0
diff --git a/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_modular_actuators.ros2_control.xacro b/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_modular_actuators.ros2_control.xacro
index 40c7f6a94..cac323371 100644
--- a/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_modular_actuators.ros2_control.xacro
+++ b/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_modular_actuators.ros2_control.xacro
@@ -1,7 +1,7 @@
-
+
diff --git a/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_multi_interface.ros2_control.xacro b/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_multi_interface.ros2_control.xacro
index d3e73a64d..89caa06be 100644
--- a/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_multi_interface.ros2_control.xacro
+++ b/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_multi_interface.ros2_control.xacro
@@ -1,20 +1,20 @@
-
+
-
+
gazebo_ros2_control/GazeboSystem
-
+
- fake_components/GenericSystem
- ${fake_sensor_commands}
+ mock_components/GenericSystem
+ ${mock_sensor_commands}
0.0
diff --git a/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_position_only.ros2_control.xacro b/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_position_only.ros2_control.xacro
index e6c078868..9aaaa7393 100644
--- a/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_position_only.ros2_control.xacro
+++ b/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_position_only.ros2_control.xacro
@@ -1,20 +1,20 @@
-
+
-
+
gazebo_ros2_control/GazeboSystem
-
+
- fake_components/GenericSystem
- ${fake_sensor_commands}
+ mock_components/GenericSystem
+ ${mock_sensor_commands}
0.0
diff --git a/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_with_sensor.ros2_control.xacro b/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_with_sensor.ros2_control.xacro
index e8f713ed7..ba803fd91 100644
--- a/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_with_sensor.ros2_control.xacro
+++ b/ros2_control_demo_description/rrbot_description/ros2_control/rrbot_system_with_sensor.ros2_control.xacro
@@ -1,14 +1,14 @@
-
+
- fake_components/GenericSystem
- ${fake_sensor_commands}
+ mock_components/GenericSystem
+ ${mock_sensor_commands}
0.0
diff --git a/ros2_control_demo_description/rrbot_description/urdf/rrbot_modular_actuators.urdf.xacro b/ros2_control_demo_description/rrbot_description/urdf/rrbot_modular_actuators.urdf.xacro
index 5c3f11689..9f5f10fec 100644
--- a/ros2_control_demo_description/rrbot_description/urdf/rrbot_modular_actuators.urdf.xacro
+++ b/ros2_control_demo_description/rrbot_description/urdf/rrbot_modular_actuators.urdf.xacro
@@ -5,7 +5,7 @@ Copied and modified from ROS1 example -
https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_description/urdf/rrbot.xacro
-->
-
+
diff --git a/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_multi_interface.urdf.xacro b/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_multi_interface.urdf.xacro
index 0b145c08b..497932749 100644
--- a/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_multi_interface.urdf.xacro
+++ b/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_multi_interface.urdf.xacro
@@ -5,11 +5,11 @@ Copied and modified from ROS1 example -
https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_description/urdf/rrbot.xacro
-->
-
+
-
+
@@ -40,7 +40,7 @@ https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_desc
diff --git a/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_position_only.urdf.xacro b/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_position_only.urdf.xacro
index d2b9bd7dc..31009339f 100644
--- a/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_position_only.urdf.xacro
+++ b/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_position_only.urdf.xacro
@@ -5,11 +5,11 @@ Copied and modified from ROS1 example -
https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_description/urdf/rrbot.xacro
-->
-
+
-
+
@@ -40,7 +40,7 @@ https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_desc
diff --git a/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_with_external_sensor.urdf.xacro b/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_with_external_sensor.urdf.xacro
index 642a0f62c..4b92541de 100644
--- a/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_with_external_sensor.urdf.xacro
+++ b/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_with_external_sensor.urdf.xacro
@@ -5,11 +5,11 @@ Copied and modified from ROS1 example -
https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_description/urdf/rrbot.xacro
-->
-
+
-
+
@@ -38,11 +38,11 @@ https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_desc
+ mock_sensor_commands="$(arg mock_sensor_commands)" />
diff --git a/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_with_sensor.urdf.xacro b/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_with_sensor.urdf.xacro
index f95324303..d820e2521 100644
--- a/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_with_sensor.urdf.xacro
+++ b/ros2_control_demo_description/rrbot_description/urdf/rrbot_system_with_sensor.urdf.xacro
@@ -5,11 +5,11 @@ Copied and modified from ROS1 example -
https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_description/urdf/rrbot.xacro
-->
-
+
-
+
@@ -35,7 +35,7 @@ https://github.com/ros-simulation/gazebo_ros_demos/blob/kinetic-devel/rrbot_desc
diff --git a/ros2_control_demo_hardware/CMakeLists.txt b/ros2_control_demo_hardware/CMakeLists.txt
index cb68dd708..e27bb5658 100644
--- a/ros2_control_demo_hardware/CMakeLists.txt
+++ b/ros2_control_demo_hardware/CMakeLists.txt
@@ -44,9 +44,9 @@ ament_target_dependencies(
# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
-target_compile_definitions(${PROJECT_NAME} PRIVATE "JOINT_STATE_BROADCASTER_BUILDING_DLL")
-# prevent pluginlib from using boost
-target_compile_definitions(${PROJECT_NAME} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")
+target_compile_definitions(${PROJECT_NAME} PRIVATE "ROS2_CONTROL_DEMO_HARDWARE_BUILDING_DLL")
+
+# Export hardware pligins
pluginlib_export_plugin_description_file(hardware_interface ros2_control_demo_hardware.xml)
# INSTALL
diff --git a/ros2_control_demo_hardware/include/ros2_control_demo_hardware/diffbot_system.hpp b/ros2_control_demo_hardware/include/ros2_control_demo_hardware/diffbot_system.hpp
index 6d372438c..1becc4dd6 100644
--- a/ros2_control_demo_hardware/include/ros2_control_demo_hardware/diffbot_system.hpp
+++ b/ros2_control_demo_hardware/include/ros2_control_demo_hardware/diffbot_system.hpp
@@ -33,15 +33,14 @@
namespace ros2_control_demo_hardware
{
-using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
-
class DiffBotSystemHardware : public hardware_interface::SystemInterface
{
public:
RCLCPP_SHARED_PTR_DEFINITIONS(DiffBotSystemHardware);
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_init(const hardware_interface::HardwareInfo & info) override;
+ hardware_interface::CallbackReturn on_init(
+ const hardware_interface::HardwareInfo & info) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
std::vector export_state_interfaces() override;
@@ -50,16 +49,20 @@ class DiffBotSystemHardware : public hardware_interface::SystemInterface
std::vector export_command_interfaces() override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_activate(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_deactivate(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- hardware_interface::return_type read() override;
+ hardware_interface::return_type read(
+ const rclcpp::Time & time, const rclcpp::Duration & period) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- hardware_interface::return_type write() override;
+ hardware_interface::return_type write(
+ const rclcpp::Time & time, const rclcpp::Duration & period) override;
private:
// Parameters for the DiffBot simulation
@@ -71,11 +74,6 @@ class DiffBotSystemHardware : public hardware_interface::SystemInterface
std::vector hw_positions_;
std::vector hw_velocities_;
- // Store time between update loops
- rclcpp::Clock clock_;
- rclcpp::Time last_timestamp_;
- rclcpp::Time current_timestamp; // Avoid initialization on each read
-
// Store the wheeled robot position
double base_x_, base_y_, base_theta_;
};
diff --git a/ros2_control_demo_hardware/include/ros2_control_demo_hardware/external_rrbot_force_torque_sensor.hpp b/ros2_control_demo_hardware/include/ros2_control_demo_hardware/external_rrbot_force_torque_sensor.hpp
index 0ba4f1051..ce3b6e6e5 100644
--- a/ros2_control_demo_hardware/include/ros2_control_demo_hardware/external_rrbot_force_torque_sensor.hpp
+++ b/ros2_control_demo_hardware/include/ros2_control_demo_hardware/external_rrbot_force_torque_sensor.hpp
@@ -32,27 +32,29 @@
namespace ros2_control_demo_hardware
{
-using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
-
class ExternalRRBotForceTorqueSensorHardware : public hardware_interface::SensorInterface
{
public:
RCLCPP_SHARED_PTR_DEFINITIONS(ExternalRRBotForceTorqueSensorHardware);
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_init(const hardware_interface::HardwareInfo & info) override;
+ hardware_interface::CallbackReturn on_init(
+ const hardware_interface::HardwareInfo & info) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
std::vector export_state_interfaces() override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_activate(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_deactivate(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- hardware_interface::return_type read() override;
+ hardware_interface::return_type read(
+ const rclcpp::Time & time, const rclcpp::Duration & period) override;
private:
// Parameters for the RRBot simulation
diff --git a/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_actuator.hpp b/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_actuator.hpp
index 6eb4a4f96..be9d9414b 100644
--- a/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_actuator.hpp
+++ b/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_actuator.hpp
@@ -33,15 +33,14 @@
namespace ros2_control_demo_hardware
{
-using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
-
class RRBotModularJoint : public hardware_interface::ActuatorInterface
{
public:
RCLCPP_SHARED_PTR_DEFINITIONS(RRBotModularJoint);
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_init(const hardware_interface::HardwareInfo & info) override;
+ hardware_interface::CallbackReturn on_init(
+ const hardware_interface::HardwareInfo & info) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
std::vector export_state_interfaces() override;
@@ -50,16 +49,20 @@ class RRBotModularJoint : public hardware_interface::ActuatorInterface
std::vector export_command_interfaces() override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_activate(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_deactivate(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- hardware_interface::return_type read() override;
+ hardware_interface::return_type read(
+ const rclcpp::Time & time, const rclcpp::Duration & period) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- hardware_interface::return_type write() override;
+ hardware_interface::return_type write(
+ const rclcpp::Time & time, const rclcpp::Duration & period) override;
private:
// Parameters for the RRBot simulation
diff --git a/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_system_multi_interface.hpp b/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_system_multi_interface.hpp
index fc57939c9..0607611e5 100644
--- a/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_system_multi_interface.hpp
+++ b/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_system_multi_interface.hpp
@@ -35,15 +35,14 @@
namespace ros2_control_demo_hardware
{
-using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
-
class RRBotSystemMultiInterfaceHardware : public hardware_interface::SystemInterface
{
public:
RCLCPP_SHARED_PTR_DEFINITIONS(RRBotSystemMultiInterfaceHardware);
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_init(const hardware_interface::HardwareInfo & info) override;
+ hardware_interface::CallbackReturn on_init(
+ const hardware_interface::HardwareInfo & info) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
std::vector export_state_interfaces() override;
@@ -57,16 +56,20 @@ class RRBotSystemMultiInterfaceHardware : public hardware_interface::SystemInter
const std::vector & stop_interfaces) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_activate(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_deactivate(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- hardware_interface::return_type read() override;
+ hardware_interface::return_type read(
+ const rclcpp::Time & time, const rclcpp::Duration & period) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- hardware_interface::return_type write() override;
+ hardware_interface::return_type write(
+ const rclcpp::Time & time, const rclcpp::Duration & period) override;
private:
// Parameters for the RRBot simulation
@@ -82,11 +85,6 @@ class RRBotSystemMultiInterfaceHardware : public hardware_interface::SystemInter
std::vector hw_states_velocities_;
std::vector hw_states_accelerations_;
- // Store time between update loops
- rclcpp::Clock clock_;
- rclcpp::Time last_timestamp_;
- rclcpp::Time current_timestamp; // Avoid initialization on each read
-
// Enum defining at which control level we are
// Dumb way of maintaining the command_interface type per joint.
enum integration_level_t : std::uint8_t
diff --git a/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_system_position_only.hpp b/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_system_position_only.hpp
index 7dee1a62f..cdf22b62e 100644
--- a/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_system_position_only.hpp
+++ b/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_system_position_only.hpp
@@ -30,18 +30,18 @@
namespace ros2_control_demo_hardware
{
-using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
-
class RRBotSystemPositionOnlyHardware : public hardware_interface::SystemInterface
{
public:
RCLCPP_SHARED_PTR_DEFINITIONS(RRBotSystemPositionOnlyHardware);
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_init(const hardware_interface::HardwareInfo & info) override;
+ hardware_interface::CallbackReturn on_init(
+ const hardware_interface::HardwareInfo & info) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_configure(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_configure(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
std::vector export_state_interfaces() override;
@@ -50,16 +50,20 @@ class RRBotSystemPositionOnlyHardware : public hardware_interface::SystemInterfa
std::vector export_command_interfaces() override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_activate(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_deactivate(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- hardware_interface::return_type read() override;
+ hardware_interface::return_type read(
+ const rclcpp::Time & time, const rclcpp::Duration & period) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- hardware_interface::return_type write() override;
+ hardware_interface::return_type write(
+ const rclcpp::Time & time, const rclcpp::Duration & period) override;
private:
// Parameters for the RRBot simulation
diff --git a/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_system_with_sensor.hpp b/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_system_with_sensor.hpp
index e7168e561..2c3b2a3a6 100644
--- a/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_system_with_sensor.hpp
+++ b/ros2_control_demo_hardware/include/ros2_control_demo_hardware/rrbot_system_with_sensor.hpp
@@ -33,18 +33,18 @@
namespace ros2_control_demo_hardware
{
-using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
-
class RRBotSystemWithSensorHardware : public hardware_interface::SystemInterface
{
public:
RCLCPP_SHARED_PTR_DEFINITIONS(RRBotSystemWithSensorHardware);
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_init(const hardware_interface::HardwareInfo & info) override;
+ hardware_interface::CallbackReturn on_init(
+ const hardware_interface::HardwareInfo & info) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_configure(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_configure(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
std::vector export_state_interfaces() override;
@@ -53,16 +53,20 @@ class RRBotSystemWithSensorHardware : public hardware_interface::SystemInterface
std::vector export_command_interfaces() override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_activate(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
+ hardware_interface::CallbackReturn on_deactivate(
+ const rclcpp_lifecycle::State & previous_state) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- hardware_interface::return_type read() override;
+ hardware_interface::return_type read(
+ const rclcpp::Time & time, const rclcpp::Duration & period) override;
ROS2_CONTROL_DEMO_HARDWARE_PUBLIC
- hardware_interface::return_type write() override;
+ hardware_interface::return_type write(
+ const rclcpp::Time & time, const rclcpp::Duration & period) override;
private:
// Parameters for the RRBot simulation
diff --git a/ros2_control_demo_hardware/src/diffbot_system.cpp b/ros2_control_demo_hardware/src/diffbot_system.cpp
index d8415f4aa..b2792c94b 100644
--- a/ros2_control_demo_hardware/src/diffbot_system.cpp
+++ b/ros2_control_demo_hardware/src/diffbot_system.cpp
@@ -21,16 +21,18 @@
#include
#include "hardware_interface/types/hardware_interface_type_values.hpp"
-#include "rclcpp/clock.hpp"
#include "rclcpp/rclcpp.hpp"
namespace ros2_control_demo_hardware
{
-CallbackReturn DiffBotSystemHardware::on_init(const hardware_interface::HardwareInfo & info)
+hardware_interface::CallbackReturn DiffBotSystemHardware::on_init(
+ const hardware_interface::HardwareInfo & info)
{
- if (hardware_interface::SystemInterface::on_init(info) != CallbackReturn::SUCCESS)
+ if (
+ hardware_interface::SystemInterface::on_init(info) !=
+ hardware_interface::CallbackReturn::SUCCESS)
{
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
base_x_ = 0.0;
@@ -54,7 +56,7 @@ CallbackReturn DiffBotSystemHardware::on_init(const hardware_interface::Hardware
rclcpp::get_logger("DiffBotSystemHardware"),
"Joint '%s' has %zu command interfaces found. 1 expected.", joint.name.c_str(),
joint.command_interfaces.size());
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.command_interfaces[0].name != hardware_interface::HW_IF_VELOCITY)
@@ -63,7 +65,7 @@ CallbackReturn DiffBotSystemHardware::on_init(const hardware_interface::Hardware
rclcpp::get_logger("DiffBotSystemHardware"),
"Joint '%s' have %s command interfaces found. '%s' expected.", joint.name.c_str(),
joint.command_interfaces[0].name.c_str(), hardware_interface::HW_IF_VELOCITY);
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.state_interfaces.size() != 2)
@@ -72,7 +74,7 @@ CallbackReturn DiffBotSystemHardware::on_init(const hardware_interface::Hardware
rclcpp::get_logger("DiffBotSystemHardware"),
"Joint '%s' has %zu state interface. 2 expected.", joint.name.c_str(),
joint.state_interfaces.size());
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.state_interfaces[0].name != hardware_interface::HW_IF_POSITION)
@@ -81,7 +83,7 @@ CallbackReturn DiffBotSystemHardware::on_init(const hardware_interface::Hardware
rclcpp::get_logger("DiffBotSystemHardware"),
"Joint '%s' have '%s' as first state interface. '%s' expected.", joint.name.c_str(),
joint.state_interfaces[0].name.c_str(), hardware_interface::HW_IF_POSITION);
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.state_interfaces[1].name != hardware_interface::HW_IF_VELOCITY)
@@ -90,13 +92,11 @@ CallbackReturn DiffBotSystemHardware::on_init(const hardware_interface::Hardware
rclcpp::get_logger("DiffBotSystemHardware"),
"Joint '%s' have '%s' as second state interface. '%s' expected.", joint.name.c_str(),
joint.state_interfaces[1].name.c_str(), hardware_interface::HW_IF_VELOCITY);
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
}
- clock_ = rclcpp::Clock();
-
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
std::vector DiffBotSystemHardware::export_state_interfaces()
@@ -125,7 +125,7 @@ std::vector DiffBotSystemHardware::export_
return command_interfaces;
}
-CallbackReturn DiffBotSystemHardware::on_activate(
+hardware_interface::CallbackReturn DiffBotSystemHardware::on_activate(
const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -150,14 +150,12 @@ CallbackReturn DiffBotSystemHardware::on_activate(
}
}
- last_timestamp_ = clock_.now();
-
RCLCPP_INFO(rclcpp::get_logger("DiffBotSystemHardware"), "Successfully activated!");
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-CallbackReturn DiffBotSystemHardware::on_deactivate(
+hardware_interface::CallbackReturn DiffBotSystemHardware::on_deactivate(
const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -173,15 +171,12 @@ CallbackReturn DiffBotSystemHardware::on_deactivate(
RCLCPP_INFO(rclcpp::get_logger("DiffBotSystemHardware"), "Successfully deactivated!");
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-hardware_interface::return_type DiffBotSystemHardware::read()
+hardware_interface::return_type DiffBotSystemHardware::read(
+ const rclcpp::Time & /*time*/, const rclcpp::Duration & period)
{
- current_timestamp = clock_.now();
- rclcpp::Duration dt = current_timestamp - last_timestamp_; // Control period
- last_timestamp_ = current_timestamp;
-
double radius = 0.02; // radius of the wheels
double dist_w = 0.1; // distance between the wheels
for (uint i = 0; i < hw_commands_.size(); i++)
@@ -189,7 +184,7 @@ hardware_interface::return_type DiffBotSystemHardware::read()
// Simulate DiffBot wheels's movement as a first-order system
// Update the joint status: this is a revolute joint without any limit.
// Simply integrates
- hw_positions_[i] = hw_positions_[1] + dt.seconds() * hw_commands_[i];
+ hw_positions_[i] = hw_positions_[1] + period.seconds() * hw_commands_[i];
hw_velocities_[i] = hw_commands_[i];
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -205,9 +200,9 @@ hardware_interface::return_type DiffBotSystemHardware::read()
double base_dx = 0.5 * radius * (hw_commands_[0] + hw_commands_[1]) * cos(base_theta_);
double base_dy = 0.5 * radius * (hw_commands_[0] + hw_commands_[1]) * sin(base_theta_);
double base_dtheta = radius * (hw_commands_[0] - hw_commands_[1]) / dist_w;
- base_x_ += base_dx * dt.seconds();
- base_y_ += base_dy * dt.seconds();
- base_theta_ += base_dtheta * dt.seconds();
+ base_x_ += base_dx * period.seconds();
+ base_y_ += base_dy * period.seconds();
+ base_theta_ += base_dtheta * period.seconds();
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
RCLCPP_INFO(
@@ -218,7 +213,8 @@ hardware_interface::return_type DiffBotSystemHardware::read()
return hardware_interface::return_type::OK;
}
-hardware_interface::return_type ros2_control_demo_hardware::DiffBotSystemHardware::write()
+hardware_interface::return_type ros2_control_demo_hardware::DiffBotSystemHardware::write(
+ const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
RCLCPP_INFO(rclcpp::get_logger("DiffBotSystemHardware"), "Writing...");
diff --git a/ros2_control_demo_hardware/src/external_rrbot_force_torque_sensor.cpp b/ros2_control_demo_hardware/src/external_rrbot_force_torque_sensor.cpp
index 56c5d98f1..850b8bac0 100644
--- a/ros2_control_demo_hardware/src/external_rrbot_force_torque_sensor.cpp
+++ b/ros2_control_demo_hardware/src/external_rrbot_force_torque_sensor.cpp
@@ -29,12 +29,14 @@
namespace ros2_control_demo_hardware
{
-CallbackReturn ExternalRRBotForceTorqueSensorHardware::on_init(
+hardware_interface::CallbackReturn ExternalRRBotForceTorqueSensorHardware::on_init(
const hardware_interface::HardwareInfo & info)
{
- if (hardware_interface::SensorInterface::on_init(info) != CallbackReturn::SUCCESS)
+ if (
+ hardware_interface::SensorInterface::on_init(info) !=
+ hardware_interface::CallbackReturn::SUCCESS)
{
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -46,7 +48,7 @@ CallbackReturn ExternalRRBotForceTorqueSensorHardware::on_init(
hw_sensor_states_.resize(
info_.sensors[0].state_interfaces.size(), std::numeric_limits::quiet_NaN());
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
std::vector
@@ -64,7 +66,7 @@ ExternalRRBotForceTorqueSensorHardware::export_state_interfaces()
return state_interfaces;
}
-CallbackReturn ExternalRRBotForceTorqueSensorHardware::on_activate(
+hardware_interface::CallbackReturn ExternalRRBotForceTorqueSensorHardware::on_activate(
const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -83,10 +85,10 @@ CallbackReturn ExternalRRBotForceTorqueSensorHardware::on_activate(
rclcpp::get_logger("ExternalRRBotForceTorqueSensorHardware"), "Successfully activated!");
// END: This part here is for exemplary purposes - Please do not copy to your production code
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-CallbackReturn ExternalRRBotForceTorqueSensorHardware::on_deactivate(
+hardware_interface::CallbackReturn ExternalRRBotForceTorqueSensorHardware::on_deactivate(
const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -105,10 +107,11 @@ CallbackReturn ExternalRRBotForceTorqueSensorHardware::on_deactivate(
rclcpp::get_logger("ExternalRRBotForceTorqueSensorHardware"), "Successfully deactivated!");
// END: This part here is for exemplary purposes - Please do not copy to your production code
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-hardware_interface::return_type ExternalRRBotForceTorqueSensorHardware::read()
+hardware_interface::return_type ExternalRRBotForceTorqueSensorHardware::read(
+ const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
RCLCPP_INFO(rclcpp::get_logger("ExternalRRBotForceTorqueSensorHardware"), "Reading...");
diff --git a/ros2_control_demo_hardware/src/rrbot_actuator.cpp b/ros2_control_demo_hardware/src/rrbot_actuator.cpp
index 3a3e0b0df..1ef1f8e38 100644
--- a/ros2_control_demo_hardware/src/rrbot_actuator.cpp
+++ b/ros2_control_demo_hardware/src/rrbot_actuator.cpp
@@ -30,11 +30,14 @@
namespace ros2_control_demo_hardware
{
-CallbackReturn RRBotModularJoint::on_init(const hardware_interface::HardwareInfo & info)
+hardware_interface::CallbackReturn RRBotModularJoint::on_init(
+ const hardware_interface::HardwareInfo & info)
{
- if (hardware_interface::ActuatorInterface::on_init(info) != CallbackReturn::SUCCESS)
+ if (
+ hardware_interface::ActuatorInterface::on_init(info) !=
+ hardware_interface::CallbackReturn::SUCCESS)
{
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
hw_start_sec_ = stod(info_.hardware_parameters["example_param_hw_start_duration_sec"]);
@@ -53,7 +56,7 @@ CallbackReturn RRBotModularJoint::on_init(const hardware_interface::HardwareInfo
rclcpp::get_logger("RRBotModularJoint"),
"Joint '%s' has %zu command interfaces found. 1 expected.", joint.name.c_str(),
joint.command_interfaces.size());
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.command_interfaces[0].name != hardware_interface::HW_IF_POSITION)
@@ -62,7 +65,7 @@ CallbackReturn RRBotModularJoint::on_init(const hardware_interface::HardwareInfo
rclcpp::get_logger("RRBotModularJoint"),
"Joint '%s' have %s command interfaces found. '%s' expected.", joint.name.c_str(),
joint.command_interfaces[0].name.c_str(), hardware_interface::HW_IF_POSITION);
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.state_interfaces.size() != 1)
@@ -70,7 +73,7 @@ CallbackReturn RRBotModularJoint::on_init(const hardware_interface::HardwareInfo
RCLCPP_FATAL(
rclcpp::get_logger("RRBotModularJoint"), "Joint '%s' has %zu state interface. 1 expected.",
joint.name.c_str(), joint.state_interfaces.size());
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.state_interfaces[0].name != hardware_interface::HW_IF_POSITION)
@@ -79,10 +82,10 @@ CallbackReturn RRBotModularJoint::on_init(const hardware_interface::HardwareInfo
rclcpp::get_logger("RRBotModularJoint"), "Joint '%s' have %s state interface. '%s' expected.",
joint.name.c_str(), joint.state_interfaces[0].name.c_str(),
hardware_interface::HW_IF_POSITION);
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
std::vector RRBotModularJoint::export_state_interfaces()
@@ -105,7 +108,8 @@ std::vector RRBotModularJoint::export_comm
return command_interfaces;
}
-CallbackReturn RRBotModularJoint::on_activate(const rclcpp_lifecycle::State & /*previous_state*/)
+hardware_interface::CallbackReturn RRBotModularJoint::on_activate(
+ const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
RCLCPP_INFO(rclcpp::get_logger("RRBotModularJoint"), "Activating ...please wait...");
@@ -126,10 +130,11 @@ CallbackReturn RRBotModularJoint::on_activate(const rclcpp_lifecycle::State & /*
RCLCPP_INFO(rclcpp::get_logger("RRBotModularJoint"), "Successfully activated!");
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-CallbackReturn RRBotModularJoint::on_deactivate(const rclcpp_lifecycle::State & /*previous_state*/)
+hardware_interface::CallbackReturn RRBotModularJoint::on_deactivate(
+ const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
RCLCPP_INFO(rclcpp::get_logger("RRBotModularJoint"), "Deactivating ...please wait...");
@@ -143,10 +148,11 @@ CallbackReturn RRBotModularJoint::on_deactivate(const rclcpp_lifecycle::State &
RCLCPP_INFO(rclcpp::get_logger("RRBotModularJoint"), "Successfully deactivated!");
// END: This part here is for exemplary purposes - Please do not copy to your production code
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-hardware_interface::return_type RRBotModularJoint::read()
+hardware_interface::return_type RRBotModularJoint::read(
+ const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
RCLCPP_INFO(rclcpp::get_logger("RRBotModularJoint"), "Reading...");
@@ -163,7 +169,8 @@ hardware_interface::return_type RRBotModularJoint::read()
return hardware_interface::return_type::OK;
}
-hardware_interface::return_type ros2_control_demo_hardware::RRBotModularJoint::write()
+hardware_interface::return_type ros2_control_demo_hardware::RRBotModularJoint::write(
+ const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
RCLCPP_INFO(rclcpp::get_logger("RRBotModularJoint"), "Writing...please wait...");
diff --git a/ros2_control_demo_hardware/src/rrbot_system_multi_interface.cpp b/ros2_control_demo_hardware/src/rrbot_system_multi_interface.cpp
index 92760d369..2df73d8cf 100644
--- a/ros2_control_demo_hardware/src/rrbot_system_multi_interface.cpp
+++ b/ros2_control_demo_hardware/src/rrbot_system_multi_interface.cpp
@@ -22,17 +22,18 @@
#include
#include "hardware_interface/types/hardware_interface_type_values.hpp"
-#include "rclcpp/clock.hpp"
#include "rclcpp/rclcpp.hpp"
namespace ros2_control_demo_hardware
{
-CallbackReturn RRBotSystemMultiInterfaceHardware::on_init(
+hardware_interface::CallbackReturn RRBotSystemMultiInterfaceHardware::on_init(
const hardware_interface::HardwareInfo & info)
{
- if (hardware_interface::SystemInterface::on_init(info) != CallbackReturn::SUCCESS)
+ if (
+ hardware_interface::SystemInterface::on_init(info) !=
+ hardware_interface::CallbackReturn::SUCCESS)
{
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -58,7 +59,7 @@ CallbackReturn RRBotSystemMultiInterfaceHardware::on_init(
rclcpp::get_logger("RRBotSystemMultiInterfaceHardware"),
"Joint '%s' has %zu command interfaces. 3 expected.", joint.name.c_str(),
joint.command_interfaces.size());
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (!(joint.command_interfaces[0].name == hardware_interface::HW_IF_POSITION ||
@@ -70,7 +71,7 @@ CallbackReturn RRBotSystemMultiInterfaceHardware::on_init(
"Joint '%s' has %s command interface. Expected %s, %s, or %s.", joint.name.c_str(),
joint.command_interfaces[0].name.c_str(), hardware_interface::HW_IF_POSITION,
hardware_interface::HW_IF_VELOCITY, hardware_interface::HW_IF_ACCELERATION);
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.state_interfaces.size() != 3)
@@ -79,7 +80,7 @@ CallbackReturn RRBotSystemMultiInterfaceHardware::on_init(
rclcpp::get_logger("RRBotSystemMultiInterfaceHardware"),
"Joint '%s'has %zu state interfaces. 3 expected.", joint.name.c_str(),
joint.command_interfaces.size());
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (!(joint.state_interfaces[0].name == hardware_interface::HW_IF_POSITION ||
@@ -91,13 +92,11 @@ CallbackReturn RRBotSystemMultiInterfaceHardware::on_init(
"Joint '%s' has %s state interface. Expected %s, %s, or %s.", joint.name.c_str(),
joint.state_interfaces[0].name.c_str(), hardware_interface::HW_IF_POSITION,
hardware_interface::HW_IF_VELOCITY, hardware_interface::HW_IF_ACCELERATION);
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
}
- clock_ = rclcpp::Clock();
-
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
std::vector
@@ -165,9 +164,9 @@ hardware_interface::return_type RRBotSystemMultiInterfaceHardware::prepare_comma
return hardware_interface::return_type::ERROR;
}
// Example criteria: All joints must have the same command mode
- if (!std::all_of(new_modes.begin() + 1, new_modes.end(), [&](integration_level_t mode) {
- return mode == new_modes[0];
- }))
+ if (!std::all_of(
+ new_modes.begin() + 1, new_modes.end(),
+ [&](integration_level_t mode) { return mode == new_modes[0]; }))
{
return hardware_interface::return_type::ERROR;
}
@@ -198,7 +197,7 @@ hardware_interface::return_type RRBotSystemMultiInterfaceHardware::prepare_comma
return hardware_interface::return_type::OK;
}
-CallbackReturn RRBotSystemMultiInterfaceHardware::on_activate(
+hardware_interface::CallbackReturn RRBotSystemMultiInterfaceHardware::on_activate(
const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -244,15 +243,13 @@ CallbackReturn RRBotSystemMultiInterfaceHardware::on_activate(
control_level_[i] = integration_level_t::UNDEFINED;
}
- last_timestamp_ = clock_.now();
-
RCLCPP_INFO(
rclcpp::get_logger("RRBotSystemMultiInterfaceHardware"), "System successfully activated! %u",
control_level_[0]);
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-CallbackReturn RRBotSystemMultiInterfaceHardware::on_deactivate(
+hardware_interface::CallbackReturn RRBotSystemMultiInterfaceHardware::on_deactivate(
const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -270,15 +267,12 @@ CallbackReturn RRBotSystemMultiInterfaceHardware::on_deactivate(
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemMultiInterfaceHardware"), "Successfully deactivated!");
// END: This part here is for exemplary purposes - Please do not copy to your production code
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-hardware_interface::return_type RRBotSystemMultiInterfaceHardware::read()
+hardware_interface::return_type RRBotSystemMultiInterfaceHardware::read(
+ const rclcpp::Time & /*time*/, const rclcpp::Duration & period)
{
- current_timestamp = clock_.now();
- rclcpp::Duration dt = current_timestamp - last_timestamp_;
- last_timestamp_ = current_timestamp;
-
for (std::size_t i = 0; i < hw_states_positions_.size(); i++)
{
switch (control_level_[i])
@@ -298,12 +292,12 @@ hardware_interface::return_type RRBotSystemMultiInterfaceHardware::read()
case integration_level_t::VELOCITY:
hw_states_accelerations_[i] = 0;
hw_states_velocities_[i] = hw_commands_velocities_[i];
- hw_states_positions_[i] += (hw_states_velocities_[i] * dt.seconds()) / hw_slowdown_;
+ hw_states_positions_[i] += (hw_states_velocities_[i] * period.seconds()) / hw_slowdown_;
break;
case integration_level_t::ACCELERATION:
hw_states_accelerations_[i] = hw_commands_accelerations_[i];
- hw_states_velocities_[i] += (hw_states_accelerations_[i] * dt.seconds()) / hw_slowdown_;
- hw_states_positions_[i] += (hw_states_velocities_[i] * dt.seconds()) / hw_slowdown_;
+ hw_states_velocities_[i] += (hw_states_accelerations_[i] * period.seconds()) / hw_slowdown_;
+ hw_states_positions_[i] += (hw_states_velocities_[i] * period.seconds()) / hw_slowdown_;
break;
}
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -316,7 +310,8 @@ hardware_interface::return_type RRBotSystemMultiInterfaceHardware::read()
return hardware_interface::return_type::OK;
}
-hardware_interface::return_type RRBotSystemMultiInterfaceHardware::write()
+hardware_interface::return_type RRBotSystemMultiInterfaceHardware::write(
+ const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
for (std::size_t i = 0; i < hw_commands_positions_.size(); i++)
diff --git a/ros2_control_demo_hardware/src/rrbot_system_position_only.cpp b/ros2_control_demo_hardware/src/rrbot_system_position_only.cpp
index f5d21d60f..1871e3292 100644
--- a/ros2_control_demo_hardware/src/rrbot_system_position_only.cpp
+++ b/ros2_control_demo_hardware/src/rrbot_system_position_only.cpp
@@ -25,12 +25,14 @@
namespace ros2_control_demo_hardware
{
-CallbackReturn RRBotSystemPositionOnlyHardware::on_init(
+hardware_interface::CallbackReturn RRBotSystemPositionOnlyHardware::on_init(
const hardware_interface::HardwareInfo & info)
{
- if (hardware_interface::SystemInterface::on_init(info) != CallbackReturn::SUCCESS)
+ if (
+ hardware_interface::SystemInterface::on_init(info) !=
+ hardware_interface::CallbackReturn::SUCCESS)
{
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -50,7 +52,7 @@ CallbackReturn RRBotSystemPositionOnlyHardware::on_init(
rclcpp::get_logger("RRBotSystemPositionOnlyHardware"),
"Joint '%s' has %zu command interfaces found. 1 expected.", joint.name.c_str(),
joint.command_interfaces.size());
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.command_interfaces[0].name != hardware_interface::HW_IF_POSITION)
@@ -59,7 +61,7 @@ CallbackReturn RRBotSystemPositionOnlyHardware::on_init(
rclcpp::get_logger("RRBotSystemPositionOnlyHardware"),
"Joint '%s' have %s command interfaces found. '%s' expected.", joint.name.c_str(),
joint.command_interfaces[0].name.c_str(), hardware_interface::HW_IF_POSITION);
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.state_interfaces.size() != 1)
@@ -68,7 +70,7 @@ CallbackReturn RRBotSystemPositionOnlyHardware::on_init(
rclcpp::get_logger("RRBotSystemPositionOnlyHardware"),
"Joint '%s' has %zu state interface. 1 expected.", joint.name.c_str(),
joint.state_interfaces.size());
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.state_interfaces[0].name != hardware_interface::HW_IF_POSITION)
@@ -77,14 +79,14 @@ CallbackReturn RRBotSystemPositionOnlyHardware::on_init(
rclcpp::get_logger("RRBotSystemPositionOnlyHardware"),
"Joint '%s' have %s state interface. '%s' expected.", joint.name.c_str(),
joint.state_interfaces[0].name.c_str(), hardware_interface::HW_IF_POSITION);
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
}
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-CallbackReturn RRBotSystemPositionOnlyHardware::on_configure(
+hardware_interface::CallbackReturn RRBotSystemPositionOnlyHardware::on_configure(
const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -109,7 +111,7 @@ CallbackReturn RRBotSystemPositionOnlyHardware::on_configure(
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemPositionOnlyHardware"), "Successfully configured!");
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
std::vector
@@ -138,7 +140,7 @@ RRBotSystemPositionOnlyHardware::export_command_interfaces()
return command_interfaces;
}
-CallbackReturn RRBotSystemPositionOnlyHardware::on_activate(
+hardware_interface::CallbackReturn RRBotSystemPositionOnlyHardware::on_activate(
const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -162,10 +164,10 @@ CallbackReturn RRBotSystemPositionOnlyHardware::on_activate(
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemPositionOnlyHardware"), "Successfully activated!");
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-CallbackReturn RRBotSystemPositionOnlyHardware::on_deactivate(
+hardware_interface::CallbackReturn RRBotSystemPositionOnlyHardware::on_deactivate(
const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -183,10 +185,11 @@ CallbackReturn RRBotSystemPositionOnlyHardware::on_deactivate(
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemPositionOnlyHardware"), "Successfully deactivated!");
// END: This part here is for exemplary purposes - Please do not copy to your production code
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-hardware_interface::return_type RRBotSystemPositionOnlyHardware::read()
+hardware_interface::return_type RRBotSystemPositionOnlyHardware::read(
+ const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemPositionOnlyHardware"), "Reading...");
@@ -205,7 +208,8 @@ hardware_interface::return_type RRBotSystemPositionOnlyHardware::read()
return hardware_interface::return_type::OK;
}
-hardware_interface::return_type RRBotSystemPositionOnlyHardware::write()
+hardware_interface::return_type RRBotSystemPositionOnlyHardware::write(
+ const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemPositionOnlyHardware"), "Writing...");
diff --git a/ros2_control_demo_hardware/src/rrbot_system_with_sensor.cpp b/ros2_control_demo_hardware/src/rrbot_system_with_sensor.cpp
index 1a72e6880..3f5e6d2c0 100644
--- a/ros2_control_demo_hardware/src/rrbot_system_with_sensor.cpp
+++ b/ros2_control_demo_hardware/src/rrbot_system_with_sensor.cpp
@@ -29,11 +29,14 @@
namespace ros2_control_demo_hardware
{
-CallbackReturn RRBotSystemWithSensorHardware::on_init(const hardware_interface::HardwareInfo & info)
+hardware_interface::CallbackReturn RRBotSystemWithSensorHardware::on_init(
+ const hardware_interface::HardwareInfo & info)
{
- if (hardware_interface::SystemInterface::on_init(info) != CallbackReturn::SUCCESS)
+ if (
+ hardware_interface::SystemInterface::on_init(info) !=
+ hardware_interface::CallbackReturn::SUCCESS)
{
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -57,7 +60,7 @@ CallbackReturn RRBotSystemWithSensorHardware::on_init(const hardware_interface::
rclcpp::get_logger("RRBotSystemWithSensorHardware"),
"Joint '%s' has %zu command interfaces found. 1 expected.", joint.name.c_str(),
joint.command_interfaces.size());
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.command_interfaces[0].name != hardware_interface::HW_IF_POSITION)
@@ -66,7 +69,7 @@ CallbackReturn RRBotSystemWithSensorHardware::on_init(const hardware_interface::
rclcpp::get_logger("RRBotSystemWithSensorHardware"),
"Joint '%s' have %s command interfaces found. '%s' expected.", joint.name.c_str(),
joint.command_interfaces[0].name.c_str(), hardware_interface::HW_IF_POSITION);
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.state_interfaces.size() != 1)
@@ -75,7 +78,7 @@ CallbackReturn RRBotSystemWithSensorHardware::on_init(const hardware_interface::
rclcpp::get_logger("RRBotSystemWithSensorHardware"),
"Joint '%s' has %zu state interface. 1 expected.", joint.name.c_str(),
joint.state_interfaces.size());
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
if (joint.state_interfaces[0].name != hardware_interface::HW_IF_POSITION)
@@ -84,14 +87,14 @@ CallbackReturn RRBotSystemWithSensorHardware::on_init(const hardware_interface::
rclcpp::get_logger("RRBotSystemWithSensorHardware"),
"Joint '%s' have %s state interface. '%s' expected.", joint.name.c_str(),
joint.state_interfaces[0].name.c_str(), hardware_interface::HW_IF_POSITION);
- return CallbackReturn::ERROR;
+ return hardware_interface::CallbackReturn::ERROR;
}
}
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-CallbackReturn RRBotSystemWithSensorHardware::on_configure(
+hardware_interface::CallbackReturn RRBotSystemWithSensorHardware::on_configure(
const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -115,7 +118,7 @@ CallbackReturn RRBotSystemWithSensorHardware::on_configure(
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemWithSensorHardware"), "Successfully configured!");
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
std::vector
@@ -151,7 +154,7 @@ RRBotSystemWithSensorHardware::export_command_interfaces()
return command_interfaces;
}
-CallbackReturn RRBotSystemWithSensorHardware::on_activate(
+hardware_interface::CallbackReturn RRBotSystemWithSensorHardware::on_activate(
const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -169,7 +172,7 @@ CallbackReturn RRBotSystemWithSensorHardware::on_activate(
// command and state should be equal when starting
for (uint i = 0; i < hw_joint_states_.size(); i++)
{
- hw_joint_states_[i] = hw_joint_states_[i];
+ hw_joint_commands_[i] = hw_joint_states_[i];
}
// set default value for sensor
@@ -180,10 +183,10 @@ CallbackReturn RRBotSystemWithSensorHardware::on_activate(
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemWithSensorHardware"), "Successfully activated!");
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-CallbackReturn RRBotSystemWithSensorHardware::on_deactivate(
+hardware_interface::CallbackReturn RRBotSystemWithSensorHardware::on_deactivate(
const rclcpp_lifecycle::State & /*previous_state*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
@@ -201,10 +204,11 @@ CallbackReturn RRBotSystemWithSensorHardware::on_deactivate(
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemWithSensorHardware"), "Successfully deactivated!");
// END: This part here is for exemplary purposes - Please do not copy to your production code
- return CallbackReturn::SUCCESS;
+ return hardware_interface::CallbackReturn::SUCCESS;
}
-hardware_interface::return_type RRBotSystemWithSensorHardware::read()
+hardware_interface::return_type RRBotSystemWithSensorHardware::read(
+ const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemWithSensorHardware"), "Reading...please wait...");
@@ -236,7 +240,8 @@ hardware_interface::return_type RRBotSystemWithSensorHardware::read()
return hardware_interface::return_type::OK;
}
-hardware_interface::return_type ros2_control_demo_hardware::RRBotSystemWithSensorHardware::write()
+hardware_interface::return_type ros2_control_demo_hardware::RRBotSystemWithSensorHardware::write(
+ const rclcpp::Time & /*time*/, const rclcpp::Duration & /*period*/)
{
// BEGIN: This part here is for exemplary purposes - Please do not copy to your production code
RCLCPP_INFO(rclcpp::get_logger("RRBotSystemWithSensorHardware"), "Writing...please wait...");
diff --git a/ros2_control_test_nodes/ros2_control_test_nodes/publisher_forward_position_controller.py b/ros2_control_test_nodes/ros2_control_test_nodes/publisher_forward_position_controller.py
index 33b0efa41..92aedbbd1 100644
--- a/ros2_control_test_nodes/ros2_control_test_nodes/publisher_forward_position_controller.py
+++ b/ros2_control_test_nodes/ros2_control_test_nodes/publisher_forward_position_controller.py
@@ -27,7 +27,7 @@ def __init__(self):
self.declare_parameter("goal_names", ["pos1", "pos2"])
# Read parameters
- controller_name = self.get_parameter("controller_name").value
+ # controller_name = self.get_parameter("controller_name").value
wait_sec_between_publish = self.get_parameter("wait_sec_between_publish").value
goal_names = self.get_parameter("goal_names").value
@@ -44,7 +44,7 @@ def __init__(self):
float_goal.append(float(value))
self.goals.append(float_goal)
- publish_topic = "/" + controller_name + "/" + "commands"
+ publish_topic = "/position_commands"
self.get_logger().info(
f'Publishing {len(goal_names)} goals on topic "{publish_topic}"\