merose/diff_drive

does diff_drive do PID?

Closed this issue · 5 comments

Hello,

I was looking at diff_drive as an alternative to http://wiki.ros.org/diff_drive_controller

It seems however that your software works really nice, and easier to implement then diff_drive_controller.

Is the PID done by this controller, or not? I read tru the code and I understand that PID has to be handled by the controller and in terms of encoder ticks?

In terms of comparison and the exception of PID, what could the diff_drive_controller can do that diff_drive can't?

Does this software use other libraries or systems from ros, like controllers perhaps, or is it completely self contained?

The two main nodes in diff_drive are diff_drive_controller and diff_drive_odometry. With a real robot you could run these two nodes, together with one or more other nodes that you supply that control the motors and read and publish the odometry ticks. For example, the diff_drive_mock_robot node emulates what a "real" robot would do.

I'm not that familiar with diff_drive_controller or ros_controllers, so I can't detail for you the differences between the packages. diff_drive is self-contained – it doesn't use any other ROS packages – but it is not a complete solution, as I mentioned above.

diff_drive may or may not be your best choice depending on your robot hardware. A couple of examples where another ROS package might be better:

  • Some of my robots use Arduino processors for the low-level motor control. For those robots I have found the ros_arduino_bridge package to be useful. It does the same things diff_drive does, but also includes communication to the Arduino.
  • If you have a robot directly connected to the CPU running ROS, you might find the diff_drive_controller package, or other aspects of ros_controllers, more useful.

If you choose to use diff_drive, then, yes, you must supply something equivalent to diff_drive_mock_robot that performs PID control for the motors and reads and publishes the odometry.

@merose thank you for the explanation. I have managed to use ros pid module to control my motors, and slightly modified your driver to send targets to pid controller, and pid controller sending to hardware. It works quite nice now, and I am getting quite good results.

I have been reading the code of various differential drive controllers, and your code is very readable, and well organized.

This is the let you know I also forked the repository, and will be posting changes that I made.

Best regards,
Can

Hi @altineller. Glad you got this to work.
We want to do something very similar (albeit in simulation rather than real hardware).

Would you mind sharing your repo or a snippet of the modified diff_driver that sends the targets to the pid controller?
I would really appreciated it :)

Hello @NiambhB

I did not post the code public yet, (I had it at some time ago, but deleted it whilst moving to gitlab) but I will within couple of days for you. The repository is at https://gitlab.com/ROSRider - and I will keep posting related code to here.

I have a basic template for using ros's pid controller, and modified version of the diff drive controller. Are you planning to do this via gazebo?

I am just away from my computers at the time, and I will post it as soon as I get back to my lab.

Best regards,
C.A.

Thank you very much for replying! I am using gazebo yes.
It is very kind of you to post your code, and I'm sure it will be helpful. There is no hurry for me, so please take as long as you need.

Thank you and regards,
NiambhB