Gravity Compensation controller¶
The gravity compensation controller uses the effort interface based on current control. When this mode is activated the user can modify the kinematic configuration of the robot’s arm by pushing the different links. This control mode is useful, for example, to perform kinestetic teaching for learning-by-demonstration purposes.
How to use the controller¶
It is possible to switch to gravity compensation controller though two interfaces: - Web Commander: in the Demos section there are two buttons to activate the gravity compensation controller for both arms. - Controller manager: the controller can be activated through the command line interface. First list the available controllers:
ros2 control list controllers
Then switch to the gravity compensation controller for the arm you want to use.
Caution
Please note that ROS 2 control does not permit two active controllers to utilize a shared resource Do not forget to switch always the default controller that is using the same resources that will used the gravity compensation controller.
ros2 control switch_controllers --activate ${ARM_SIDE_PREFIX}_gravity_compensation_controller --deactivate ${ARM_SIDE_PREFIX}_controller
where the ${ARM_SIDE_PREFIX}
is the prefix of the arm you want to use.
For example arm_left
or arm_right
or in case of single arm robot it is arm
.
Note
The gravity compensation controller is not available for the head and the torso of the robot. It is only available for the arms of TIAGo PRO and TIAGo robots.
Setting up the controller¶
To set up the gravity compensation controller, you need to define the specifics of the controller in a YAML file.
Below is an example of how to configure the gravity compensation controller for the arm of TIAGo PRO:
${ARM_SIDE_PREFIX}_gravity_compensation_controller:
ros__parameters:
type: pal_controllers/GravityCompensationController
command_joints:
- ${ARM_SIDE_PREFIX}_1_joint
- ${ARM_SIDE_PREFIX}_2_joint
- ${ARM_SIDE_PREFIX}_3_joint
- ${ARM_SIDE_PREFIX}_4_joint
- ${ARM_SIDE_PREFIX}_5_joint
- ${ARM_SIDE_PREFIX}_6_joint
- ${ARM_SIDE_PREFIX}_7_joint
root_link: torso_lift_link
tip_links:
- ${ARM_SIDE_PREFIX}_tool_link
torque_gain: 1.0
parameters:
${ARM_SIDE_PREFIX}_1_joint:
command_interface: "${ARM_SIDE_PREFIX}_1_joint/effort"
static_friction: 0.05
viscous_friction: 0.05
${ARM_SIDE_PREFIX}_2_joint:
command_interface: "${ARM_SIDE_PREFIX}_2_joint/effort"
static_friction: -1.0
viscous_friction: 0.05
${ARM_SIDE_PREFIX}_3_joint:
command_interface: "${ARM_SIDE_PREFIX}_3_joint/effort"
static_friction: 0.05
viscous_friction: 0.05
${ARM_SIDE_PREFIX}_4_joint:
command_interface: "${ARM_SIDE_PREFIX}_4_joint/effort"
static_friction: 0.05
viscous_friction: 0.05
${ARM_SIDE_PREFIX}_5_joint:
command_interface: "${ARM_SIDE_PREFIX}_5_joint/effort"
static_friction: 0.05
viscous_friction: 0.05
${ARM_SIDE_PREFIX}_6_joint:
command_interface: "${ARM_SIDE_PREFIX}_6_joint/effort"
static_friction: 0.05
viscous_friction: 0.05
${ARM_SIDE_PREFIX}_7_joint:
command_interface: "${ARM_SIDE_PREFIX}_7_joint/effort"
static_friction: 0.05
viscous_friction: 0.05
The employed parameters for the gravity compensation controller are:
type
: The type of controller. For the gravity compensation controller, the type is set topal_controllers/GravityCompensationController
.command_joints
: The joints controlled by the controller, to which the effort commands are sent.root_link
: The starting link, from which the kinematic chain is defined.tip_links
: The ending links, to which the kinematic chain is defined.torque_gain
: The gain applied to the computed torque.command_interface
: The command interface used for the joint. For the gravity compensation controller, the command interface is set toeffort
.static_friction
: The static friction value for the joint.viscous_friction
: The viscous friction value for the joint.
Caution
Usually also other two parameters are defined in the YAML file for TIAGo robot model:
motor_torque_constant
and the reduction_ratio
.
For the robots with sea arms these parameters are already defined and took into account
in the low level control of the robot.