Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Two Color Tracking Demo (http://www.chiefdelphi.com/forums/showthread.php?t=72066)

RKElectricalman 17-01-2009 13:56

Re: Two Color Tracking Demo
 
Can anyone explain to me how to open up the project in Wind River?

Also, when I was working with Labview, I couldn't get it to track. I figured out how to power the servos with the jumpers included, but I couldn't get the camera to actually autonomously move and track the colors, even though it did see it in the VI. Has any one had any issues similar to this?

pollyproof12 17-01-2009 15:59

Re: Two Color Tracking Demo
 
anyone have pictures of how they set up thier camera?

nickmagus 17-01-2009 20:14

Re: Two Color Tracking Demo
 
nvm

laultima 17-01-2009 20:26

Re: Two Color Tracking Demo
 
The color values from this work beautifully. Weve got our camera tracking, both pan and tilt, from code we wrote using these colors in WindRiver. Ill be happy to post the code here if anyone wants to look it over.

btgdaniel 18-01-2009 05:00

Re: Two Color Tracking Demo
 
Yes, please post your code -- it would be nice to see another example.

Greg McKaskle 18-01-2009 09:48

Re: Two Color Tracking Demo
 
A few clarifications. The example for two color tracking does need to have the DS connected and enabled, but it doesn't care if it is autonomous or tele. You can incorporate it into either or both later.

If you are having problems with the LV example, I'd be glad to help. The first thing I'd advise is setting the radio button near the image display to turn off the gimbal, so the camera will hold still and you will see what the camera sees. Make sure it is focused, make sure your target is in the scene. And hopefully the mask display below will show you the results of the red/green thresholds.

Lighting has a huge impact on vision, and even though this is app was written to be really tolerant of lighting, it can still mess with you. So I usually tilt the target forward and back a bit to see how that will affect things. Move it around to see how overhead lights affect things. Splotchy lighting is some of the worst.

If you are having difficulties at this point, it will be necessary to adjust the camera settings, no use trying to track.

Greg McKaskle

Dr Nick 18-01-2009 19:44

Re: Two Color Tracking Demo
 
I've got the camera mounted and scanning for the target but it won't lock on to it (using C++). I got an image from the camera and set the threshold values for my lighting conditions so i have no idea why its not working. To make matters worse, there is a problem with DPRINTF (I think). When it got to the DPRINTF command, the console said there was an error with it, saying a malformed calling sequence. Is anyone else having this problem?

Mikesername 19-01-2009 13:44

Re: Two Color Tracking Demo
 
So how do you go about hooking it up so the motors attatched to the wheels move to follow the target?

Ted Weisse 19-01-2009 14:16

Re: Two Color Tracking Demo
 
If you are having problems with the LV example, I'd be glad to help. The first thing I'd advise is setting the radio button near the image display to turn off the gimbal, so the camera will hold still and you will see what the camera sees. Make sure it is focused, make sure your target is in the scene. And hopefully the mask display below will show you the results of the red/green thresholds.

Greg McKaskle[/quote]


We can track a single color and the example when in camera mode sees both red and green thresholds. When we enable the gimbal and the DS the pan/tilt searches. On the screen we see the green lagging the red target as it goes across the screen.

What are we doing wrong?

Thanks....

laultima 19-01-2009 17:47

Re: Two Color Tracking Demo
 
Heres the code we're using for target tracking, using the color values from the TwoColorTrackDemo. All variables are doubles declared before the While loop, and pan and tilt are servos.

Code:

if (FindColor(IMAQ_HSL, &redData.hue, &redData.saturation,
                                        &redData.luminance, &aRed) && FindColor(IMAQ_HSL,
                                        &greenData.hue, &greenData.saturation,
                                        &greenData.luminance, &aGreen)) {
                                redX = aRed.center_mass_x_normalized;
                                redY = aRed.center_mass_y_normalized;
                                greenX = aGreen.center_mass_x_normalized;
                                greenY = aGreen.center_mass_y_normalized;
                                centerX = (redX + greenX)/2;
                                centerY = (redY + greenY)/2;
                                panMove = (tan((PI/4)*centerX))/8;
                                tiltMove= (tan((PI/4)*centerY))/8;
                                pan->Set(pan->Get()+panMove);
                                tilt->Set(tilt->Get()-tiltMove);
                        }


Greg McKaskle 19-01-2009 21:38

Re: Two Color Tracking Demo
 
Quote:

Originally Posted by Ted Weisse (Post 803791)
On the screen we see the green lagging the red target as it goes across the screen.

What are we doing wrong?

Are you holding the target so that it looks like a foe? The panel lets you describe which alliance you are on, and by default it looks for and tracks the biggest foe.

Greg McKaskle

Ted Weisse 19-01-2009 21:57

Re: Two Color Tracking Demo
 
Yes as foe. The servos just hunt never locking on to the target.

Greg McKaskle 19-01-2009 22:28

Re: Two Color Tracking Demo
 
If the red and green masks look good, and your holding the target in the correct orientation, the next things I'd do is to watch the Tracking State indicator. When the camera doesn't see the target, it should search. When it acquires some pink and green that make up a foe, it uses the proportional constants to move the camera so that the target is closer to center. You may want to check the sign of the constants to see if the servos are moving in the wrong direction.

If you don't stumble on the issue soon, one thing that will help with debugging will be to put the target in frame, but off center. Position the servos with the FP knob and slider if you need to. Then put a break point after the FindTwoColor and follow it into the Servo Track VI to determine which of these is the issue.

Greg McKaskle

rcoren22 20-01-2009 19:13

Re: Two Color Tracking Demo
 
we are able to see get colors in mask, with tracking indicators showing position and target numbers, but we cannot get any ouput to servo motors.
We have connected servos to pwm 9 and 10

Is the target numbers what should be outputed to servo pw9 & pw10

Booksy 20-01-2009 19:38

Re: Two Color Tracking Demo
 
Quote:

Originally Posted by rcoren22 (Post 804711)
we are able to see get colors in mask, with tracking indicators showing position and target numbers, but we cannot get any ouput to servo motors.
We have connected servos to pwm 9 and 10

Is the target numbers what should be outputed to servo pw9 & pw10

Forgive me if this has been mentioned before: Does the servo updating loop have a watchdog feeder. This has been the problem for me numerous times. It might already have it, I forget, but I know the first one (single color) didn't and I had to add it.


All times are GMT -5. The time now is 18:32.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi