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

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

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

sharan100 gravatar image

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

Background

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

Comments

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 -0500 )edit

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

sharan100 gravatar image sharan100  ( 2017-02-23 05:34:58 -0500 )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 -0500 )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 -0500 )edit

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

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

1 Answer

Sort by ยป oldest newest most voted
1

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

TTDM gravatar image

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

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

Comments

1

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 -0500 )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 -0500 )edit

Question Tools

2 followers

Stats

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

Seen: 190 times

Last updated: Mar 07 '17