0
$\begingroup$

Rosanswers logo

Hi,

I am just learning about ros_control and saw the diff_drive_controller plugin. I am wondering how I would correctly integrate some PID control in with this? Would I have to have the write() function in my RobotHW publishing to a PID node, which then publishes to another hardware interface to send it to the robot? It seems a bit long-winded and somewhat breaks the ros_control model?

I'd appreciate your guidance!

Thanks.


Originally posted by epsilonjon on ROS Answers with karma: 123 on 2016-12-05

Post score: 4

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Sadly ros_control does not do stacked/hierarchical control particularly well. In a perfect world, you'd have diff_drive_controller running together with a velocity controller in the controller manager, passing messages in some standard RT-safe fashion. Your hardware would be exposed as an EffortInterface or similar. Alas, it is not (yet) a perfect world.

You can take a look at how hector_quadrotor's control hierarchy works (stacked position/velocity/attitude controllers, using pointer 'handles' to pass data instead of RT-unsafe pub/sub).

Another alternative is to have your RobotHW class expose the VelocityInterface diff_drive_controller is looking for, and add the PID controller in the RobotHW to transform the velocity command into whatever your hardware ACTUALLY needs. Not as 'modular' as ros_control feels like it should be, but it would work.

PS see control_toolbox package in ros_control for a standard PID implementation.


Originally posted by paulbovbel with karma: 4518 on 2016-12-06

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by epsilonjon on 2016-12-09:
Thank you very much for your answer. I will take a look at the hector_quadroter as suggested. It's a coincidence you replied as I was looking at your Jackal repo the other day. Am I correct in thinking that you have no software PID in there? You just use diff_drive_controller without?

Comment by paulbovbel on 2016-12-09:
right, the PID runs on the MCU, talking to diff_drive_controller through ROS pub/sub

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.