|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#2
|
|||
|
|||
|
Re: Aiming with Vision
Your input value ranges from -160 to 160, which means that your other tuning parameters will need to be pretty small to output a number between .5 and -.5.
Also, cameras are slow sensors in the best of cases, and my suspicion is that your is probably updating the set point at 100ms or 150ms intervals. That is a lot of tele Op loops running at 50% throttle between images. A moving camera blurs and distorts the image as well. My guess is that your target is not centered, so your robot is jumping to half throttle spin and the next image doesn't have a target at all. If your code doesn't see a target, it should zero the offset and the PID will settle to 0 output, but not knowing the coefficients, it could have history and not immediately output a zero. If you are ever tuning a PID that controls the robot orientation, here are some suggestions. 1. Put the robot on blocks so it can't hurt anyone. 2. Wire the error term, set point, and output value to a chart (put all three into a cluster and wire that to the chart terminal) so that you can see what happens over time. 3. Put the target in the center of the camera and test that the code works as you expect. 4. Put the target just a bit off center and see what the motor values are. 50% may be too high. 5. Have someone walk back and forth and see that the robot motors make sense. By the way, for this, I'd set I and D to zero initially and get P in the ballpark. Finally, after doing this, I think you'll find that you cannot really close the loop using a camera. I'd suggest that you use the offset from the camera to compute an amount to turn the robot. Then use a gyro to close the loop. The measure with the camera and repeat if necessary. Greg McKaskle |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|