How to control a rotating joint in velocity

asked 2019-12-02 09:54:02 -0600

lotfishtaine gravatar image

Hello everyone,

I'm trying to control a rotating joint type "continuous" in velocity, and simulate it in Gazebo.

This is the URDF joint definition:

<joint name="${name}_joint" type="continuous"> 
      <xacro:insert_block name="origin" />
      <parent link="${namespace}/${parent}"/>
      <child link="${namespace}/${name}"/>
      <axis xyz="1 0 0" rpy="0 0 0" />
      <limit effort="2000.0" velocity="40.0" />
    </joint>

    <gazebo>
      <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
        <robotNamespace>${namespace}</robotNamespace>
      </plugin>
    </gazebo>

    <transmission name="${name}_joint_trans">
      <type>transmission_interface/SimpleTransmission</type>
      <joint name="${name}_joint">
        <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
      </joint>
      <actuator name="${name}_joint_motor">
        <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
      </actuator>
    </transmission>

and the config yaml file for controllers:

 joint_state_controller:
    type: joint_state_controller/JointStateController
    publish_rate: 60

  my_joint_position_controller:
    type: velocity_controllers/JointVelocityController
    joint: my_joint
    pid: {p: 0.5, i: 0.6, d: 0.0035}

I have couple of questions:

  • first, can someone explain the yaml file or give a tutorial explaining this? what is "publish_rate" and what is its role? how can influence the rotation? same for "joint_state_controller"?

  • Second, to change the joint velocity I run :

    rostopic pub /my_joint_position_controller/command std_msgs/Float64 "data: 5.0"

    the data value is a linear velocity (m/s) or rotational velocity (rad/s) ? If it is a linear velocity, how can I transform that to rotational velocity (rad/s)?

  • third, how can I get the joint angle at every moment?

Thanks in advance.

edit retag flag offensive close merge delete

Comments

In my implementation, I followed this tutorial and managed to control the joint. However, when I get to the controller performance visualization part, I can't find the topic my_joint_position_controller/state/process_value

Does this mean that I'm missing something in my implementation?

lotfishtaine gravatar imagelotfishtaine ( 2019-12-04 03:28:59 -0600 )edit

state/process_value is not a topic. It's a field in the message that is published on the state topic.

See also #q323036.

rqt_plot is just able to "reach into" messages to plot values from fields. That makes it seem like they are topics, but they're not (rostopic can do the same).

gvdhoorn gravatar imagegvdhoorn ( 2019-12-04 03:34:34 -0600 )edit

Thank you for your reply. When you said state topic, do you mean /joint_states topic or another topic? rostopic list command only gives me one topic related to my joint controller:

- `my_joint_position_controller/command`

Should I have another topic or not? like :

  - my_joint_position_controller/pid/parameter_descriptions
  - my_joint_position_controller/pid/parameter_updates
  - my_joint_position_controller/state

same in this example.

lotfishtaine gravatar imagelotfishtaine ( 2019-12-04 07:59:23 -0600 )edit