merose / diff_drive

ROS nodes for controlling and monitoring a differential drive robot.
BSD 3-Clause "New" or "Revised" License
129 stars 61 forks source link

does diff_drive do PID? #10

Closed altineller closed 5 years ago

altineller commented 5 years ago

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?

merose commented 5 years ago

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:

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.

altineller commented 5 years ago

@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

NiambhB commented 4 years ago

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 :)

altineller commented 4 years ago

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.

NiambhB commented 4 years ago

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