Skip to content

Commit e8f652a

Browse files
urfeexmergify[bot]
authored andcommitted
Add effort command interface to hardware interface (#1411)
* Add effort command interface to hardware interface * Add documentation for hardware interface including effort control mode * Add effort controller to controller switch test * Ensure backwards compatibility This ensures backwards compatibility in multiple ways: - When using this with a description not containing the effort interface, it will simply not be exported. Therefore, when trying to start an effort controller that will not work, since the interfaces aren't available. - When using this with a robot software version not supporting torque control this will reject activating effort-controllers. (cherry picked from commit c1cb7f2) # Conflicts: # ur_robot_driver/doc/index.rst
1 parent 4f1f0a6 commit e8f652a

File tree

7 files changed

+183
-32
lines changed

7 files changed

+183
-32
lines changed

ur_robot_driver/config/ur_controllers.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ controller_manager:
2121
forward_velocity_controller:
2222
type: velocity_controllers/JointGroupVelocityController
2323

24+
forward_effort_controller:
25+
type: effort_controllers/JointGroupEffortController
26+
2427
forward_position_controller:
2528
type: position_controllers/JointGroupPositionController
2629

@@ -154,6 +157,17 @@ forward_velocity_controller:
154157
- $(var tf_prefix)wrist_3_joint
155158
interface_name: velocity
156159

160+
forward_effort_controller:
161+
ros__parameters:
162+
joints:
163+
- $(var tf_prefix)shoulder_pan_joint
164+
- $(var tf_prefix)shoulder_lift_joint
165+
- $(var tf_prefix)elbow_joint
166+
- $(var tf_prefix)wrist_1_joint
167+
- $(var tf_prefix)wrist_2_joint
168+
- $(var tf_prefix)wrist_3_joint
169+
interface_name: effort
170+
157171
forward_position_controller:
158172
ros__parameters:
159173
joints:
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
:github_url: https://github.com/UniversalRobots/Universal_Robots_ROS2_Driver/blob/main/ur_robot_driver/doc/hardware_interface.rst
2+
3+
UR Hardware interface
4+
=====================
5+
6+
The UR hardware interface is the core piece of the ROS driver. It is responsible for communicating
7+
with the robot controller, sending commands and receiving status updates.
8+
9+
The hardware interface is implemented using the ``ros2_control`` framework, which allows for modular
10+
and flexible control of the robot.
11+
12+
.. note::
13+
The hardware interface itself doesn't define how the robot's motion can be controlled through
14+
ROS. For that, a **controller** is needed. There are many controllers to choose from, such as
15+
the ``JointTrajectoryController`` or the ``ForceModeController``. See `ros2_controllers
16+
<https://control.ros.org/rolling/doc/ros2_controllers/doc/controllers_index.html#controllers-for-manipulators-and-other-robots>`_
17+
for "standard" controllers and :ref:`ur_controllers` for more information on UR-specific
18+
controllers
19+
20+
Supported control modes
21+
-----------------------
22+
23+
The UR hardware interface supports the following control modes:
24+
25+
- **Position control**: The robot's joints are controlled by specifying target positions.
26+
- **Velocity control**: The robot's joints are controlled by specifying target velocities.
27+
- **Effort control**: The robot's joints are controlled by specifying target efforts (torques).
28+
(Only available when running PolyScope >= 5.23.0 / 10.10.0)
29+
- **Force control**: The robot's end-effector is controlled by specifying target forces
30+
in Cartesian space.
31+
- **Freedrive mode**: The robot can be moved freely by the user without any active control.
32+
- **Passthrough Trajectory control**: Complete trajectory points are forwarded to the robot for
33+
interpolation and execution.
34+
- **Tool contact mode**: The robot stops when the tool comes into contact with an object, allowing for
35+
safe interaction with the environment.
36+
- **Speed scaling**: Speed scaling on the robot can be read and written through the hardware
37+
interface.
38+
- **GPIO**: Digital and analog I/O pins can be read and written through the hardware interface.
39+
- **Payload**: Payload configuration can be changed during runtime through the hardware interface.
40+
- **Force torque sensor**: Force torque sensor data can be read through the hardware interface.
41+
Zeroing the sensor is also supported.
42+
43+
Interacting with the hardware interface
44+
---------------------------------------
45+
46+
As stated above, motion control is done through controllers. However, the ros2_control framework
47+
provides a set of services to interact with the hardware interface directly. These services can be
48+
comfortably used through the ``ros2 control`` `command line tool
49+
<https://control.ros.org/rolling/doc/ros2_control/ros2controlcli/doc/userdoc.html>`_.
50+
51+
E.g. ``ros2 control list_hardware_components`` will list all hardware components, including the UR
52+
hardware interface with its interfaces as listed above.

ur_robot_driver/doc/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ Welcome to ur_robot_driver's documentation!
1414
installation/toc
1515
usage
1616
setup_tool_communication
17+
<<<<<<< HEAD
1718
ROS_INTERFACE
1819
generated/index
20+
=======
21+
hardware_interface
22+
hardware_interface_parameters
23+
dashboard_client
24+
>>>>>>> c1cb7f2 (Add effort command interface to hardware interface (#1411))
1925
robot_state_helper
2026
controller_stopper
2127

ur_robot_driver/include/ur_robot_driver/hardware_interface.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ enum StoppingInterface
8282
STOP_FORCE_MODE,
8383
STOP_FREEDRIVE,
8484
STOP_TOOL_CONTACT,
85+
STOP_TORQUE,
8586
};
8687

8788
// We define our own quaternion to use it as a buffer, since we need to pass pointers to the state
@@ -177,6 +178,7 @@ class URPositionHardwareInterface : public hardware_interface::SystemInterface
177178
urcl::vector6d_t urcl_position_commands_;
178179
urcl::vector6d_t urcl_position_commands_old_;
179180
urcl::vector6d_t urcl_velocity_commands_;
181+
urcl::vector6d_t urcl_torque_commands_;
180182
urcl::vector6d_t urcl_joint_positions_;
181183
urcl::vector6d_t urcl_joint_velocities_;
182184
urcl::vector6d_t urcl_joint_efforts_;
@@ -229,6 +231,7 @@ class URPositionHardwareInterface : public hardware_interface::SystemInterface
229231
bool initialized_;
230232
double system_interface_initialized_;
231233
std::atomic_bool async_thread_shutdown_;
234+
urcl::VersionInformation version_info_;
232235
double get_robot_software_version_major_;
233236
double get_robot_software_version_minor_;
234237
double get_robot_software_version_bugfix_;
@@ -305,6 +308,7 @@ class URPositionHardwareInterface : public hardware_interface::SystemInterface
305308
std::vector<std::vector<std::string>> start_modes_;
306309
bool position_controller_running_;
307310
bool velocity_controller_running_;
311+
bool torque_controller_running_;
308312
bool force_mode_controller_running_ = false;
309313

310314
std::unique_ptr<urcl::UrDriver> ur_driver_;

ur_robot_driver/launch/ur_control.launch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ def controller_spawner(controllers, active=True):
359359
"joint_trajectory_controller",
360360
"forward_velocity_controller",
361361
"forward_position_controller",
362+
"forward_effort_controller",
362363
"force_mode_controller",
363364
"passthrough_trajectory_controller",
364365
"freedrive_mode_controller",

0 commit comments

Comments
 (0)