Camera problems(c++)

Hi I’m a programmer from team#3017
We had recently set up the camera for autonomous period.
The servos are working fine(although the horizontal servo is sorta lagging)
When it saw the target, it moved vertically up instead of following it and lost the target.
Can I please get a help ASAP because i got a deadline by tomorrow? :ahh:

few questions:
Are you running one of the demo programs?
Have you updated WPILib to version 3? (released on the 27th)
Have You updated the cRIO to version 11? (also on the 27th)

Yes I did all them.
All i changed is the pwm servos in the program

is this the 2 color tracking program or the vision demo?

I used the example project provided in the windriver.
is call the twocolordemo

Im not familiar with that code, sorry.
I’d add some printf’s and see if you can find why the servos are moving when they do.
did you transplant this code from the demo into your code? cause if you did, i’d make sure to destroy the environment and make sure nothing else is affecting the servos.

hmm ok
I’ll see what i can do to deal with the problem.
Thanks for helping

I had a similar issue with the code myself and I just found a way around it today. The problem lies within the value of verticalPosition. I discovered that it never gets assigned a value so I made my own variable to use in place of it and that seemed to solve my problem. Good luck, and just let me know if you have any other questions.

try this:


// you may need to reverse this based on your vertical servo installation
				//incrementV = verticalPosition - verticalDestination;
				incrementV = verticalDestination - verticalPosition;


// you may need to reverse this based on your vertical servo installation
				incrementV = verticalPosition - verticalDestination;
				//incrementV = verticalDestination - verticalPosition;

I will add those into my checklist
Also how can i decrease the lagging of horizontal servo during the searching period?
by lowering the framrate or the pixel?

Try changing the resolution from 320x240 to 160x120, that seemed to speed things up for us.

i’ll giv the result by tmr
thx for the help

we didnt really get it working
wat v do is disable the vertical position