mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
[wpilib] Add mechanism specific SetState overloads to physics sims (#5534)
This commit is contained in:
@@ -48,6 +48,17 @@ class DCMotorSim : public LinearSystemSim<2, 1, 2> {
|
||||
units::kilogram_square_meter_t moi,
|
||||
const std::array<double, 2>& measurementStdDevs = {0.0, 0.0});
|
||||
|
||||
using LinearSystemSim::SetState;
|
||||
|
||||
/**
|
||||
* Sets the state of the DC motor.
|
||||
*
|
||||
* @param angularPosition The new position
|
||||
* @param angularVelocity The new velocity
|
||||
*/
|
||||
void SetState(units::radian_t angularPosition,
|
||||
units::radians_per_second_t angularVelocity);
|
||||
|
||||
/**
|
||||
* Returns the DC motor position.
|
||||
*
|
||||
|
||||
@@ -65,6 +65,16 @@ class ElevatorSim : public LinearSystemSim<2, 1, 1> {
|
||||
bool simulateGravity, units::meter_t startingHeight,
|
||||
const std::array<double, 1>& measurementStdDevs = {0.0});
|
||||
|
||||
using LinearSystemSim::SetState;
|
||||
|
||||
/**
|
||||
* Sets the elevator's state. The new position will be limited between the
|
||||
* minimum and maximum allowed heights.
|
||||
* @param position The new position
|
||||
* @param velocity The new velocity
|
||||
*/
|
||||
void SetState(units::meter_t position, units::meters_per_second_t velocity);
|
||||
|
||||
/**
|
||||
* Returns whether the elevator would hit the lower limit.
|
||||
*
|
||||
|
||||
@@ -47,6 +47,15 @@ class FlywheelSim : public LinearSystemSim<1, 1, 1> {
|
||||
units::kilogram_square_meter_t moi,
|
||||
const std::array<double, 1>& measurementStdDevs = {0.0});
|
||||
|
||||
using LinearSystemSim::SetState;
|
||||
|
||||
/**
|
||||
* Sets the flywheel's state.
|
||||
*
|
||||
* @param velocity The new velocity
|
||||
*/
|
||||
void SetState(units::radians_per_second_t velocity);
|
||||
|
||||
/**
|
||||
* Returns the flywheel velocity.
|
||||
*
|
||||
|
||||
@@ -64,6 +64,17 @@ class SingleJointedArmSim : public LinearSystemSim<2, 1, 1> {
|
||||
units::radian_t startingAngle,
|
||||
const std::array<double, 1>& measurementStdDevs = {0.0});
|
||||
|
||||
using LinearSystemSim::SetState;
|
||||
|
||||
/**
|
||||
* Sets the arm's state. The new angle will be limited between the minimum and
|
||||
* maximum allowed limits.
|
||||
*
|
||||
* @param angle The new angle.
|
||||
* @param velocity The new angular velocity.
|
||||
*/
|
||||
void SetState(units::radian_t angle, units::radians_per_second_t velocity);
|
||||
|
||||
/**
|
||||
* Returns whether the arm would hit the lower limit.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user