is it possible to have the robot track a tetra without the servos? if it is possible, how can it be done?
Yes, but you would have to manually make the robot turn if the blob does not appear in the camera’s original field of view. It is very possible but more complicated if you don’t use the servos.
We were thinking about doing that and came up with some methods. You could either…
Use the bouding box variables given from the cam to try and line it up manually.
Take the pan servo outputs from the camera, input them into the RC, run it as the x value on a one joystick drive algorithm, and move the drive motors to try and “trick” the camera into thinking the servo moved.
Our team is doing the tracking without the servos. So far the robot rotates in place to line up with the blob. We wrote our own camera code using the FIRST serial driver. Basically we scale the x-value (data byte 1 of the T packet) of the blob from 3-158 to 0-255, then feed it into the x-value of a one joystick algorithm. It works quite nicely.
unfortunately, you cannot just send the pan servo out to the rc. The algorithm the camera uses assumes that when it sends a value, it will be rotated to the corresponding heading. If you wanted to use these values, you could detect changes in the servo output and then rotate the robot the corresponding angle. Overall, it’s more trouble than it is worth, because the x-value of the blob (sent in the serial stream) is usable in a one-joystick algorithm.
Except the “x value of the blob” is not in the same format as the joystick values. Center is 79 so you would have to… Well the easiest way I think would be to just add 48 too all of them. Something like that.
right. That’s what I meant by “scale from 3-158 to 0-255” -> I subtract 81 and then multiply by 127 then divide by 81 then add 127.