YAMS
Yet Another Mechanism System
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
yams::mechanisms::swerve::SwerveModuleVelocityWithAzimuth Struct Reference

#include <SwerveModuleVelocityWithAzimuth.hpp>

Inheritance diagram for yams::mechanisms::swerve::SwerveModuleVelocityWithAzimuth:
Inheritance graph
[legend]
Collaboration diagram for yams::mechanisms::swerve::SwerveModuleVelocityWithAzimuth:
Collaboration graph
[legend]

Public Member Functions

 SwerveModuleVelocityWithAzimuth ()=default
 
 SwerveModuleVelocityWithAzimuth (wpi::units::meters_per_second_t velocity, wpi::math::Rotation2d angle, wpi::units::radians_per_second_t azimuthVelocity)
 

Static Public Member Functions

static wpi::math::SwerveModuleVelocity Optimize (const wpi::math::SwerveModuleVelocity &desired, const SwerveModuleVelocityWithAzimuth &measured, const std::optional< wpi::math::Rotation2d > &lastCommanded, wpi::units::degree_t hysteresis=wpi::units::degree_t{30})
 

Public Attributes

wpi::units::radians_per_second_t azimuthVelocity {0}
 

Detailed Description

A swerve module velocity that also carries how fast the azimuth is turning.

Constructor & Destructor Documentation

◆ SwerveModuleVelocityWithAzimuth() [1/2]

yams::mechanisms::swerve::SwerveModuleVelocityWithAzimuth::SwerveModuleVelocityWithAzimuth ( )
default

◆ SwerveModuleVelocityWithAzimuth() [2/2]

yams::mechanisms::swerve::SwerveModuleVelocityWithAzimuth::SwerveModuleVelocityWithAzimuth ( wpi::units::meters_per_second_t  velocity,
wpi::math::Rotation2d  angle,
wpi::units::radians_per_second_t  azimuthVelocity 
)
inline
Parameters
velocityWheel velocity.
angleAzimuth angle.
azimuthVelocityHow fast the azimuth is turning.

Member Function Documentation

◆ Optimize()

static wpi::math::SwerveModuleVelocity yams::mechanisms::swerve::SwerveModuleVelocityWithAzimuth::Optimize ( const wpi::math::SwerveModuleVelocity &  desired,
const SwerveModuleVelocityWithAzimuth &  measured,
const std::optional< wpi::math::Rotation2d > &  lastCommanded,
wpi::units::degree_t  hysteresis = wpi::units::degree_t{30} 
)
inlinestatic

Optimize a desired state against the measured one, keeping the orientation the wheel was last sent to unless the other is better by more than the hysteresis. Without it a wheel that is still turning reverses back and forth as the target moves across the 90 degree boundary.

Parameters
desiredDesired state.
measuredMeasured state.
lastCommandedAngle the wheel was last sent to, if any.
hysteresisHow much better the other orientation must be before the wheel reverses.
Returns
The optimized state.

Member Data Documentation

◆ azimuthVelocity

wpi::units::radians_per_second_t yams::mechanisms::swerve::SwerveModuleVelocityWithAzimuth::azimuthVelocity {0}

How fast the azimuth is turning.


The documentation for this struct was generated from the following file: