Teleop Subroutine for semi-autonomous shooting

We want to use a single button press to start a routine that would use the camera inputs to line up the robot X and Y to the optimal target shooting position. Then spin up the shooter motors… and finally trigger the ball feed servo to shoot.

What is the best way to accomplish this in Labview? Would interrupts be a good candidate for this?

The Periodic Tasks VI is a good place for this kind of thing. Have a loop that waits for the start signal – the button press, in your case – and runs through a flat sequence doing everything it needs to. When the sequence is finished, wait for the button to be released in case the operator hasn’t let go yet, and let the loop start over to wait for the next button press.

That’s good advice. That idea reduces the possibility of getting stuck in a loop outside user control. If the driver takes their finger off the button, they regain “normal” control of the robot.

Thanks for the suggestion!

Following up on this thread…

It seems like a PID loop would be useful to control motors for this type of thing. Since we’re reading joystick inputs in the Teleop vi, it seems like we would want to use an “auto target” button input from the joystick to:

  1. Disable the normal controls for driving and shooter elevation
  2. Output the Boolean state of the “auto target” button to a Robot Global Data variable that can then be read into a Periodic Task vi PID control loop.
  3. Run a PID loop to move the robot (Tank drive and shooter elevation) so that the shooter is pointed at the target.
    (There is a lot more to step 3 than meets the eye, but this is the gist)

Does this seem reasonable? My understanding is that a PID controller needs to be running in a while loop… and that while loops should not be run inside the Teleop vi. Based on another forum post, it sounds like it will be difficult to close a loop around the camera target inputs. The vision processing loop is processing data consistently under 200ms. This may not be fast enough.

Another related question would be: Is it better to read joystick inputs inside the Periodic Task vi than in the Teleop vi?

If you were to put the vision-guided aim and shoot into teleOp, you can guarantee that the driver won’t interfere with it, because no driver station input will be delivered to teleOp. But unless you trust it to be fast and not need the driver to interrupt it, I’d recommend against it.

Periodic tasks is specifically set aside as a place for independent periodic things. It is fine for periodic tasks to read the joystick directly, but you can have it read global variables if you like.

Closing the loop with vision is possible, but is made difficult because cameras are slow and noisy sensors. This is made worse because their acquisition timing is not well known, and in fact, on a moving robot, the image smears and gets blurry. So it is often recommended to close the loop using a gyro or other sensor. The camera provides supervisory input and often only one or two supervisory loops are needed before you are in tolerance.

Greg McKaskle