|
2024-Robot
Robot code for 2024 FRC season by Argos, FRC team #1756
|
#include <vision_subsystem.h>
Public Types | |
| enum class | InterpolationMode { LinearInterpolation , Polynomial , Trig } |
Public Member Functions | |
| VisionSubsystem (const argos_lib::RobotInstance instance, SwerveDriveSubsystem *pDriveSubsystem, ShooterSubsystem *pShooterSubsytem) | |
| std::optional< units::inch_t > | GetDistanceToSpeaker () |
| Get the distance to the tag. | |
| std::optional< units::degree_t > | GetOrientationToSpeaker () |
| Get the distance to the tag. | |
| std::optional< units::inch_t > | GetCalculatedDistanceToSpeaker () |
| Get the distance to the tag calculated with the Ty (vertical offset) | |
| LimelightTarget::tValues | GetPrimaryCameraTargetValues () |
| Get the robot poses and latencies. | |
| LimelightTarget::tValues | GetSecondaryCameraTargetValues () |
| Get the robot poses and latencies from secondary camera. | |
| std::optional< units::degree_t > | GetHorizontalOffsetToTarget () |
| Get the current offset to the retroreflective tape. | |
| void | SetPipeline (uint16_t tag) |
| void | RequestFilterReset () |
| void | SetAimWhileMove (bool val) |
| bool | IsAimWhileMoveActive () |
| void | SetOdometryAiming (bool val) |
| bool | IsOdometryAimingActive () |
| void | SetEnableStaticRotation (bool val) |
| bool | IsStaticRotationEnabled () |
| void | Periodic () override |
| void | Disable () |
| it disables (duh) | |
| units::degree_t | getShooterAngle (units::inch_t distance, const InterpolationMode mode) |
| std::optional< units::degree_t > | getShooterAngle () |
| std::optional< units::degree_t > | getShooterOffset () |
| units::degree_t | getFeederAngle () |
| std::optional< units::degree_t > | getFeederOffset () |
| std::optional< units::degree_t > | getShooterAngleWithInertia (double medialSpeedPct) |
| std::optional< double > | getRotationSpeedWithInertia (double lateralSpeedPct) |
| std::optional< units::degree_t > | getFeederAngleWithInertia (double medialSpeedPct) |
| std::optional< double > | getFeedOffsetWithInertia (double lateralSpeedPct) |
| units::angular_velocity::revolutions_per_minute_t | getShooterSpeed (const units::inch_t distance, const InterpolationMode mode) const |
| std::optional< units::angular_velocity::revolutions_per_minute_t > | getShooterSpeed () |
| std::optional< units::inch_t > | GetDistanceToTrap () |
| std::optional< units::inch_t > | GetDistanceToStageCenter () |
| std::optional< units::degree_t > | GetHorizontalOffsetToTrap () |
| std::optional< units::degree_t > | GetOrientationToTrap () |
| std::optional< whichCamera > | getWhichCamera (bool forFeeder=false) |
| std::optional< LimelightTarget::tValues > | GetSeeingCamera (bool forFeeder=false) |
Private Member Functions | |
| void | UpdateYaw (std::stop_token stopToken) |
Private Attributes | |
| CameraInterface | m_cameraInterface |
| Interface to limelight camera. | |
| argos_lib::RobotInstance | m_instance |
| Contains either the competition bot or practice bot. Differentiates between the two. | |
| SwerveDriveSubsystem * | m_pDriveSubsystem |
| Pointer to drivetrain for reading some odometry. | |
| ShooterSubsystem * | m_pShooterSubsystem |
| Pointer to shooter subsystem for reading aiming mode. | |
| LimelightTarget::tValues | m_oldTargetValues |
| The old robot poses and latencies. | |
| bool | m_usePolynomial |
| specifies whether to use the polynomial to obtain shooter angle | |
| bool | m_useTrigonometry |
| specifies whether to use the trigonometry to obtain shooter angle | |
| bool | m_isAimWhileMoveActive |
| true if aiming trigger is pressed and locked | |
| bool | m_enableStaticRotation |
| true if you want to rotate in the absence of translation input | |
| bool | m_isOdometryAimingActive |
| true if we want to aim without vision | |
| argos_lib::InterpolationMap< decltype(shooterRange::shooterAngle.front().inVal), shooterRange::shooterAngle.size(), decltype(shooterRange::shooterAngle.front().outVal)> | m_shooterAngleMap |
| Maps a distance to a shooter pitch angle. | |
| argos_lib::InterpolationMap< decltype(shooterRange::shooterSpeed.front().inVal), shooterRange::shooterSpeed.size(), decltype(shooterRange::shooterSpeed.front().outVal)> | m_shooterSpeedMap |
| Maps a distance to a shooter speed. | |
| argos_lib::InterpolationMap< decltype(shooterRange::feederAngle.front().inVal), shooterRange::feederAngle.size(), decltype(shooterRange::feederAngle.front().outVal)> | m_feederAngleMap |
| Maps a distance to a feeder pitch angle. | |
| argos_lib::NTSubscriber | m_primaryCameraFrameUpdateSubscriber |
| Subscriber to manage all updates from primary camera. | |
| argos_lib::NTSubscriber | m_secondaryCameraFrameUpdateSubscriber |
| Subscriber to manage all updates from secondary camera. | |
| std::jthread | m_yawUpdateThread |
| wpi::log::StructLogEntry< frc::Pose2d > | m_frontCameraMegaTag2PoseLogger |
| wpi::log::StructLogEntry< frc::Pose2d > | m_rearCameraMegaTag2PoseLogger |
Static Private Attributes | |
| static constexpr char | primaryCameraTableName [12] {"/limelight"} |
| static constexpr char | secondaryCameraTableName [18] {"/limelight-front"} |
|
strong |
| VisionSubsystem::VisionSubsystem | ( | const argos_lib::RobotInstance | instance, |
| SwerveDriveSubsystem * | pDriveSubsystem, | ||
| ShooterSubsystem * | pShooterSubsytem | ||
| ) |
| void VisionSubsystem::Disable | ( | ) |
it disables (duh)
| std::optional< units::inch_t > VisionSubsystem::GetCalculatedDistanceToSpeaker | ( | ) |
Get the distance to the tag calculated with the Ty (vertical offset)
| std::optional< units::inch_t > VisionSubsystem::GetDistanceToSpeaker | ( | ) |
Get the distance to the tag.
| std::optional< units::inch_t > VisionSubsystem::GetDistanceToStageCenter | ( | ) |
| std::optional< units::inch_t > VisionSubsystem::GetDistanceToTrap | ( | ) |
| units::degree_t VisionSubsystem::getFeederAngle | ( | ) |
| std::optional< units::degree_t > VisionSubsystem::getFeederAngleWithInertia | ( | double | medialSpeedPct | ) |
| std::optional< units::degree_t > VisionSubsystem::getFeederOffset | ( | ) |
| std::optional< double > VisionSubsystem::getFeedOffsetWithInertia | ( | double | lateralSpeedPct | ) |
| std::optional< units::degree_t > VisionSubsystem::GetHorizontalOffsetToTarget | ( | ) |
Get the current offset to the retroreflective tape.
| std::optional< units::degree_t > VisionSubsystem::GetHorizontalOffsetToTrap | ( | ) |
| std::optional< units::degree_t > VisionSubsystem::GetOrientationToSpeaker | ( | ) |
Get the distance to the tag.
| std::optional< units::degree_t > VisionSubsystem::GetOrientationToTrap | ( | ) |
| LimelightTarget::tValues VisionSubsystem::GetPrimaryCameraTargetValues | ( | ) |
Get the robot poses and latencies.
| std::optional< double > VisionSubsystem::getRotationSpeedWithInertia | ( | double | lateralSpeedPct | ) |
| LimelightTarget::tValues VisionSubsystem::GetSecondaryCameraTargetValues | ( | ) |
Get the robot poses and latencies from secondary camera.
| std::optional< LimelightTarget::tValues > VisionSubsystem::GetSeeingCamera | ( | bool | forFeeder = false | ) |
| std::optional< units::degree_t > VisionSubsystem::getShooterAngle | ( | ) |
| units::degree_t VisionSubsystem::getShooterAngle | ( | units::inch_t | distance, |
| const InterpolationMode | mode | ||
| ) |
| std::optional< units::degree_t > VisionSubsystem::getShooterAngleWithInertia | ( | double | medialSpeedPct | ) |
| std::optional< units::degree_t > VisionSubsystem::getShooterOffset | ( | ) |
| std::optional< units::angular_velocity::revolutions_per_minute_t > VisionSubsystem::getShooterSpeed | ( | ) |
| units::angular_velocity::revolutions_per_minute_t VisionSubsystem::getShooterSpeed | ( | const units::inch_t | distance, |
| const InterpolationMode | mode | ||
| ) | const |
| std::optional< whichCamera > VisionSubsystem::getWhichCamera | ( | bool | forFeeder = false | ) |
| bool VisionSubsystem::IsAimWhileMoveActive | ( | ) |
| bool VisionSubsystem::IsOdometryAimingActive | ( | ) |
| bool VisionSubsystem::IsStaticRotationEnabled | ( | ) |
|
override |
Will be called periodically whenever the CommandScheduler runs.
| void VisionSubsystem::RequestFilterReset | ( | ) |
| void VisionSubsystem::SetAimWhileMove | ( | bool | val | ) |
| void VisionSubsystem::SetEnableStaticRotation | ( | bool | val | ) |
| void VisionSubsystem::SetOdometryAiming | ( | bool | val | ) |
| void VisionSubsystem::SetPipeline | ( | uint16_t | tag | ) |
|
private |
|
private |
Interface to limelight camera.
|
private |
true if you want to rotate in the absence of translation input
|
private |
Maps a distance to a feeder pitch angle.
|
private |
|
private |
Contains either the competition bot or practice bot. Differentiates between the two.
|
private |
true if aiming trigger is pressed and locked
|
private |
true if we want to aim without vision
|
private |
The old robot poses and latencies.
|
private |
Pointer to drivetrain for reading some odometry.
|
private |
Subscriber to manage all updates from primary camera.
|
private |
Pointer to shooter subsystem for reading aiming mode.
|
private |
|
private |
Subscriber to manage all updates from secondary camera.
|
private |
Maps a distance to a shooter pitch angle.
|
private |
Maps a distance to a shooter speed.
|
private |
specifies whether to use the polynomial to obtain shooter angle
|
private |
specifies whether to use the trigonometry to obtain shooter angle
|
private |
|
staticconstexprprivate |
|
staticconstexprprivate |