diff_drive_controller usage and operation

asked 2020-03-04 09:06:29 -0600

fjp gravatar image

updated 2020-03-18 16:20:06 -0600

Hi, have some questions trying to use the diff_drive_controller from ros_control on a real differential drive robot. I try to measure the odometry with a lm393 speed sensor and an encoder disk with 20 slots.

  1. The documentation states that diff_drive_controller works with wheel joints through a velocity interface. However, all the examples I've seen so far that implement a hardware_interface (slaterobotics, eborghi10/my_ROS_mobile_robot) read a position (angle) from the continuous wheel joints. Do I really need to provide the angle of the joints? I am asking because diff_drive_controller seems to use only a velocity interface and no position interface.
  2. What's the range that I should put the angle in? [0, 2*pi[, [-pi, pi[ or something else? I am asking for a range because I found out that the angles get wrapped anyway according to this github issue
  3. Another question I have is whether the diff_drive_controller uses/requires joint_state_controller for its operation?

    Edit: It seems that diff_drive_controller itself doesn't need joint_state_controller to operate correctly. However, when working with ros_control, joint_state_controller is useful to publish joint states for other nodes: that's the way we tell the whole system the current status of the robot joints. If another code wants to do something with the velocity of the joints, for example, here is where it should look for.

  4. The example eborghi10/my_ROS_mobile_robot uses two yaml config files. One for the diff_drive_controller and another one for the joint_state_controller and two effort_controllers. Why are all these controllers required for a differential drive robot? I thought that the diff_drive_controller should make the effort_controllers obsolete.

    Edit: According to this issue effort_controllers/JointEffortController shouldn't be required. Instead we should use diff_drive_controller because it will have the diff-drive logic already implemented.

  5. Is the joint_state_controller just used to publish joint states to nodes not related to ros_control or is this controller actually required for the diff_drive_controller to work properly?

    Edit: As mentioned in question 3.: joint_state_controller is useful when working with real robot hardware to publish joint states for other nodes. As far as I understand it is not required for ros_control itself to work.

  6. According to this answer we can use the joint_state_publisher to publish JointStates without having hardware and use joint_state_controller together with a hardware_interface and in conjunction with ros_control to publish joint states. The documentation in the source code of joint_state_controller states this similarly:

    This controller publishes the state of all resources registered to a hardware_interface::JointStateInterface to a topic of type sensor_msgs/JointState.

    Where do the resources (joints) get registered? Here in the hardware_interface?

So far I have no hardware_interface but a rospy node that is able to print the rpm and angle (not sure if this is correctly calculated) from the sensor connected to a RaspberryPi 4B. In the code I use python's time.sleep which is probably not what I should do and instead use rospy.sleep? However, my plan was to write this module not depending on ROS client libraries and then use it inside another ... (more)

edit retag flag offensive close merge delete


I would suggest to not post 6 questions in a single post here.

This is not going to work.

gvdhoorn gravatar image gvdhoorn  ( 2020-03-19 03:11:44 -0600 )edit

@gvdhoorn, you are right and sorry for the long question. As you probably saw already, I posted multiple single questions that are basically extracted from this question. You can either close this or I will edit it (as I already did partly) once I get answers to the individual questions.

fjp gravatar image fjp  ( 2020-03-19 03:20:47 -0600 )edit