revrobotics / maxswerve-cpp-template Goto Github PK
View Code? Open in Web Editor NEWLicense: BSD 3-Clause "New" or "Revised" License
License: BSD 3-Clause "New" or "Revised" License
The order in which the swerve modules are passed to the odometry update function are in a different order then they are create in the SwerveDriveKinematics object.
They are created with the order of front left, front right, rear left, rear right.
frc::SwerveDriveKinematics<4> kDriveKinematics{
frc::Translation2d{DriveConstants::kWheelBase / 2, DriveConstants::kTrackWidth / 2},
frc::Translation2d{DriveConstants::kWheelBase / 2, -DriveConstants::kTrackWidth / 2},
frc::Translation2d{-DriveConstants::kWheelBase / 2, DriveConstants::kTrackWidth / 2},
frc::Translation2d{-DriveConstants::kWheelBase / 2, -DriveConstants::kTrackWidth / 2}};
When the odometry is updated, they are passed in the order front left, rear left, front right, rear right:
m_odometry.Update(frc::Rotation2d(units::radian_t{ m_gyro.GetAngle(frc::ADIS16470_IMU::IMUAxis::kZ)}),
{m_frontLeft.GetPosition(), m_rearLeft.GetPosition(),
m_frontRight.GetPosition(), m_rearRight.GetPosition()});
wpilib documentation states the below about the modulePositions parameter:
◆ Update()
template<size_t NumModules>
const Pose2d & frc::SwerveDriveOdometry< NumModules >::Update ( const Rotation2d & gyroAngle,
const wpi::array< SwerveModulePosition, NumModules > & modulePositions
)
inline
Updates the robot's position on the field using forward kinematics and integration of the pose over time.
This also takes in an angle parameter which is used instead of the angular rate that is calculated from forward kinematics.
Parameters
gyroAngle The angle reported by the gyroscope.
modulePositions The current position of all swerve modules. Please provide the positions in the same order in which you instantiated your SwerveDriveKinematics.
Returns
The new pose of the robot.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.