Skip to content

Commit

Permalink
Create a demo that uses transmissions (backport #226) (#241)
Browse files Browse the repository at this point in the history
* Create a demo that uses transmissions (#226)

* add copy for transmission demo and set in the urdf

* Renamed to rrbot_transmissions

* Changed reduction value of transmission2

* Added the rrbot_transmissions_system_position_only

Exact copy of rrbot_system_position_only for now. Using it
from the transmission demo

* Moved logger into its own variable

* Uncrustify

* Renamed hw interface to joint. Added actuator interfaces

* Formatting. Remove comments

* Using transmissions for joint and actuator interfaces

Added a helper object to manage the joint to transmissions to actuator
data handling

* Propagating data between all the interfaces

* Cleanup. Added some consts

* Simulate motor motion

* Added logging to periodically show interface data

* Refactored the parameters a bit. Removed unused ones

* Added try/catches where needed

Checking joint consistency in the description not required. Already done
by the parser

* Added transmission demo to README

* Use clang-format instead

* rename transmissions ros2_control macro

* Remove unnecessary actuator parameters

* Typo

* Removed gazebo, mock hardware and fake sensors from the transmission
demo

* Missing 'explicit' from constructor

* Further cleanup of gazebo, mock hardware and fake sensors from the transmission demo

* branding fix

* Remove pointer definitions

Co-authored-by: Bence Magyar <[email protected]>

* Fixed comment about reserve

Co-authored-by: Bence Magyar <[email protected]>

* Renamed member variable and added description

---------

Co-authored-by: Noel Jimenez <[email protected]>
Co-authored-by: Bence Magyar <[email protected]>
(cherry picked from commit 1007b1d)

* Fix preformatted block

* fix header guard

---------

Co-authored-by: Jordan Palacios <[email protected]>
Co-authored-by: Bence Magyar <[email protected]>
  • Loading branch information
3 people authored and destogl committed Mar 8, 2023
1 parent 1fbdea3 commit 0572d28
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
40 changes: 20 additions & 20 deletions example_1/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ TODO(destogl): This is not adjusted yet!!

*RRBot*, or ''Revolute-Revolute Manipulator Robot'', is a simple 3-linkage, 2-joint arm that we will use to demonstrate various features.
It is essentially a double inverted pendulum and demonstrates some fun control concepts within a simulator and was originally introduced for Gazebo tutorials.
The *RRBot* URDF files can be found in the `urdf` folder of `rrbot_description` package.
The *RRBot* URDF files can be found in the ``urdf`` folder of ``rrbot_description`` package.

1. To check that *RRBot* descriptions are working properly use following launch commands:

*RRBot*
```
ros2 launch rrbot_description view_robot.launch.py
```
**NOTE**: Getting the following output in terminal is OK: `Warning: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist`.
This happens because `joint_state_publisher_gui` node need some time to start.
The `joint_state_publisher_gui` provides a GUI to generate a random configuration for rrbot. It is immediately displayed in `Rviz`.
**NOTE**: Getting the following output in terminal is OK: ``Warning: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist``.
This happens because ``joint_state_publisher_gui`` node need some time to start.
The ``joint_state_publisher_gui`` provides a GUI to generate a random configuration for rrbot. It is immediately displayed in ``Rviz``.


1. To check that *RRBot* descriptions are working properly use following launch commands:
Expand All @@ -24,37 +24,37 @@ The *RRBot* URDF files can be found in the `urdf` folder of `rrbot_description`
```
ros2 launch rrbot_description view_robot.launch.py
```
**NOTE**: Getting the following output in terminal is OK: `Warning: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist`.
This happens because `joint_state_publisher_gui` node need some time to start.
The `joint_state_publisher_gui` provides a GUI to generate a random configuration for rrbot. It is immediately displayed in `Rviz`.
**NOTE**: Getting the following output in terminal is OK: ``Warning: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist``.
This happens because ``joint_state_publisher_gui`` node need some time to start.
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 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`.
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 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.
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*.

1. Check if the hardware interface loaded properly, by opening another terminal and executing:
```
ros2 control list_hardware_interfaces
```
You should get:
```
command interfaces

You should get::

command interfaces
joint1/position [claimed]
joint2/position [claimed]
state interfaces
joint1/position
joint2/position
state interfaces
joint1/position
joint2/position

```
Marker `[claimed]` by command interfaces means that a controller has access to command *RRBot*.
Marker ``[claimed]`` by command interfaces means that a controller has access to command *RRBot*.

1. Check is controllers are running:
```
Expand All @@ -78,7 +78,7 @@ The *RRBot* URDF files can be found in the `urdf` folder of `rrbot_description`
```
ros2 launch ros2_control_demo_bringup test_forward_position_controller.launch.py
```
You should now see orange and yellow blocks moving in `RViz`.
You should now see orange and yellow blocks moving in ``RViz``.
Also, you should see changing states in the terminal where launch file is started.


Expand All @@ -94,5 +94,5 @@ Files used for this demos:


Controllers from this demo:
- `Joint State Broadcaster` ([`ros2_controllers` repository](https://github.com/ros-controls/ros2_controllers)): [doc](https://ros-controls.github.io/control.ros.org/ros2_controllers/joint_state_broadcaster/doc/userdoc.html)
- `Forward Command Controller` ([`ros2_controllers` repository](https://github.com/ros-controls/ros2_controllers)): [doc](https://ros-controls.github.io/control.ros.org/ros2_controllers/forward_command_controller/doc/userdoc.html)
- ``Joint State Broadcaster`` ([``ros2_controllers`` repository](https://github.com/ros-controls/ros2_controllers)): [doc](https://ros-controls.github.io/control.ros.org/ros2_controllers/joint_state_broadcaster/doc/userdoc.html)
- ``Forward Command Controller`` ([``ros2_controllers`` repository](https://github.com/ros-controls/ros2_controllers)): [doc](https://ros-controls.github.io/control.ros.org/ros2_controllers/forward_command_controller/doc/userdoc.html)
6 changes: 3 additions & 3 deletions example_1/hardware/rrbot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef ROS2_CONTROL_DEMO_HARDWARE__RRBOT_SYSTEM_POSITION_ONLY_HPP_
#define ROS2_CONTROL_DEMO_HARDWARE__RRBOT_SYSTEM_POSITION_ONLY_HPP_
#ifndef EXAMPLE_1__HARDWARE__RRBOT_HPP_
#define EXAMPLE_1__HARDWARE__RRBOT_HPP_

#include <memory>
#include <string>
Expand Down Expand Up @@ -78,4 +78,4 @@ class RRBotSystemPositionOnlyHardware : public hardware_interface::SystemInterfa

} // namespace ros2_control_demo_hardware

#endif // ROS2_CONTROL_DEMO_HARDWARE__RRBOT_SYSTEM_POSITION_ONLY_HPP_
#endif // EXAMPLE_1__HARDWARE__RRBOT_HPP_

0 comments on commit 0572d28

Please sign in to comment.