0
$\begingroup$

I have a ros2_control hardware interface that I made based on the ros2 control demos repo. However it's just an open loop controller and I'm trying to figure out how to implement the PID portion based on rotary encoder signals. I'm able to read the signals and count the ticks, I just need to figure out how to do the PID loop part.

Is the velocity command from the differential drive controller in desired radians per second?

Are there any examples of how to implement a PID controller in the hardware interface?

It would be nice to see examples of how to calculate the velocity too. Right now at max speed there is 0 or 1 pulses per loop, so it is calculating the speed as 1/10 radians per second or 0.

Here is my code so far: https://github.com/mattwilliamson/deepdrive/blob/master/src/deepdrive_control/hardware/deepdrive_system.cpp

$\endgroup$

1 Answer 1

0
$\begingroup$

diff_drive controller is not yet prepared to work in a controller chain, but this would an easy change (cf command_joints parameter of joint_trajectory_controller)

But it is easy to implement a PID controller from this class into your hardware component.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.