Ask Your Question
2

disabling PID and setting target on launch

asked 2017-11-29 15:34:46 -0500

waspinator gravatar image

updated 2017-12-05 17:28:49 -0500

http://wiki.ros.org/pid

When I start/restart a PID node, the setpoint is always set to 0, but the actual current position may be something else. If I want to make sure that my robot doesn't move back to 0 every time I restart the PID node, how would I give it an initial value, read from a node publishing the robots actual position? (the position publisher is on an arduino)

In other words, what I want to do is set the setpoint = current_position whenever the PID node starts/restarts.

These are the steps to reproduce the issue:

  1. Start the Arduino (publishes actual position)
  2. Move the robot manually to 5 meters (the arduino now publishes the current position as +5 meters)
  3. Start the PID; the PID is automatically set to "enabled" with a set position of "0"
  4. Robot moves to 0 without explicit instruction to do so

So I think the best solution would be to have an parameter to disable the PID on start. That way whatever logic enables it can make sure that the set-point is set correctly.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-11-29 15:56:22 -0500

AndyZe gravatar image

updated 2017-11-29 16:14:20 -0500

Try setting the Arduino publisher to "latch." Then the PID node should hear the most recently-published setpoint when it subscribes. (Hopefully the Arduino API allows latching...)

Edit: the latest commit will wait for you. bitbucket.org/pid

edit flag offensive delete link more

Comments

the arduino does't issue the setpoint, it's set by a node running on the main system. The arduino does publish the current position of the robot though. I updated the question to be more specific.

waspinator gravatar image waspinator  ( 2017-12-05 17:24:50 -0500 )edit

Ok. To be clear, if you clone the latest commit, you shouldn't have this problem anymore.

AndyZe gravatar image AndyZe  ( 2017-12-05 17:38:44 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-11-29 15:34:46 -0500

Seen: 98 times

Last updated: Dec 05 '17