Ten-Ton-Robotics / 6364-Crescendo

Other
0 stars 0 forks source link

:sparkles: AprilTag Localization with PhotonVision #16

Open SizzinSeal opened 8 months ago

SizzinSeal commented 8 months ago

Overview

Use PhotonVision for AprilTag detection and localization, along with global shutter cameras. Uses an Orangi Pi 5 for processing.

Motivation

April Tag detection with the LimeLight is pretty good when the robot is not moving. However, when the robot is moving, which is 99% of the time, performance degrades as the LimeLight uses a rolling shutter camera. We can use a global shutter camera.

Implementation

2 Global Shutter cameras are mounted to the robot, looking down in front of the robot onto the field. These cameras have line-of-sight of any notes in front of the robot. These 2 cameras are then connected to an Orange Pi 5, which is connected to a network switch, allowing it to interface with the RoboRio. The RoboRio then fuses this data with data with encoder and IMU data.

Todo

SizzinSeal commented 8 months ago

Turns out we don't' need to bother with SSH-ing to the orangepi. PhotonVision has a ready-made OS image for the Orange Pi 5. I flashed that, and then all you need to do is connect the orangepi via ethernet to the network switch, and you can do all configuration and stuff on photonvision.local:5800.

See https://docs.photonvision.org/en/latest/docs/installation/networking.html for more info

SizzinSeal commented 8 months ago

Also cleaned up the buck convertor wiring, and currently 3D printing mounts for the cameras and the orange pi. The buck convertor already has a casing and can just be mounted with double sided tape

SizzinSeal commented 8 months ago

Still need to set the static IP for it however

SizzinSeal commented 8 months ago

We should connect the DROK voltage convertor to a 12V 2A terminal of a CTRE VRM. We don't know how well the DROK deals with noisy input voltage, so this is a precaution to a potential problem

JaronCyna commented 8 months ago

PhotonVision is working and interfacing with the orange pi and Arduino camera as of yesterday. However, one Orange Pi and Camera no longer work meaning plans on the robot need to be mildly shifted to account for only one camera. Also more precautions should be taken with the orange pi to ensure it is safe. To run it, it needs to be connected through a radio allowing both the backend and network tables to be connected properly.

JaronCyna commented 8 months ago

I finished the first iteration of the code by using photonlib's apriltag implementation; which returns a 3D position of the robot, and then implemented it into the odemerty by converting it into a Pose2d. Everything was put into its own handler to make it more readable, and was called in robotcontainer. TODO: