Gazebo Sim

API Reference

9.0.0
JointPositionController Class Reference

Joint position controller which can be attached to a model with a reference to a single joint. More...

#include <JointPositionController.hh>

Public Member Functions

 JointPositionController ()
 Constructor.
 
 ~JointPositionController () override=default
 Destructor.
 
void Configure (const Entity &_entity, const std::shared_ptr< const sdf::Element > &_sdf, EntityComponentManager &_ecm, EventManager &_eventMgr) override
 Configure the system.
 
void PreUpdate (const UpdateInfo &_info, EntityComponentManager &_ecm) override
 
- Public Member Functions inherited from System
 System ()=default
 Constructor.
 
virtual ~System ()=default
 Destructor.
 

Additional Inherited Members

- Public Types inherited from System
using PriorityType = int32_t
 Signed integer type used for specifying priority of the execution order of PreUpdate and Update phases.
 
- Static Public Attributes inherited from System
static constexpr PriorityType kDefaultPriority = {0}
 Default priority value for execution order of the PreUpdate and Update phases.
 
static constexpr std::string_view kPriorityElementName
 Name of the XML element from which the priority value will be parsed.
 

Detailed Description

Joint position controller which can be attached to a model with a reference to a single joint.

A new Gazebo Transport topic is created to send target joint positions. The default topic name is "/model/<model_name>/joint/<joint_name>/<joint_index>/cmd_pos".

This topic accepts gz::msgs::Double values representing the target position. If you wish to change the topic on which this plugin listens you may use the <topic> parameter to specify which topic the plugin should listen on.

System Parameters

  • <joint_name> The name of the joint to control. Required parameter. Can also include multiple <joint_name> for identical joints.
  • <joint_index> Axis of the joint to control. Optional parameter. The default value is 0.
  • <use_actuator_msg> True to enable the use of actutor message for position command. Relies on <actuator_number> for the index of the position actuator and defaults to topic "/actuators".
  • <actuator_number> used with <use_actuator_commands> to set the index of the position actuator.
  • <p_gain> The proportional gain of the PID. Optional parameter. The default value is 1.
  • <i_gain> The integral gain of the PID. Optional parameter. The default value is 0.1.
  • <d_gain> The derivative gain of the PID. Optional parameter. The default value is 0.01
  • <i_max> The integral upper limit of the PID. Optional parameter. The default value is 1.
  • <i_min> The integral lower limit of the PID. Optional parameter. The default value is -1.
  • <cmd_max> Output max value of the PID. Optional parameter. The default value is 1000.
  • <cmd_min> Output min value of the PID. Optional parameter. The default value is -1000.
  • <cmd_offset> Command offset (feed-forward) of the PID. Optional parameter. The default value is 0.
  • <use_velocity_commands> Bypasses the PID and creates a perfect position. The maximum speed on the joint can be set using the <cmd_max> tag.
  • <topic> If you wish to listen on a non-default topic you may specify it here, otherwise the controller defaults to listening on "/model/<model_name>/joint/<joint_name>/<joint_index>/cmd_pos".
  • <sub_topic> If you wish to listen on a sub_topic you may specify it here "/model/<model_name>/<sub_topic>".
  • <initial_position> Initial position of a joint. Optional parameter. The default value is 0.

Constructor & Destructor Documentation

◆ JointPositionController()

Constructor.

◆ ~JointPositionController()

~JointPositionController ( )
overridedefault

Destructor.

Member Function Documentation

◆ Configure()

void Configure ( const Entity _entity,
const std::shared_ptr< const sdf::Element > &  _sdf,
EntityComponentManager _ecm,
EventManager _eventMgr 
)
overridevirtual

Configure the system.

Parameters
[in]_entityThe entity this plugin is attached to.
[in]_sdfThe SDF Element associated with this system plugin.
[in]_ecmThe EntityComponentManager of the given simulation instance.
[in]_eventMgrThe EventManager of the given simulation instance.

Implements ISystemConfigure.

◆ PreUpdate()

void PreUpdate ( const UpdateInfo _info,
EntityComponentManager _ecm 
)
overridevirtual

Implements ISystemPreUpdate.


The documentation for this class was generated from the following file: