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

Revision history [back]

click to hide/show revision 1
initial version

I am not aware of anything that has made it into the upstream ros2_controllers repo, but there was some in progress work on this that you may find useful.

ros2_controllers#198 has a bit of discussion, and I did make a fork with a functional* PID controller (* see my comment for a few caveats). My work on this had stalled out and was never upstreamed because I had wanted to include joint limits, but the upstream ros2_control repo has yet to finalize how these are going to be implemented.

A few other notes if you do follow my rough implementation as a starting point:

  • PID values are passed in as a parameters from your controllers.yaml file. They are expected in the form of:

Yaml Format

my_controller:
  ros__parameters:
    gains:
      joint_1:
        p: 10.0
        i: 1.0
        d: 0.0
      ...

or equivalently as a parameter with the name gains.joint_1.p

  • gains are only updated in the controller when the controller in the on_configure() method. If you want to be able to change them on the fly without reloading the controller, you'd need to add a parameter callback. There's a bit of a safety vs convenience tradeoff there.
  • the joint limit implementation I was using is deprecated and might require that you pull a specific commit of ros2_control. if you don't need it, it may be worth removing them. If you do remove them, consider submitting a PR to ros2_controllers with the simpler "first pass" solution. I'm sure many people would find it useful
  • its been a while since I've worked on this and my fork is ~70 commits behind master, so there is a good chance it won't work without merging in some of the more recent changes