2020-12-26 14:12:05 -08:00
|
|
|
// 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.
|
2019-09-28 18:40:56 -04:00
|
|
|
|
|
|
|
|
#include "frc/trajectory/constraint/DifferentialDriveKinematicsConstraint.h"
|
|
|
|
|
|
|
|
|
|
using namespace frc;
|
|
|
|
|
|
|
|
|
|
DifferentialDriveKinematicsConstraint::DifferentialDriveKinematicsConstraint(
|
2020-08-19 22:36:58 -04:00
|
|
|
const DifferentialDriveKinematics& kinematics,
|
|
|
|
|
units::meters_per_second_t maxSpeed)
|
2019-09-28 18:40:56 -04:00
|
|
|
: m_kinematics(kinematics), m_maxSpeed(maxSpeed) {}
|
|
|
|
|
|
|
|
|
|
units::meters_per_second_t DifferentialDriveKinematicsConstraint::MaxVelocity(
|
2020-03-23 01:57:52 -04:00
|
|
|
const Pose2d& pose, units::curvature_t curvature,
|
2020-04-14 01:32:25 -04:00
|
|
|
units::meters_per_second_t velocity) const {
|
2019-09-28 18:40:56 -04:00
|
|
|
auto wheelSpeeds =
|
|
|
|
|
m_kinematics.ToWheelSpeeds({velocity, 0_mps, velocity * curvature});
|
|
|
|
|
wheelSpeeds.Normalize(m_maxSpeed);
|
|
|
|
|
|
|
|
|
|
return m_kinematics.ToChassisSpeeds(wheelSpeeds).vx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TrajectoryConstraint::MinMax
|
|
|
|
|
DifferentialDriveKinematicsConstraint::MinMaxAcceleration(
|
2020-03-23 01:57:52 -04:00
|
|
|
const Pose2d& pose, units::curvature_t curvature,
|
2020-04-14 01:32:25 -04:00
|
|
|
units::meters_per_second_t speed) const {
|
2019-09-28 18:40:56 -04:00
|
|
|
return {};
|
|
|
|
|
}
|