2024-Robot
Robot code for 2024 FRC season by Argos, FRC team #1756
Loading...
Searching...
No Matches
AutoAimCommand Class Reference

#include <auto_aim_command.h>

Inheritance diagram for AutoAimCommand:

Classes

struct  AimParams
 

Public Member Functions

 AutoAimCommand (SwerveDriveSubsystem *swerveDrive, ShooterSubsystem *shooter, ElevatorSubsystem *elevator, VisionSubsystem *vision, argos_lib::SwappableControllersSubsystem *controllers, SimpleLedSubsystem *leds, bool endWhenAimed=false)
 
void Initialize () override
 
void Execute () override
 
void End (bool interrupted) override
 
bool IsFinished () override
 

Private Member Functions

std::optional< AimParamsGetAimParams ()
 Read latest vision targets from vision subsystem and generate parameters useful for aiming.
 
std::optional< units::degree_t > GetAdjustmentOffset (const std::optional< AimParams > &params)
 Calculate angle offset to aim toward vision target.
 
bool Aimed (const std::optional< AimParams > &params)
 Check if robot is currently aimed at vision target.
 
bool Aim (const std::optional< AimParams > &params)
 Aim at vision target.
 
void SetOperatorFeedback (const std::optional< AimParams > &params)
 Set LEDs and vibration based on aiming status.
 

Private Attributes

SwerveDriveSubsystemm_pSwerveDrive
 
ShooterSubsystemm_pShooter
 
ElevatorSubsystemm_pElevator
 
VisionSubsystemm_pVision
 
argos_lib::SwappableControllersSubsystemm_pControllers
 
SimpleLedSubsystemm_pLeds
 
bool m_endWhenAimed
 
argos_lib::Debouncer m_aimedDebouncer
 
std::chrono::time_point< std::chrono::steady_clock > m_startTime
 

Detailed Description

Constructor & Destructor Documentation

◆ AutoAimCommand()

AutoAimCommand::AutoAimCommand ( SwerveDriveSubsystem swerveDrive,
ShooterSubsystem shooter,
ElevatorSubsystem elevator,
VisionSubsystem vision,
argos_lib::SwappableControllersSubsystem controllers,
SimpleLedSubsystem leds,
bool  endWhenAimed = false 
)

Member Function Documentation

◆ Aim()

bool AutoAimCommand::Aim ( const std::optional< AimParams > &  params)
private

Aim at vision target.

Parameters
paramsAiming parameters generated from vision subsystem
Returns
true indicates robot is aimed, false if not aimed or no target found

◆ Aimed()

bool AutoAimCommand::Aimed ( const std::optional< AimParams > &  params)
private

Check if robot is currently aimed at vision target.

Parameters
paramsAiming parameters generated from vision subsystem
Returns
true indicates robot is aimed, false if not aimed or no target found

◆ End()

void AutoAimCommand::End ( bool  interrupted)
override

◆ Execute()

void AutoAimCommand::Execute ( )
override

◆ GetAdjustmentOffset()

std::optional< units::degree_t > AutoAimCommand::GetAdjustmentOffset ( const std::optional< AimParams > &  params)
private

Calculate angle offset to aim toward vision target.

Parameters
paramsAiming parameters generated from vision subsystem
Returns
std::nullopt if no target found, otherwise offset angle

◆ GetAimParams()

std::optional< AutoAimCommand::AimParams > AutoAimCommand::GetAimParams ( )
private

Read latest vision targets from vision subsystem and generate parameters useful for aiming.

Returns
std::nullopt if no target found, otherwise parameters for aiming to vision target

◆ Initialize()

void AutoAimCommand::Initialize ( )
override

◆ IsFinished()

bool AutoAimCommand::IsFinished ( )
override

◆ SetOperatorFeedback()

void AutoAimCommand::SetOperatorFeedback ( const std::optional< AimParams > &  params)
private

Set LEDs and vibration based on aiming status.

Parameters
paramsAiming parameters generated from vision subsystem

Member Data Documentation

◆ m_aimedDebouncer

argos_lib::Debouncer AutoAimCommand::m_aimedDebouncer
private

◆ m_endWhenAimed

bool AutoAimCommand::m_endWhenAimed
private

◆ m_pControllers

argos_lib::SwappableControllersSubsystem* AutoAimCommand::m_pControllers
private

◆ m_pElevator

ElevatorSubsystem* AutoAimCommand::m_pElevator
private

◆ m_pLeds

SimpleLedSubsystem* AutoAimCommand::m_pLeds
private

◆ m_pShooter

ShooterSubsystem* AutoAimCommand::m_pShooter
private

◆ m_pSwerveDrive

SwerveDriveSubsystem* AutoAimCommand::m_pSwerveDrive
private

◆ m_pVision

VisionSubsystem* AutoAimCommand::m_pVision
private

◆ m_startTime

std::chrono::time_point<std::chrono::steady_clock> AutoAimCommand::m_startTime
private

The documentation for this class was generated from the following files: