Skip to content
Work in progress. This library and its docs are new and still changing, and some parts are not yet tested on a real robot. Something wrong or unclear?Tell us with a short GitHub form.

AIM-01: Turret follows the goal with the camera

high prioritySimulator or real robotabout 40 minAiming

Why

A turret that follows the goal takes the aiming off the drivers. It must turn the short way, never go past its limits, and say clearly when the goal is out of range. Every turret is built differently (gear ratio, range, where the camera is), so we need other turrets.

Safety

  • Hard stops on the turret just past min and max. Check them by hand first.
  • Cables slack over the whole range. The flywheel off (do not fire in this test).
  • Safety glasses if the launcher has pieces in it.

Setup

  • Turret.motor(...).gearRatio(...).follows(camera) in Robot.java, Tunables.Turret with min, max.
  • A goal tag (AprilTag) you can see: the field, or a printed tag at the right height.
  • The turret at its startAngle before INIT (by default 0 = straight forward; a mark or a jig helps), unless it has a home switch (TUR-01) or an absolute encoder. TeleOp started within 5 minutes of another program starts from the angle that program ended at.
  • Simulator: lesson 9's turret robot (turretbot) commands, then "TurretBot TeleOp".

Steps

  1. INIT your TeleOp, START. Drive (or turn the robot) until the camera sees the goal.
  2. Watch the turret turn to the goal. Read the turret line on the Driver Station.
  3. Turn the robot slowly 90 degrees one way, then the other. The turret keeps on the goal.
  4. Turn the robot until the goal is past a turret limit: the turret waits at the limit, and the Driver Station says "goal out of turret range".
  5. Gamepad 2 right stick X: the turret turns by hand. Let go: following goes on.
  6. Gamepad 2 BACK: following off. BACK again: on.

Pass rule

In steps 2 and 3 the turret stays within its tolerance (1.5 degrees by default) of the goal while the robot turns slowly, it never goes past min or max (0 times), and step 4 shows the message.

Record

Write these down while you test. The report form has them as a list to fill in.

  • camera (Limelight or webcam), on the turret or on the body
  • gear ratio, min, max, kP you used
  • how far off it settled (degrees, from the Driver Station or by eye)
  • any shaking or overshoot, and when

If your robot is different

A camera on the robot's body needs .cameraOnBody(): say if you used it. A turret with a different range (say 0 to 270), a servo turret (TUR-03) or a slip ring (TUR-04) is very useful. If the turret turns away from the goal, .reversed() fixes it: say whether the docs made that clear.

Report your result

Pass, fail, or could not run: every result helps. The form opens on GitHub with this test filled in (a free GitHub account is needed). No student names, please.

Report result

No reports for this test yet: yours would be the first. Every test's reports.

All tests · Next: AIM-02 Odometry backup aim when the camera is covered

Something wrong on this page? Tell us with a short GitHub form.