Spent several hours on Sunday working on auto-shot. This is code that's been in for a while but never tested. It still has never been officially tested on a live robot but now it's gotten a run on the testbed. Here's what auto-shot does.
Auto-shot runs in the periodic-task VI. Setting the boolean Auto-Shot starts the process. I've added button 11 from the right joystick to engage auto-shot during teleop. The cancel sequence will also cancel auto-shot. It is also called from autonomous in auto mode 4 (cross defense and shoot).
Auto-shot does the following in sequence:
- it looks for the 1st entry in the vision processing output. If there are no targets found, it does nothing and simply waits until there's something.
- when a target is present, it rotates the robot until the center of the target bounding box is centered horizontally across the crosshairs.
- it then looks at the distance returned by the vision computation and moves the robot forwards or backwards until it is inside the distance range.
- lastly it engages the do-it-all sequence to fire the boulder.
Step 3 was placed after step 2 intentionally. However if the robot does not track in a straight line, the targeting can be thrown off. We can fix this by swapping steps 2 and 3, or by adding another rotation adjustment after the linear movement to fine tune things.
The last thing to add (still debugging) is to add a dashboard value that offers a horizontal compensation. The current software tries to center the target in the camera's field of view. But may not be accurate if the camera mounting and shooter are not lined up right. There's a problem reading numbers from the dashboard- may be similar to the problem I had reading booleans - still working on this.
Finally we need to see if the ball pinch is needed or if there's another way to make it ball secure on the robot as it crosses the defenses.
Oh - added support for the hardstop motor. We should be debugging this really soon.