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

Differential Drive PID Output

asked 2018-04-23 15:20:30 -0500

I am using the differential_drive package for a PID controller. I am confused at the motor_cmd topic. It states that it is the output of the PID, the power going to the motors, in arbitrary units. I am attempting to use the output as a velocity command but this is not working for me. How do I utilize the PID output of the differntial_drive package?

image description

edit retag flag offensive close merge delete

Comments

1

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.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-04-23 17:39:33 -0500 )edit

@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.

jayess gravatar image jayess  ( 2018-04-23 18:34:08 -0500 )edit
1

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 the motor_cmd topic?

Geoff gravatar image Geoff  ( 2018-04-23 21:05:59 -0500 )edit

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.

cmfuhrman gravatar image cmfuhrman  ( 2018-04-24 07:33:43 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-04-23 21:36:54 -0500

Geoff gravatar image

You cannot use the output of the PID controller as a velocity command. As the documentation states, it publishes two topics.

  1. 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.
  2. 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).

edit flag offensive delete link more

Comments

Yes I have encoders and am calculating wheel velocity correctly (with this package). I was attempting to use the motor_cmd as a velocity and obviously that is not working. I think I have a solution now where I take my wheel_vtarget and add motor_cmd as a sort of offset!

cmfuhrman gravatar image cmfuhrman  ( 2018-04-24 07:31:27 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-04-23 15:20:30 -0500

Seen: 984 times

Last updated: Apr 23 '18