|
Re: Vision Trouble 2011
The first thing I'd do is figure out what you want the vision code to do. If your robot drives to the target using the line, is this camera for fine tuning, height measurement, or are you using the camera instead of the line?
The example code was showing how to find the columns using only the camera. It returns the camera X pixel location. To make it more useful to steer the robot, consider doing something like
(X / (half the image width)) - 1.
This will give you a -1 to 1 range for the column position. This is pretty similar to the X input to the arcade RobotDrive VI.
If you scale the column position a bit, possibly negate it, you should be able to get the robot to turn to stare at the column -- put the column at the center of the camera image. If you add a small Y value, say -0.4, the robot will steer and move forward trying to keep the column in the center.
First, determine if this is what you want to do with the vision, and feel free to ask questions. Also, keep in mind that it is often better to drive the robot a bit first and map out useful joystick values. 1.0 doesn't sound big, but for the X input, it will make the robot spin very fast. Also, once you start to write code, I recommend putting the robot on blocks and moving the vision stuff around instead. Put a strip of tape on a wheel on each side so that you can better tell how the robot is responding.
Greg McKaskle
|