mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[wpimath] Add 3D odometry and pose estimation (#7119)
This commit is contained in:
@@ -11,9 +11,8 @@ using namespace frc;
|
||||
DifferentialDriveOdometry::DifferentialDriveOdometry(
|
||||
const Rotation2d& gyroAngle, units::meter_t leftDistance,
|
||||
units::meter_t rightDistance, const Pose2d& initialPose)
|
||||
: Odometry<DifferentialDriveWheelSpeeds, DifferentialDriveWheelPositions>(
|
||||
m_kinematicsImpl, gyroAngle, {leftDistance, rightDistance},
|
||||
initialPose) {
|
||||
: Odometry(m_kinematicsImpl, gyroAngle, {leftDistance, rightDistance},
|
||||
initialPose) {
|
||||
wpi::math::MathSharedStore::ReportUsage(
|
||||
wpi::math::MathUsageId::kOdometry_DifferentialDrive, 1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include "frc/kinematics/DifferentialDriveOdometry3d.h"
|
||||
|
||||
#include "wpimath/MathShared.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
DifferentialDriveOdometry3d::DifferentialDriveOdometry3d(
|
||||
const Rotation3d& gyroAngle, units::meter_t leftDistance,
|
||||
units::meter_t rightDistance, const Pose3d& initialPose)
|
||||
: Odometry3d(m_kinematicsImpl, gyroAngle, {leftDistance, rightDistance},
|
||||
initialPose) {
|
||||
wpi::math::MathSharedStore::ReportUsage(
|
||||
wpi::math::MathUsageId::kOdometry_DifferentialDrive, 1);
|
||||
}
|
||||
@@ -11,8 +11,7 @@ using namespace frc;
|
||||
MecanumDriveOdometry::MecanumDriveOdometry(
|
||||
MecanumDriveKinematics kinematics, const Rotation2d& gyroAngle,
|
||||
const MecanumDriveWheelPositions& wheelPositions, const Pose2d& initialPose)
|
||||
: Odometry<MecanumDriveWheelSpeeds, MecanumDriveWheelPositions>(
|
||||
m_kinematicsImpl, gyroAngle, wheelPositions, initialPose),
|
||||
: Odometry(m_kinematicsImpl, gyroAngle, wheelPositions, initialPose),
|
||||
m_kinematicsImpl(kinematics) {
|
||||
wpi::math::MathSharedStore::ReportUsage(
|
||||
wpi::math::MathUsageId::kOdometry_MecanumDrive, 1);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include "frc/kinematics/MecanumDriveOdometry3d.h"
|
||||
|
||||
#include "wpimath/MathShared.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
MecanumDriveOdometry3d::MecanumDriveOdometry3d(
|
||||
MecanumDriveKinematics kinematics, const Rotation3d& gyroAngle,
|
||||
const MecanumDriveWheelPositions& wheelPositions, const Pose3d& initialPose)
|
||||
: Odometry3d(m_kinematicsImpl, gyroAngle, wheelPositions, initialPose),
|
||||
m_kinematicsImpl(kinematics) {
|
||||
wpi::math::MathSharedStore::ReportUsage(
|
||||
wpi::math::MathUsageId::kOdometry_MecanumDrive, 1);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include "frc/kinematics/SwerveDriveOdometry3d.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
template class EXPORT_TEMPLATE_DEFINE(WPILIB_DLLEXPORT)
|
||||
SwerveDriveOdometry3d<4>;
|
||||
|
||||
} // namespace frc
|
||||
Reference in New Issue
Block a user