mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpimath] Fix C++ pose estimator poseEstimate initialization (#7249)
This commit is contained in:
@@ -45,6 +45,9 @@ class WPILIB_DLLEXPORT PoseEstimator {
|
||||
/**
|
||||
* Constructs a PoseEstimator.
|
||||
*
|
||||
* @warning The initial pose estimate will always be the default pose,
|
||||
* regardless of the odometry's current pose.
|
||||
*
|
||||
* @param kinematics A correctly-configured kinematics object for your
|
||||
* drivetrain.
|
||||
* @param odometry A correctly-configured odometry object for your drivetrain.
|
||||
@@ -60,7 +63,7 @@ class WPILIB_DLLEXPORT PoseEstimator {
|
||||
Odometry<WheelSpeeds, WheelPositions>& odometry,
|
||||
const wpi::array<double, 3>& stateStdDevs,
|
||||
const wpi::array<double, 3>& visionMeasurementStdDevs)
|
||||
: m_odometry(odometry), m_poseEstimate(m_odometry.GetPose()) {
|
||||
: m_odometry(odometry) {
|
||||
for (size_t i = 0; i < 3; ++i) {
|
||||
m_q[i] = stateStdDevs[i] * stateStdDevs[i];
|
||||
}
|
||||
|
||||
@@ -85,7 +85,9 @@ class SwerveDrivePoseEstimator
|
||||
: PoseEstimator<wpi::array<SwerveModuleState, NumModules>,
|
||||
wpi::array<SwerveModulePosition, NumModules>>(
|
||||
kinematics, m_odometryImpl, stateStdDevs, visionMeasurementStdDevs),
|
||||
m_odometryImpl{kinematics, gyroAngle, modulePositions, initialPose} {}
|
||||
m_odometryImpl{kinematics, gyroAngle, modulePositions, initialPose} {
|
||||
this->ResetPose(initialPose);
|
||||
}
|
||||
|
||||
private:
|
||||
SwerveDriveOdometry<NumModules> m_odometryImpl;
|
||||
|
||||
Reference in New Issue
Block a user