-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Drivebase Vision Align Command
Dependencies
- WPILIB 2020.2.2
- Drivebase
- Differential Drive
Description
- Guides our drivebase to aim our shooter at the top power port
Inputs
- Limelight Network Table
Outputs
- Limelight Network Table
- Drivebase Differential drive
Actions
- Remains at Vision Pipeline throughout the match
- Keeps Vision LEDs off throughout the match
- when Vision is initiated:
- turns on LEDs
- finds target
- when it sees target calculate our error
- close the horizontal and vertical error gap
- when crosshairs are on limelight, end command
Constraints
- Whether the limelight has any valid targets (0 or 1)
- angle of limelight = 40 degrees
- needs drivebase
- Horizontal Offset From Crosshair To Target (-29.8 degrees to 29.8 degrees)
- Vertical Offset From Crosshair To Target (-24.85 degrees to 24.85 degrees)
Design
Constants (In Constants.java) - public
- the horizontal point we need to adjust to is defined as our horizontal error times our horizontal P Value
- Vision Aim (yaw) proportional term - double
- Vision Distance proportional term - doublez
- Vision Ramp Time
Variables
Network Table
- Get target's horizintal position from network table
- Get target's vertical position from network table
- Get the status of the LED on limelight fron network table
- Get the status of the pipeline from network table
double
- Target area in percents - double
- The error of our Horizontal offset - double
- The error of our Vertical offset - double
- target horizontal position - double
- target vertical position - double
- clampValue instance - double
- the horizontal point we need to adjust to - double
- the vertical point we need to adjust to - double
- the target's valid Horizontal Range - double
- the target's valid Vertical Range - double
boolean
- Check to see if this is the first loop - boolean
int
- counts how long we are in range - int
- the amount of counts that are in range to be called valid - int
WPILIB
- Ramp timer - WPILIB Timer
Methods
-
Default State
- Sets Pipline to Vision Align
- Turns off LEDS
-
initialize()
- tell this is the first loop of this new instance of the command
-
execute()
- when the first loop runs, reset the ramp timer and start it
- after the first loop, first loop returns false
- set the pipline to the vision mode
- turns on LED
- get horizontal position offset and assign it to a double
- get vertical position offset and assign it to a double
- the horizontal point we need to adjust to is defined as our horizontal error times our horizontal P Value
- the Vertical point we need to adjust to is defined as our vertical error times our vertical P Value
- input these values into the drivebases arcadeDrive
-
end()
- stop ramp timer
- reset to first loop
- turn off LEDs
-
isFinished()
- when crosshairs are within zone, increment the count
- if the range count is equal to the valid count
- call end()
-
clamp()
- if within max range and min range, return number
- else return max range or min range value
For Research
- how to compute distance
- tracking power cells with chameleon vision
- skew value
- valid target boolean
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels