mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpimath] Make feedforward classes throw exceptions for negative Kv or Ka (#6084)
This commit is contained in:
@@ -6,7 +6,12 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <units/velocity.h>
|
||||
#include <units/voltage.h>
|
||||
|
||||
using namespace frc2;
|
||||
using kv_unit = units::compound_unit<units::volts,
|
||||
units::inverse<units::meters_per_second>>;
|
||||
|
||||
MecanumControllerCommand::MecanumControllerCommand(
|
||||
frc::Trajectory trajectory, std::function<frc::Pose2d()> pose,
|
||||
@@ -95,6 +100,7 @@ MecanumControllerCommand::MecanumControllerCommand(
|
||||
Requirements requirements)
|
||||
: m_trajectory(std::move(trajectory)),
|
||||
m_pose(std::move(pose)),
|
||||
m_feedforward(0_V, units::unit_t<kv_unit>{0}),
|
||||
m_kinematics(kinematics),
|
||||
m_controller(xController, yController, thetaController),
|
||||
m_desiredRotation(std::move(desiredRotation)),
|
||||
@@ -116,6 +122,7 @@ MecanumControllerCommand::MecanumControllerCommand(
|
||||
Requirements requirements)
|
||||
: m_trajectory(std::move(trajectory)),
|
||||
m_pose(std::move(pose)),
|
||||
m_feedforward(0_V, units::unit_t<kv_unit>{0}),
|
||||
m_kinematics(kinematics),
|
||||
m_controller(xController, yController, thetaController),
|
||||
m_maxWheelVelocity(maxWheelVelocity),
|
||||
|
||||
@@ -6,9 +6,13 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <units/velocity.h>
|
||||
#include <units/voltage.h>
|
||||
#include <wpi/sendable/SendableBuilder.h>
|
||||
|
||||
using namespace frc2;
|
||||
using kv_unit = units::compound_unit<units::volts,
|
||||
units::inverse<units::meters_per_second>>;
|
||||
|
||||
RamseteCommand::RamseteCommand(
|
||||
frc::Trajectory trajectory, std::function<frc::Pose2d()> pose,
|
||||
@@ -42,6 +46,7 @@ RamseteCommand::RamseteCommand(
|
||||
: m_trajectory(std::move(trajectory)),
|
||||
m_pose(std::move(pose)),
|
||||
m_controller(controller),
|
||||
m_feedforward(0_V, units::unit_t<kv_unit>{0}),
|
||||
m_kinematics(std::move(kinematics)),
|
||||
m_outputVel(std::move(output)),
|
||||
m_usePID(false) {
|
||||
|
||||
Reference in New Issue
Block a user