WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
frc::SwerveDriveOdometry3d< NumModules > Class Template Reference

Class for swerve drive odometry. More...

#include <frc/kinematics/SwerveDriveOdometry3d.h>

Inheritance diagram for frc::SwerveDriveOdometry3d< NumModules >:
frc::Odometry3d< wpi::array< SwerveModuleState, NumModules >, wpi::array< SwerveModulePosition, NumModules > >

Public Member Functions

 SwerveDriveOdometry3d (SwerveDriveKinematics< NumModules > kinematics, const Rotation3d &gyroAngle, const wpi::array< SwerveModulePosition, NumModules > &modulePositions, const Pose3d &initialPose=Pose3d{})
 Constructs a SwerveDriveOdometry3d object.
 
- Public Member Functions inherited from frc::Odometry3d< wpi::array< SwerveModuleState, NumModules >, wpi::array< SwerveModulePosition, NumModules > >
 Odometry3d (const Kinematics< wpi::array< SwerveModuleState, NumModules >, wpi::array< SwerveModulePosition, NumModules > > &kinematics, const Rotation3d &gyroAngle, const wpi::array< SwerveModulePosition, NumModules > &wheelPositions, const Pose3d &initialPose=Pose3d{})
 Constructs an Odometry3d object.
 
void ResetPosition (const Rotation3d &gyroAngle, const wpi::array< SwerveModulePosition, NumModules > &wheelPositions, const Pose3d &pose)
 Resets the robot's position on the field.
 
void ResetPose (const Pose3d &pose)
 Resets the pose.
 
void ResetTranslation (const Translation3d &translation)
 Resets the translation of the pose.
 
void ResetRotation (const Rotation3d &rotation)
 Resets the rotation of the pose.
 
const Pose3dGetPose () const
 Returns the position of the robot on the field.
 
const Pose3dUpdate (const Rotation3d &gyroAngle, const wpi::array< SwerveModulePosition, NumModules > &wheelPositions)
 Updates the robot's position on the field using forward kinematics and integration of the pose over time.
 

Detailed Description

template<size_t NumModules>
class frc::SwerveDriveOdometry3d< NumModules >

Class for swerve drive odometry.

Odometry allows you to track the robot's position on the field over a course of a match using readings from your swerve drive encoders and swerve azimuth encoders.

Teams can use odometry during the autonomous period for complex tasks like path following. Furthermore, odometry can be used for latency compensation when using computer-vision systems.

Constructor & Destructor Documentation

◆ SwerveDriveOdometry3d()

template<size_t NumModules>
frc::SwerveDriveOdometry3d< NumModules >::SwerveDriveOdometry3d ( SwerveDriveKinematics< NumModules > kinematics,
const Rotation3d & gyroAngle,
const wpi::array< SwerveModulePosition, NumModules > & modulePositions,
const Pose3d & initialPose = Pose3d{} )
inline

Constructs a SwerveDriveOdometry3d object.

Parameters
kinematicsThe swerve drive kinematics for your drivetrain.
gyroAngleThe angle reported by the gyroscope.
modulePositionsThe wheel positions reported by each module.
initialPoseThe starting position of the robot on the field.

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