ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
4

Correct way to use diff_drive_controller with PID control?

asked 2016-12-05 15:13:27 -0600

epsilonjon gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-12-06 17:37:16 -0600

paulbovbel gravatar image

updated 2016-12-06 17:38:38 -0600

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.

edit flag offensive delete link more

Comments

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?

epsilonjon gravatar image epsilonjon  ( 2016-12-09 16:09:46 -0600 )edit

right, the PID runs on the MCU, talking to diff_drive_controller through ROS pub/sub

paulbovbel gravatar image paulbovbel  ( 2016-12-09 16:28:06 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2016-12-05 15:13:27 -0600

Seen: 1,496 times

Last updated: Dec 06 '16