I am curious how some teams use a gyro to align a tank drive for vision. Could someone explain how I could implement a gyro to align to a target for vision?
Why would you need a gyro? Does your vision system give you degree offsets?
I’m trying to figure out how to align in vision, and I saw that many teams have implemented a gyro and calculate the relative angle of the camera then use a PID loop to align.
There are a couple different ways to handle this problem:
- If there isn’t much delay between your camera and your robot code, you can just try and point directly at the target every robot loop.
- However, if your camera->robot system has a lot of latency, or images take a long time to process somewhere, what you can do is stop moving for a moment, get the information from your camera (e.g. “the target is 10 degrees to the right”) and then use PID and your gyro to point at that target.
I’m using an NVIDIA Jetson co-processor so latency/speed isn’t an issue. I understand in theory how to make the alignment system. I just don’t understand how to apply different values to both sides of a tank drive to make a smooth alignment. Like how to you maintain moving forward will rotating one side to fast align?
Got it. You’ve got some options, here are just two:
- Treat your drive like an arcade drive, and hand the “rotational” aspect of it over to the alignment PID, while performing whatever overall forward/backward translation however you want.
- Given your targeting data, figure out where you want to be compared to where you are right now, and use the new WPILib kinematics libraries to calculate a trajectory and follow the path there.
Thanks! That makes sense I’ll look into it.
Check out the Limelight docs, they have a lot of useful information there. They even have one for aiming and getting in range at the same time! Hope this helps.
wow these limelight docs have everything I need thanks!
I found it on Chapter 11 Case Study: Aiming and Range at the same time: https://readthedocs.org/projects/limelight/downloads/pdf/latest/
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.