You cannot use the output of the PID controller as a velocity command. As the documentation states, it publishes two topics.
motor_cmd
, the power going to the motor in arbitrary units, which you need to use in your motor driver code to control the motor. You need to set the out_min
and out_max
parameters to define the allowable range for your motor driver code's input. Essentially, this topic outputs a value that is a proportion of the range between out_min
and out_max
, which can be considered the percentage of maximum power to apply to the motor. It does not output a velocity, so it cannot be used as a velocity command. wheel_vel
, the current velocity of the wheel in meters/second, calculated from the input encoder data and the parameters that control the relationship between ticks and distance traveled. As well as being published, this is used internally to drive the PID controller. You need to set the global ticks_meter
parameter based on your encoder's data sheet. This parameter specifies how many ticks there are from the encoder when the wheel has travelled one meter. You may also want to set the node-local rolling_pts
parameter. This is the number of values to use when calculating the rolling average that becomes the wheel_vel
topic. You should also set the encoder_min
and encoder_max
parameters to ensure correct behavior when the encoder output wraps.
If you do not have encoders on your wheels, axles or motors, then you cannot use this package unless you approximate wheel encoder data some other way (which sounds iffy and not worth the effort, to me).
What exactly is it that you're trying to do with the output? This package only works if it's connected to a motor with a rotary encoder. This is a closed loop controller, without the hardware to close the loop it will not work.
@cmfuhrman Please don't use images to post text. Text in images is not copy and pasteable and cannot be searched. This is what the quote (
"
) button is for.It would help if you explained what "not working for me" means. Do you get errors? What is the behavior of the motor? Does
rostopic echo
show anything for themotor_cmd
topic?I was attempting to use motor_cmd as a velocity topic then converted to PWM for my motors - this was not working. I believe I fixed my issue using wheel_vtarget+motor_cmd as my velocity command that I convert to PWM.