Why read position for VelocityJointInterface?

asked 2020-03-18 18:21:48 -0500

fjp gravatar image

updated 2020-03-18 18:49:26 -0500

I am learning how to use diff_drive_controller from ROS control and have a question about the VelocityJointInterface. The documentation states that diff_drive_controller works with wheel joints through a velocity interface. One example that implements a hardware_interface::RobotHW for diff_drive_controller (eborghi10/my_ROS_mobile_robot) reads a position (angle) from the continuous wheel joints.

Do we really need to read the angle of the joints for diff_drive_controller? Where is it used? I am asking because diff_drive_controller uses a JointVelocityInterface and no JointPositionInterface, as mentioned in the documentation.

Why is the joint state position relevant when using a VelocityJointInterface? Is the VelocityJointInterface (mentioned in the docs) only relevant for writing? Because in the write() method only the velocity is published.

edit retag flag offensive close merge delete


In the example you link, it seems the author has encoders available only. How would you calculate dX/dT without first calculating X?

gvdhoorn gravatar image gvdhoorn  ( 2020-03-19 03:09:12 -0500 )edit

Thank you @gvdhoorn that makes sense. I just thought that when using a VelocityJointInterface we only read and write velocity and no position. In order to do read/wirte position we should use a PositionJointInterface? Or is it common to use just a VelocityJointInterface and fill all variables (pos, vel and eff)? Could you please clarify this?

fjp gravatar image fjp  ( 2020-03-19 03:17:04 -0500 )edit

@gvdhoorn, should I ask a new question regarding the intended usage of VelocityJointInterface? I guess this question is not specific enough because it includes multiple questions again. Another part of my confusion stems from the mentioned example. It uses three controllers (effort and diff_drive_controller) where I don't know what two of them are really doing (I think the effort controller should be obsolete but I think it is mainly used in the example and not the diff_drive_controller). Furthermore the example uses joint_state_controller which, as fas as I know, is used only to publish joint states.

fjp gravatar image fjp  ( 2020-03-19 05:15:11 -0500 )edit

However, looking at the hardware resource interface layer image it seems that joint_state_controller with its JointStateInterface is used for controllers to read joint states and is therefore always required? These lines define the two interfaces in the example.

fjp gravatar image fjp  ( 2020-03-19 05:22:30 -0500 )edit