### Author Topic: PID code /algo for object following using camera  (Read 2243 times)

0 Members and 1 Guest are viewing this topic.

#### bootstrap

• Full Member
• Posts: 61
##### PID code /algo for object following using camera
« on: March 05, 2009, 11:30:56 AM »
Hi,

I want to make a PID based object following robot.I am getting the target object's X and Y using roborealm.I am using differential drive using modified servos with speed control.Please guide me about the algo to achieve the object following using differential drive.

#### superchiku

• Supreme Robot
• Posts: 953
• cooll
##### Re: PID code /algo for object following using camera
« Reply #1 on: March 05, 2009, 11:34:48 AM »
suppose the object is red...run a mean filter...then a red filter...hen a threshold....

after that u shl get the objct filtered out...then what do u do is that u use the centre of gravity module.,...

if the centreof gravity is on left...then go left...if the centre o gravity is on right ...then go right...simple...
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

#### airman00

• Contest Winner
• Supreme Robot
• Posts: 3,653
• narobo.com
##### Re: PID code /algo for object following using camera
« Reply #2 on: March 05, 2009, 11:51:07 AM »
i would also set up some equation so that a center of gravity that is 30 off the center turns faster than a center of gravity that is 5 off the center.
Check out the Roboduino, Arduino-compatible board!

www.Narobo.com

#### superchiku

• Supreme Robot
• Posts: 953
• cooll
##### Re: PID code /algo for object following using camera
« Reply #3 on: March 05, 2009, 11:58:36 AM »
thats the basic idea of how to do pid control...yes airman's enhancement is cool too...

i have go t a queston for uairman..in ur butler bo u used roborealm right...??

if ys then tell me how did u control the motors..i mean iam trying to pass out commands vi wireless serial commm...did u do that??

and also i want t add gui like u did...i want to import it from visual basic or java...how do u use them with roborealm??
« Last Edit: March 05, 2009, 12:00:14 PM by superchiku »
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

#### airman00

• Contest Winner
• Supreme Robot
• Posts: 3,653
• narobo.com
##### Re: PID code /algo for object following using camera
« Reply #4 on: March 05, 2009, 01:07:36 PM »
thats the basic idea of how to do pid control...yes airman's enhancement is cool too...

i have go t a queston for uairman..in ur butler bo u used roborealm right...??

if ys then tell me how did u control the motors..i mean iam trying to pass out commands vi wireless serial commm...did u do that??

and also i want t add gui like u did...i want to import it from visual basic or java...how do u use them with roborealm??
Make a Roborealm program to "talk" to a custom program , I used VB6. Its called "sockets" look that up. Then the VB6 controls motors through the serial.
Check out the Roboduino, Arduino-compatible board!

www.Narobo.com

#### superchiku

• Supreme Robot
• Posts: 953
• cooll
##### Re: PID code /algo for object following using camera
« Reply #5 on: March 05, 2009, 01:20:33 PM »
ya i know socket programming but how do u se them in roborealm and vb???

can i do the same thing in visual c++???
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

#### bootstrap

• Full Member
• Posts: 61
##### Re: PID code /algo for object following using camera
« Reply #6 on: March 06, 2009, 03:43:28 AM »
I have built a serial servo control with a protocol to control 4 servos and even a GUI in VC++6.I am using roborealm for image processing.I am able to read the X and Y of the target red color object.But what algo/logic should I use to perform a smooth object tracking with the pan-tilt unit.Please suggest.

« Last Edit: March 06, 2009, 05:23:45 AM by bootstrap »

#### airman00

• Contest Winner
• Supreme Robot
• Posts: 3,653
• narobo.com
##### Re: PID code /algo for object following using camera
« Reply #7 on: March 06, 2009, 06:04:29 AM »
ya i know socket programming but how do u se them in roborealm and vb???

can i do the same thing in visual c++???

Oops sorry I didn't mean socket, I meant Pipes.
http://www.roborealm.com/help/Pipe_Program.php
Check out the Roboduino, Arduino-compatible board!

www.Narobo.com

#### bootstrap

• Full Member
• Posts: 61
##### Re: PID code /algo for object following using camera
« Reply #8 on: March 06, 2009, 08:01:11 AM »
People are we not drifting a little bit out of the main question.Please tell me after getting COG_X and COG_Y how do I implement the PID algo to do object following.

#### superchiku

• Supreme Robot
• Posts: 953
• cooll
##### Re: PID code /algo for object following using camera
« Reply #9 on: March 06, 2009, 10:42:27 AM »
asi told u cog x and cogy tell u the centre of gravity..then what u dois that ...u put it in some equation which u must develop which tries to find out th angle ur robot will turn either left or right or go straight...and accordingly send signals to ur motor

airman socket can also be used as iam usin java to create gui and send signals to the robot...via wireless seral comm...
« Last Edit: March 06, 2009, 10:44:09 AM by superchiku »
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"