Resurgence (PY2022)
Codebase for the Husky Robotics 2021-2022 rover Resurgence
Loading...
Searching...
No Matches
kinematics::SwerveDriveKinematics Class Reference

Calculates forward and inverse drivebase kinematics for a 4-wheel swerve drivebase with specifiable width and length. More...

#include <SwerveDriveKinematics.h>

Public Member Functions

 SwerveDriveKinematics (double baseWidth, double baseLength)
 Create a new SwerveDriveKinematics with the given wheel base width and length from rear of robot.
 
swervewheelvel_t robotVelToWheelVel (double xVel, double yVel, double thetaVel) const
 Given the robot's translational and angular velocity in the robot's reference frame, find the speeds and angles of the robot's wheels in the robot's reference frame.
 
navtypes::pose_t wheelVelToRobotVel (swervewheelvel_t wheelVel) const
 Given the speeds and angles of the robot's wheels in the robot's reference frame, find the robot's translational velocity and angular velocity in the robot's reference frame.
 
navtypes::pose_t getLocalPoseUpdate (const swervewheelvel_t &wheelVel, double dt) const
 Calculate the pose update in the local reference frame given the velocities of the robot's wheels and the time step.
 
navtypes::pose_t getPoseUpdate (const swervewheelvel_t &wheelVel, double heading, double dt) const
 Calculate the pose update in the global reference frame given the velocities of the robot's wheels and the time step.
 
navtypes::pose_t getNextPose (const swervewheelvel_t &wheelVel, const navtypes::pose_t &pose, double dt) const
 Calculate the next pose of the robot in the global reference frame.
 

Detailed Description

Calculates forward and inverse drivebase kinematics for a 4-wheel swerve drivebase with specifiable width and length.

Constructor & Destructor Documentation

◆ SwerveDriveKinematics()

kinematics::SwerveDriveKinematics::SwerveDriveKinematics ( double baseWidth,
double baseLength )
explicit

Create a new SwerveDriveKinematics with the given wheel base width and length from rear of robot.

Parameters
baseWidthThe width of the wheelbase. The units themselves don't matter, as long as you're consistent.
baseLengthThe length of the wheelbase. The units themselves don't matter, as long as you're consistent.

Member Function Documentation

◆ getLocalPoseUpdate()

pose_t kinematics::SwerveDriveKinematics::getLocalPoseUpdate ( const swervewheelvel_t & wheelVel,
double dt ) const

Calculate the pose update in the local reference frame given the velocities of the robot's wheels and the time step.

Parameters
wheelVelThe velocities of the wheels.
dtThe elapsed time in seconds for which the update is calculated. The robot has been moving at the specified velocity for this much time.
Returns
The pose update in the robot's local reference frame.

◆ getNextPose()

pose_t kinematics::SwerveDriveKinematics::getNextPose ( const swervewheelvel_t & wheelVel,
const navtypes::pose_t & pose,
double dt ) const

Calculate the next pose of the robot in the global reference frame.

(map space)

Parameters
wheelVelThe velocities of the wheels.
poseThe current pose of the robot, in the global reference frame.
dtThe elapsed time in seconds for which the update is calculated. The robot has been moving at the specified velocity for this much time.
Returns
The next pose of the robot in the global reference frame after having moved at the specified velocity for the specified time.

◆ getPoseUpdate()

pose_t kinematics::SwerveDriveKinematics::getPoseUpdate ( const swervewheelvel_t & wheelVel,
double heading,
double dt ) const

Calculate the pose update in the global reference frame given the velocities of the robot's wheels and the time step.

Parameters
wheelVelThe velocities of the wheels.
headingThe heading of the robot, in radians.
dtThe elapsed time in seconds for which the update is calculated. The robot has been moving at the specified velocity for this much time.
Returns
The pose update in the global reference frame.

◆ robotVelToWheelVel()

swervewheelvel_t kinematics::SwerveDriveKinematics::robotVelToWheelVel ( double xVel,
double yVel,
double thetaVel ) const

Given the robot's translational and angular velocity in the robot's reference frame, find the speeds and angles of the robot's wheels in the robot's reference frame.

Parameters
xVelthe forward velocity component of the robot, in the robot's reference frame. (positive = front)
yVelthe left/right velocity component of the robot, in the robot's reference frame. (positive = left)
thetaVelthe angular velocity of the robot in the robot's reference frame, in rad/sec. (positive = CCW)
Returns
the speeds and angles of the robot's wheels in the robot's reference frame.

◆ wheelVelToRobotVel()

pose_t kinematics::SwerveDriveKinematics::wheelVelToRobotVel ( swervewheelvel_t wheelVel) const

Given the speeds and angles of the robot's wheels in the robot's reference frame, find the robot's translational velocity and angular velocity in the robot's reference frame.

Parameters
wheelVelthe struct containing the speeds and angles of the robot's wheels in the robot's reference frame.
Returns
the robot's translational and angular velocity in the robot's reference frame.

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