ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How would I approach a where I need PID to decrease 2D error

asked 2017-02-23 01:32:01 -0600

sharan100 gravatar image

updated 2017-02-23 01:32:34 -0600


I am currently trying to build an autonomous drone using ROS on my Rapsberry Pi which is running an Ubuntu MATE 16.04 LTS. I am using the drone to follow a bunch of red dots that I have detected using my OpenCV algorithms.

Problem Space

Now I need to move the drone. To do this, I believe the best technique would be a PID. However, looking at the documentation for a PID, it takes on a /setpoint/data, /state/data and outputs a /control_effort/data. How would I deal with the 2D situation I have right now? These topics only take std_msgs/Float64 to my knowledge.

I also eventually want to adapt this for a 3D problem.

edit retag flag offensive close merge delete


Looking quickly at the package, it is a 1d PID. If you want to control your drone in position, x,y,z, you can launch 3 PID node which you can rename in PID_x, PID_y, PID_Z for exemple. The fact that it is 1d allow you to tune it for each direction ( for a quadrotor, x = y but z will differ ).

TTDM gravatar image TTDM  ( 2017-02-23 05:18:52 -0600 )edit

@TTDM any chance that we can get a 2D PID node?

sharan100 gravatar image sharan100  ( 2017-02-23 05:34:58 -0600 )edit

@TTDM also, how would I go about creating the 3D PID node? Is there a package? Do we have to launch 3 different PID nodes?

sharan100 gravatar image sharan100  ( 2017-02-23 05:37:25 -0600 )edit

In my opinion, if you want to use this package, the easiest solution would be to launch 3 nodes with different names,
Or, you can also directly create a PID from scratch, for a simple implementation, this is only a few lines of code.

TTDM gravatar image TTDM  ( 2017-02-23 06:21:04 -0600 )edit

@TTDM Please add this as an answer and I will accept it!

sharan100 gravatar image sharan100  ( 2017-03-07 06:26:46 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-03-07 06:49:35 -0600

TTDM gravatar image

updated 2017-03-07 10:10:46 -0600

As stated in my comments:

This package is a one dimensionnal PID, if you want to use this package, in my opinion, the easiest solution would be to launch 3 nodes with different names, This link contains the explanation on how to change a node name.

Edit: AndyZe noticed that in the documentation of the package ( which is already linked in the question) , there is already a well detailed example on how to setup multiple PIDs ( in sec 5.4 : Support for multiple controllers ).

edit flag offensive delete link more



To add to this, there is already an example of launching multiple PID nodes. You could just change the namespace in the launch file of the example. link

AndyZe gravatar image AndyZe  ( 2017-03-07 09:39:19 -0600 )edit

I went past the documentation of the package a little bit too fast but the exemple is pretty clear indeed ;) I'm adding your link in my answer if that's ok for you.

TTDM gravatar image TTDM  ( 2017-03-07 10:06:19 -0600 )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



Asked: 2017-02-23 01:32:01 -0600

Seen: 159 times

Last updated: Mar 07 '17