|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Panning algorithm
I'm working on a way to make the camera pan around until it finds green, because if the target is just out of its range of view, it continues looking straight ahead. The problem that I've run into is that when I manually set the servos, it disables the automatic tracking, and it's really inefficient to repeatedly switch between automatic and manual modes. Has anybody written an effective algorithm for panning to find a color?
|
|
#2
|
|||||
|
|||||
|
Re: Panning algorithm
We've tried time and time again, and we couldn't find a way to do it. Now we just kinda hope it'll be in our robots field of view.
|
|
#3
|
||||
|
||||
|
Re: Panning algorithm
Quote:
As for panning, try this: (haven't tested but should work) Code:
// At top of file
int tempPan = 128; // Starting Position
char tInc = 4; // Rotate Speed
// In autonomous 26.2 ms loop
if (tempPan==210 || tempPan==46) {
tInc *= -1;
tempPan += tInc;
}
else if (tempPan + tInc > 210)
tempPan = 210;
else if (tempPan + tInc < 46)
tempPan = 46;
else
tempPan += tInc;
|
|
#4
|
|||
|
|||
|
Re: Panning algorithm
I found a really good way by accident...
just have it search for green and set the result in a variable called "cantfindgreen" 0 being it found it, 1 being it didnt, then put something like this in your code if (cantfindgreen) { pan++ } and on the top have it set the servos to the variable pan and tilt... No this does NOT break the servo... quite amazingly when it hits the end of it, it spins to the other side and continues... |
|
#5
|
|||
|
|||
|
Re: Panning algorithm
For partlly that reason, we decided not to let the camera do its own pan, but hooked the pan servo to a PWM output on the RC. We start at one side and skip to the other until we get T packets that we like.
Lynn (D) - Team Voltage 386 |
|
#6
|
|||||
|
|||||
|
Re: Panning algorithm
For this reason we rewrote the camera code they gave us, basically from scratch.
It works a lot better now, but it was a lot of work. |
|
#7
|
|||
|
|||
|
Re: Panning algorithm
Why wouldnt you want it to do that? Is there a flaw I am not seeing?
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Automatic Shifting Algorithm | phrontist | Programming | 10 | 29-07-2004 22:47 |
| Warnock´s Algorithm | sutto | Computer Graphics | 2 | 24-05-2004 14:05 |
| Traction Control Algorithm | Mr. Lim | Programming | 3 | 20-01-2004 14:26 |
| Arcsin Calculation Algorithm | Leo M | Technical Discussion | 11 | 05-11-2001 08:31 |