Ask Your Question

Could any one explain to me how to make the PID controller works?

asked 2017-08-21 14:23:34 -0600

Frdrckzn gravatar image

Hi guys I’m new with ROS and I'm trying to implement a PID because I need that my robot goes straight. I understand how the package works, but when I try to publish something in the set point or state topic and reading the pid_effort I get nothing. My cpp code is compilated so I dont have sintax errors but when I check the topic with rostopic info it says that I’m not subscribed on the topics or i'm not publishing in the control_effort. So I dont know how to use it. Maybe is like a step list or something to get he PID working I dont know, please help!

edit retag flag offensive close merge delete


Welcome. To better help you we're going to need more information. What package are you referring to? How are you running things? What's the output in your terminal? Where's your source code? Just because it compiles that doesn't mean that it's correct.

jayess gravatar imagejayess ( 2017-08-21 14:59:44 -0600 )edit

I'm using the PID package this is the one The only thing im doing is making the node has the wiki sais and im trying to make it work in a simple way. In the terminal (I'm using Ubuntu 16.04) I get nothing because i just want to publish or read values of the topics of the PID

Frdrckzn gravatar imageFrdrckzn ( 2017-08-21 15:15:42 -0600 )edit

I will post by soure code when I get home and thanks for the answer jayess

Frdrckzn gravatar imageFrdrckzn ( 2017-08-21 15:17:18 -0600 )edit

Can you run "rqt_graph" and post the image in your question? It should show 4 nodes, connected as shown at If I were you, I would start from the given examples, then modify them.

AndyZe gravatar imageAndyZe ( 2017-08-21 16:58:19 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-08-23 17:10:58 -0600

AndyZe gravatar image

updated 2017-08-23 17:13:46 -0600

Can you run the examples? What happens when you do:

roslaunch pid servo_sim.launch

Look at the launch file for that ^. There are two nodes you can modify for your purposes. The other nodes you don't have to mess with. You can tune the "left_wheel_pid" node at run-time. These are the 2 nodes whose code you should modify:

<node name="servo_sim_node" pkg="pid" type="plant_sim" output="screen" >
  <param name="plant_order" value="2" />

<node name="setpoint_node" pkg="pid" type="setpoint_node" output="screen" />
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools


Asked: 2017-08-21 14:23:34 -0600

Seen: 1,852 times

Last updated: Aug 23 '17