mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[robotpy] Mirror most other subprojects (#8208)
GitOrigin-RevId: ac60fd3cf4a24023184376687da28373d14b781a This mirrors the robotpy files for the following projects: - apriltag - datalog - hal - ntcore - romiVendordep - wpilibc - wpimath - xrpVendordep This excludes cscore and the halsim wrappers for at this time. NOTE: This does not hook these projects up to the build system, just simply mirrors the files. The building will take place in a follow up PR to make it easier to review the changes necessary to build.
This commit is contained in:
42
wpimath/src/main/python/semiwrap/controls/ArmFeedforward.yml
Normal file
42
wpimath/src/main/python/semiwrap/controls/ArmFeedforward.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
classes:
|
||||
frc::ArmFeedforward:
|
||||
force_type_casters:
|
||||
- units::radians_per_second_squared
|
||||
typealias:
|
||||
- frc::ArmFeedforward::Acceleration
|
||||
- frc::ArmFeedforward::kv_unit
|
||||
- frc::ArmFeedforward::ka_unit
|
||||
methods:
|
||||
ArmFeedforward:
|
||||
overloads:
|
||||
'':
|
||||
units::volt_t, units::volt_t, units::unit_t<kv_unit>, units::unit_t<ka_unit>:
|
||||
Calculate:
|
||||
overloads:
|
||||
units::unit_t<Angle>, units::unit_t<Velocity>, units::unit_t<Acceleration> [const]:
|
||||
ignore: true
|
||||
units::unit_t<Angle>, units::unit_t<Velocity>, units::unit_t<Velocity>, units::second_t [const]:
|
||||
ignore: true
|
||||
units::unit_t<Angle>, units::unit_t<Velocity> [const]:
|
||||
units::unit_t<Angle>, units::unit_t<Velocity>, units::unit_t<Velocity> [const]:
|
||||
MaxAchievableVelocity:
|
||||
MinAchievableVelocity:
|
||||
MaxAchievableAcceleration:
|
||||
MinAchievableAcceleration:
|
||||
GetKs:
|
||||
GetKg:
|
||||
GetKv:
|
||||
GetKa:
|
||||
SetKs:
|
||||
SetKg:
|
||||
SetKv:
|
||||
SetKa:
|
||||
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
inline_code: |
|
||||
SetupWPyStruct<frc::ArmFeedforward>(cls_ArmFeedforward);
|
||||
@@ -0,0 +1,21 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
classes:
|
||||
frc::BangBangController:
|
||||
ignored_bases:
|
||||
- wpi::SendableHelper<BangBangController>
|
||||
methods:
|
||||
BangBangController:
|
||||
SetSetpoint:
|
||||
GetSetpoint:
|
||||
AtSetpoint:
|
||||
SetTolerance:
|
||||
GetTolerance:
|
||||
GetMeasurement:
|
||||
GetError:
|
||||
Calculate:
|
||||
overloads:
|
||||
double, double:
|
||||
double:
|
||||
InitSendable:
|
||||
@@ -0,0 +1,17 @@
|
||||
defaults:
|
||||
subpackage: constraint
|
||||
|
||||
classes:
|
||||
frc::CentripetalAccelerationConstraint:
|
||||
typealias:
|
||||
- frc::TrajectoryConstraint::MinMax
|
||||
methods:
|
||||
CentripetalAccelerationConstraint:
|
||||
MaxVelocity:
|
||||
MinMaxAcceleration:
|
||||
|
||||
inline_code: |-
|
||||
cls_CentripetalAccelerationConstraint
|
||||
.def_static("fromFps", [](units::feet_per_second_squared_t maxCentripetalAcceleration) {
|
||||
return std::make_shared<CentripetalAccelerationConstraint>(maxCentripetalAcceleration);
|
||||
}, py::arg("maxCentripetalAcceleration"));
|
||||
@@ -0,0 +1,46 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
classes:
|
||||
frc::ControlAffinePlantInversionFeedforward:
|
||||
template_params:
|
||||
- int States
|
||||
- int Inputs
|
||||
methods:
|
||||
ControlAffinePlantInversionFeedforward:
|
||||
overloads:
|
||||
std::function<StateVector (const StateVector&, const InputVector&)>, units::second_t:
|
||||
std::function<StateVector (const StateVector&)>, const Matrixd<States, Inputs>&, units::second_t:
|
||||
Uff:
|
||||
overloads:
|
||||
'[const]':
|
||||
int [const]:
|
||||
R:
|
||||
overloads:
|
||||
'[const]':
|
||||
int [const]:
|
||||
Reset:
|
||||
overloads:
|
||||
const StateVector&:
|
||||
'':
|
||||
Calculate:
|
||||
overloads:
|
||||
const StateVector&:
|
||||
const StateVector&, const StateVector&:
|
||||
|
||||
templates:
|
||||
ControlAffinePlantInversionFeedforward_1_1:
|
||||
qualname: frc::ControlAffinePlantInversionFeedforward
|
||||
params:
|
||||
- 1
|
||||
- 1
|
||||
ControlAffinePlantInversionFeedforward_2_1:
|
||||
qualname: frc::ControlAffinePlantInversionFeedforward
|
||||
params:
|
||||
- 2
|
||||
- 1
|
||||
ControlAffinePlantInversionFeedforward_2_2:
|
||||
qualname: frc::ControlAffinePlantInversionFeedforward
|
||||
params:
|
||||
- 2
|
||||
- 2
|
||||
46
wpimath/src/main/python/semiwrap/controls/DCMotor.yml
Normal file
46
wpimath/src/main/python/semiwrap/controls/DCMotor.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
defaults:
|
||||
subpackage: plant
|
||||
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::DCMotor:
|
||||
attributes:
|
||||
nominalVoltage:
|
||||
stallTorque:
|
||||
stallCurrent:
|
||||
freeCurrent:
|
||||
freeSpeed:
|
||||
R:
|
||||
Kv:
|
||||
Kt:
|
||||
methods:
|
||||
DCMotor:
|
||||
Current:
|
||||
overloads:
|
||||
units::radians_per_second_t, units::volt_t [const]:
|
||||
units::newton_meter_t [const]:
|
||||
Torque:
|
||||
Voltage:
|
||||
Speed:
|
||||
WithReduction:
|
||||
CIM:
|
||||
MiniCIM:
|
||||
Bag:
|
||||
Vex775Pro:
|
||||
RS775_125:
|
||||
BanebotsRS775:
|
||||
Andymark9015:
|
||||
BanebotsRS550:
|
||||
NEO:
|
||||
NEO550:
|
||||
Falcon500:
|
||||
Falcon500FOC:
|
||||
RomiBuiltIn:
|
||||
KrakenX60:
|
||||
KrakenX60FOC:
|
||||
NeoVortex:
|
||||
|
||||
inline_code: |
|
||||
SetupWPyStruct<frc::DCMotor>(cls_DCMotor);
|
||||
@@ -0,0 +1,12 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
classes:
|
||||
frc::DifferentialDriveAccelerationLimiter:
|
||||
methods:
|
||||
DifferentialDriveAccelerationLimiter:
|
||||
overloads:
|
||||
LinearSystem<2, 2, 2>, units::meter_t, units::meters_per_second_squared_t, units::radians_per_second_squared_t:
|
||||
? LinearSystem<2, 2, 2>, units::meter_t, units::meters_per_second_squared_t, units::meters_per_second_squared_t, units::radians_per_second_squared_t
|
||||
:
|
||||
Calculate:
|
||||
@@ -0,0 +1,41 @@
|
||||
classes:
|
||||
frc::DifferentialDriveFeedforward:
|
||||
force_type_casters:
|
||||
- units::meters_per_second
|
||||
- units::meters_per_second_squared
|
||||
- units::radians_per_second
|
||||
- units::radians_per_second_squared
|
||||
- units::compound_unit
|
||||
attributes:
|
||||
m_kVLinear:
|
||||
m_kALinear:
|
||||
m_kVAngular:
|
||||
m_kAAngular:
|
||||
methods:
|
||||
DifferentialDriveFeedforward:
|
||||
overloads:
|
||||
decltype(1_V/1_mps), decltype(1_V/1_mps_sq), decltype(1_V/1_rad_per_s), decltype(1_V/1_rad_per_s_sq), units::meter_t:
|
||||
decltype(1_V/1_mps), decltype(1_V/1_mps_sq), decltype(1_V/1_mps), decltype(1_V/1_mps_sq):
|
||||
# ? decltype ( 1 _V / 1 _mps ), decltype ( 1 _V / 1 _mps_sq ), decltype (
|
||||
# 1 _V / 1 _rad_per_s ), decltype ( 1 _V / 1 _rad_per_s_sq ), units::meter_t
|
||||
# :
|
||||
# param_override:
|
||||
# kVLinear:
|
||||
# x_type: decltype(1_V / 1_mps)
|
||||
# kALinear:
|
||||
# x_type: decltype(1_V / 1_mps_sq)
|
||||
# kVAngular:
|
||||
# x_type: decltype(1_V / 1_rad_per_s)
|
||||
# kAAngular:
|
||||
# x_type: decltype(1_V / 1_rad_per_s_sq)
|
||||
# decltype ( 1 _V / 1 _mps ), decltype ( 1 _V / 1 _mps_sq ), decltype ( 1 _V / 1 _mps ), decltype ( 1 _V / 1 _mps_sq ):
|
||||
# param_override:
|
||||
# kVLinear:
|
||||
# x_type: decltype(1_V / 1_mps)
|
||||
# kALinear:
|
||||
# x_type: decltype(1_V / 1_mps_sq)
|
||||
# kVAngular:
|
||||
# x_type: decltype(1_V / 1_mps)
|
||||
# kAAngular:
|
||||
# x_type: decltype(1_V / 1_mps_sq)
|
||||
Calculate:
|
||||
@@ -0,0 +1,19 @@
|
||||
defaults:
|
||||
subpackage: constraint
|
||||
|
||||
classes:
|
||||
frc::DifferentialDriveKinematicsConstraint:
|
||||
typealias:
|
||||
- frc::TrajectoryConstraint::MinMax
|
||||
methods:
|
||||
DifferentialDriveKinematicsConstraint:
|
||||
MaxVelocity:
|
||||
MinMaxAcceleration:
|
||||
|
||||
inline_code: |-
|
||||
cls_DifferentialDriveKinematicsConstraint
|
||||
.def_static("fromFps", [](const DifferentialDriveKinematics& kinematics,
|
||||
units::feet_per_second_t maxSpeed) {
|
||||
return std::make_shared<DifferentialDriveKinematicsConstraint>(kinematics, maxSpeed);
|
||||
}, py::arg("kinematics"), py::arg("maxSpeed"))
|
||||
;
|
||||
@@ -0,0 +1,48 @@
|
||||
defaults:
|
||||
subpackage: estimator
|
||||
|
||||
classes:
|
||||
frc::DifferentialDrivePoseEstimator:
|
||||
force_no_trampoline: true
|
||||
doc: |
|
||||
This class wraps an Unscented Kalman Filter to fuse latency-compensated
|
||||
vision measurements with differential drive encoder measurements. It will
|
||||
correct for noisy vision measurements and encoder drift. It is intended to be
|
||||
an easy drop-in for :class:`DifferentialDriveOdometry`. In fact, if you never call
|
||||
:meth:`addVisionMeasurement`, and only call :meth:`update`, this will behave exactly the
|
||||
same as DifferentialDriveOdometry.
|
||||
|
||||
:meth:`update` should be called every robot loop (if your robot loops are faster or
|
||||
slower than the default, then you should change the nominal delta time via
|
||||
the constructor).
|
||||
|
||||
:meth:`addVisionMeasurement` can be called as infrequently as you want; if you
|
||||
never call it, then this class will behave like regular encoder odometry.
|
||||
|
||||
The state-space system used internally has the following states (x), inputs
|
||||
(u), and outputs (y):
|
||||
|
||||
:math:`x = [x, y, \theta, dist_l, dist_r]^T` in the field coordinate
|
||||
system containing x position, y position, heading, left encoder distance,
|
||||
and right encoder distance.
|
||||
|
||||
:math:`u = [v_l, v_r, d\theta]^T` containing left wheel velocity,
|
||||
right wheel velocity, and change in gyro heading.
|
||||
|
||||
NB: Using velocities make things considerably easier, because it means that
|
||||
teams don't have to worry about getting an accurate model. Basically, we
|
||||
suspect that it's easier for teams to get good encoder data than it is for
|
||||
them to perform system identification well enough to get a good model.
|
||||
|
||||
:math:`y = [x, y, \theta]^T` from vision containing x position, y
|
||||
position, and heading; or :math:`y = [dist_l, dist_r, \theta]^T`
|
||||
containing left encoder position, right encoder position, and gyro heading.
|
||||
methods:
|
||||
DifferentialDrivePoseEstimator:
|
||||
overloads:
|
||||
DifferentialDriveKinematics&, const Rotation2d&, units::meter_t, units::meter_t, const Pose2d&:
|
||||
? DifferentialDriveKinematics&, const Rotation2d&, units::meter_t, units::meter_t, const Pose2d&, const wpi::array<double, 3>&, const wpi::array<double, 3>&
|
||||
:
|
||||
ResetPosition:
|
||||
Update:
|
||||
UpdateWithTime:
|
||||
@@ -0,0 +1,15 @@
|
||||
defaults:
|
||||
subpackage: estimator
|
||||
|
||||
classes:
|
||||
frc::DifferentialDrivePoseEstimator3d:
|
||||
force_no_trampoline: true
|
||||
methods:
|
||||
DifferentialDrivePoseEstimator3d:
|
||||
overloads:
|
||||
DifferentialDriveKinematics&, const Rotation3d&, units::meter_t, units::meter_t, const Pose3d&:
|
||||
? DifferentialDriveKinematics&, const Rotation3d&, units::meter_t, units::meter_t, const Pose3d&, const wpi::array<double, 4>&, const wpi::array<double, 4>&
|
||||
:
|
||||
ResetPosition:
|
||||
Update:
|
||||
UpdateWithTime:
|
||||
@@ -0,0 +1,11 @@
|
||||
defaults:
|
||||
subpackage: constraint
|
||||
|
||||
classes:
|
||||
frc::DifferentialDriveVoltageConstraint:
|
||||
typealias:
|
||||
- frc::TrajectoryConstraint::MinMax
|
||||
methods:
|
||||
DifferentialDriveVoltageConstraint:
|
||||
MaxVelocity:
|
||||
MinMaxAcceleration:
|
||||
@@ -0,0 +1,26 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
|
||||
classes:
|
||||
frc::DifferentialDriveWheelVoltages:
|
||||
force_no_default_constructor: true
|
||||
attributes:
|
||||
left:
|
||||
right:
|
||||
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
inline_code: |
|
||||
cls_DifferentialDriveWheelVoltages
|
||||
.def(py::init<units::volt_t, units::volt_t>(),
|
||||
py::arg("left") = 0, py::arg("right") = 0)
|
||||
.def("__repr__", [](const DifferentialDriveWheelVoltages *self) {
|
||||
return "DifferentialDriveWheelVoltages("
|
||||
"left=" + std::to_string(self->left()) + ","
|
||||
"right=" + std::to_string(self->right()) + ")";
|
||||
})
|
||||
;
|
||||
|
||||
SetupWPyStruct<frc::DifferentialDriveWheelVoltages>(cls_DifferentialDriveWheelVoltages);
|
||||
@@ -0,0 +1,39 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
classes:
|
||||
frc::ElevatorFeedforward:
|
||||
force_type_casters:
|
||||
- units::meters_per_second
|
||||
- meters_per_second_squared
|
||||
methods:
|
||||
ElevatorFeedforward:
|
||||
overloads:
|
||||
'':
|
||||
units::volt_t, units::volt_t, units::unit_t<kv_unit>, units::unit_t<ka_unit>:
|
||||
Calculate:
|
||||
overloads:
|
||||
units::unit_t<Velocity>, units::unit_t<Acceleration> [const]:
|
||||
ignore: true
|
||||
units::unit_t<Velocity>, units::unit_t<Velocity>, units::second_t [const]:
|
||||
ignore: true
|
||||
units::unit_t<Velocity> [const]:
|
||||
units::unit_t<Velocity>, units::unit_t<Velocity> [const]:
|
||||
MaxAchievableVelocity:
|
||||
MinAchievableVelocity:
|
||||
MaxAchievableAcceleration:
|
||||
MinAchievableAcceleration:
|
||||
GetKs:
|
||||
GetKg:
|
||||
GetKv:
|
||||
GetKa:
|
||||
SetKs:
|
||||
SetKg:
|
||||
SetKv:
|
||||
SetKa:
|
||||
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
inline_code: |
|
||||
SetupWPyStruct<frc::ElevatorFeedforward>(cls_ElevatorFeedforward);
|
||||
@@ -0,0 +1,34 @@
|
||||
defaults:
|
||||
subpackage: constraint
|
||||
|
||||
extra_includes:
|
||||
- PyTrajectoryConstraint.h
|
||||
|
||||
classes:
|
||||
frc::EllipticalRegionConstraint:
|
||||
template_params:
|
||||
- typename Constraint
|
||||
typealias:
|
||||
- frc::TrajectoryConstraint::MinMax
|
||||
methods:
|
||||
EllipticalRegionConstraint:
|
||||
overloads:
|
||||
const Translation2d&, units::meter_t, units::meter_t, const Rotation2d&, const Constraint&:
|
||||
const Ellipse2d&, const Constraint&:
|
||||
MaxVelocity:
|
||||
MinMaxAcceleration:
|
||||
|
||||
template_inline_code: |
|
||||
cls_EllipticalRegionConstraint
|
||||
.def_static("fromFeet", [](const Translation2d& center, units::foot_t xWidth,
|
||||
units::foot_t yWidth, const Rotation2d& rotation,
|
||||
const Constraint& constraint) {
|
||||
return std::make_shared<EllipticalRegionConstraint<Constraint>>(center, xWidth, yWidth, rotation, constraint);
|
||||
}, py::arg("center"), py::arg("xWidth"), py::arg("yWidth"), py::arg("rotation"), py::arg("constraint"))
|
||||
;
|
||||
|
||||
templates:
|
||||
EllipticalRegionConstraint:
|
||||
qualname: frc::EllipticalRegionConstraint
|
||||
params:
|
||||
- frc::PyTrajectoryConstraint
|
||||
@@ -0,0 +1,63 @@
|
||||
defaults:
|
||||
subpackage: trajectory
|
||||
|
||||
classes:
|
||||
frc::ExponentialProfile:
|
||||
force_type_casters:
|
||||
- units::meters_per_second_t
|
||||
template_params:
|
||||
- Distance
|
||||
- Input
|
||||
methods:
|
||||
ExponentialProfile:
|
||||
Calculate:
|
||||
CalculateInflectionPoint:
|
||||
overloads:
|
||||
const State&, const State& [const]:
|
||||
TimeLeftUntil:
|
||||
CalculateProfileTiming:
|
||||
overloads:
|
||||
const State&, const State& [const]:
|
||||
frc::ExponentialProfile::Constraints:
|
||||
attributes:
|
||||
maxInput:
|
||||
A:
|
||||
B:
|
||||
methods:
|
||||
Constraints:
|
||||
overloads:
|
||||
Input_t, A_t, B_t:
|
||||
ignore: true
|
||||
Input_t, kV_t, kA_t:
|
||||
ignore: true
|
||||
MaxVelocity:
|
||||
inline_code: |
|
||||
.def_static("fromStateSpace", [](Input_t maxInput, A_t a, B_t b) {
|
||||
return typename frc::ExponentialProfile<Distance, Input>::Constraints(maxInput, a, b);
|
||||
}, py::arg("maxInput"), py::arg("a"), py::arg("b"))
|
||||
.def_static("fromCharacteristics", [](Input_t maxInput, kV_t kv, kA_t ka) {
|
||||
return typename frc::ExponentialProfile<Distance, Input>::Constraints(maxInput, kv, ka);
|
||||
}, py::arg("maxInput"), py::arg("kV"), py::arg("kA"))
|
||||
|
||||
frc::ExponentialProfile::State:
|
||||
force_no_default_constructor: true
|
||||
attributes:
|
||||
position:
|
||||
velocity:
|
||||
methods:
|
||||
operator==:
|
||||
inline_code: |
|
||||
.def(py::init<Distance_t, Velocity_t>())
|
||||
frc::ExponentialProfile::ProfileTiming:
|
||||
attributes:
|
||||
inflectionTime:
|
||||
totalTime:
|
||||
methods:
|
||||
IsFinished:
|
||||
|
||||
templates:
|
||||
ExponentialProfileMeterVolts:
|
||||
qualname: frc::ExponentialProfile
|
||||
params:
|
||||
- units::meter
|
||||
- units::volt
|
||||
@@ -0,0 +1,66 @@
|
||||
defaults:
|
||||
subpackage: estimator
|
||||
|
||||
classes:
|
||||
frc::ExtendedKalmanFilter:
|
||||
template_params:
|
||||
- int States
|
||||
- int Inputs
|
||||
- int Outputs
|
||||
methods:
|
||||
ExtendedKalmanFilter:
|
||||
overloads:
|
||||
? std::function<StateVector (const StateVector&, const InputVector&)>, std::function<OutputVector (const StateVector&, const InputVector&)>, const StateArray&, const OutputArray&, units::second_t
|
||||
:
|
||||
? std::function<StateVector (const StateVector&, const InputVector&)>, std::function<OutputVector (const StateVector&, const InputVector&)>, const StateArray&, const OutputArray&, std::function<OutputVector (const OutputVector&, const OutputVector&)>, std::function<StateVector (const StateVector&, const StateVector&)>, units::second_t
|
||||
:
|
||||
P:
|
||||
overloads:
|
||||
'[const]':
|
||||
int, int [const]:
|
||||
SetP:
|
||||
Xhat:
|
||||
overloads:
|
||||
'[const]':
|
||||
int [const]:
|
||||
SetXhat:
|
||||
overloads:
|
||||
const StateVector&:
|
||||
int, double:
|
||||
Reset:
|
||||
Predict:
|
||||
Correct:
|
||||
overloads:
|
||||
const InputVector&, const OutputVector&:
|
||||
const InputVector&, const OutputVector&, const Matrixd<Outputs, Outputs>&:
|
||||
? const InputVector&, const Vectord<Rows>&, std::function<Vectord<Rows> (const StateVector&, const InputVector&)>, const Matrixd<Rows, Rows>&
|
||||
: ignore: true
|
||||
? const InputVector&, const Vectord<Rows>&, std::function<Vectord<Rows> (const StateVector&, const InputVector&)>, const Matrixd<Rows, Rows>&, std::function<Vectord<Rows> (const Vectord<Rows>&, const Vectord<Rows>&)>, std::function<StateVector (const StateVector&, const StateVector&)>
|
||||
: ignore: true
|
||||
|
||||
|
||||
templates:
|
||||
ExtendedKalmanFilter_1_1_1:
|
||||
qualname: frc::ExtendedKalmanFilter
|
||||
params:
|
||||
- 1
|
||||
- 1
|
||||
- 1
|
||||
ExtendedKalmanFilter_2_1_1:
|
||||
qualname: frc::ExtendedKalmanFilter
|
||||
params:
|
||||
- 2
|
||||
- 1
|
||||
- 1
|
||||
ExtendedKalmanFilter_2_1_2:
|
||||
qualname: frc::ExtendedKalmanFilter
|
||||
params:
|
||||
- 2
|
||||
- 1
|
||||
- 2
|
||||
ExtendedKalmanFilter_2_2_2:
|
||||
qualname: frc::ExtendedKalmanFilter
|
||||
params:
|
||||
- 2
|
||||
- 2
|
||||
- 2
|
||||
@@ -0,0 +1,23 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
classes:
|
||||
frc::HolonomicDriveController:
|
||||
methods:
|
||||
HolonomicDriveController:
|
||||
AtReference:
|
||||
SetTolerance:
|
||||
Calculate:
|
||||
overloads:
|
||||
const Pose2d&, const Pose2d&, units::meters_per_second_t, const Rotation2d&:
|
||||
const Pose2d&, const Trajectory::State&, const Rotation2d&:
|
||||
SetEnabled:
|
||||
getThetaController:
|
||||
ignore: true
|
||||
getXController:
|
||||
ignore: true
|
||||
getYController:
|
||||
ignore: true
|
||||
GetXController:
|
||||
GetYController:
|
||||
GetThetaController:
|
||||
@@ -0,0 +1,48 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
classes:
|
||||
frc::ImplicitModelFollower:
|
||||
template_params:
|
||||
- int States
|
||||
- int Inputs
|
||||
methods:
|
||||
ImplicitModelFollower:
|
||||
overloads:
|
||||
const LinearSystem<States, Inputs, Outputs>&, const LinearSystem<States, Inputs, Outputs>&:
|
||||
ignore: true
|
||||
? const Matrixd<States, States>&, const Matrixd<States, Inputs>&, const Matrixd<States, States>&, const Matrixd<States, Inputs>&
|
||||
:
|
||||
U:
|
||||
overloads:
|
||||
'[const]':
|
||||
int [const]:
|
||||
Reset:
|
||||
Calculate:
|
||||
|
||||
template_inline_code: |
|
||||
cls_ImplicitModelFollower
|
||||
.def(py::init<const frc::LinearSystem<States, Inputs, 1>&, const frc::LinearSystem<States, Inputs, 1>&>(),
|
||||
py::arg("plant"), py::arg("plantRef"))
|
||||
.def(py::init<const frc::LinearSystem<States, Inputs, 2>&, const frc::LinearSystem<States, Inputs, 2>&>(),
|
||||
py::arg("plant"), py::arg("plantRef"))
|
||||
.def(py::init<const frc::LinearSystem<States, Inputs, 3>&, const frc::LinearSystem<States, Inputs, 3>&>(),
|
||||
py::arg("plant"), py::arg("plantRef"))
|
||||
;
|
||||
|
||||
templates:
|
||||
ImplicitModelFollower_1_1:
|
||||
qualname: frc::ImplicitModelFollower
|
||||
params:
|
||||
- 1
|
||||
- 1
|
||||
ImplicitModelFollower_2_1:
|
||||
qualname: frc::ImplicitModelFollower
|
||||
params:
|
||||
- 2
|
||||
- 1
|
||||
ImplicitModelFollower_2_2:
|
||||
qualname: frc::ImplicitModelFollower
|
||||
params:
|
||||
- 2
|
||||
- 2
|
||||
62
wpimath/src/main/python/semiwrap/controls/KalmanFilter.yml
Normal file
62
wpimath/src/main/python/semiwrap/controls/KalmanFilter.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
defaults:
|
||||
subpackage: estimator
|
||||
|
||||
classes:
|
||||
frc::KalmanFilter:
|
||||
template_params:
|
||||
- int States
|
||||
- int Inputs
|
||||
- int Outputs
|
||||
methods:
|
||||
KalmanFilter:
|
||||
P:
|
||||
overloads:
|
||||
'[const]':
|
||||
int, int [const]:
|
||||
SetP:
|
||||
Xhat:
|
||||
overloads:
|
||||
'[const]':
|
||||
int [const]:
|
||||
SetXhat:
|
||||
overloads:
|
||||
const StateVector&:
|
||||
int, double:
|
||||
Reset:
|
||||
Predict:
|
||||
Correct:
|
||||
overloads:
|
||||
const InputVector&, const OutputVector&:
|
||||
const InputVector&, const OutputVector&, const Matrixd<Outputs, Outputs>&:
|
||||
|
||||
templates:
|
||||
KalmanFilter_1_1_1:
|
||||
qualname: frc::KalmanFilter
|
||||
params:
|
||||
- 1
|
||||
- 1
|
||||
- 1
|
||||
KalmanFilter_2_1_1:
|
||||
qualname: frc::KalmanFilter
|
||||
params:
|
||||
- 2
|
||||
- 1
|
||||
- 1
|
||||
KalmanFilter_2_1_2:
|
||||
qualname: frc::KalmanFilter
|
||||
params:
|
||||
- 2
|
||||
- 1
|
||||
- 2
|
||||
KalmanFilter_2_2_2:
|
||||
qualname: frc::KalmanFilter
|
||||
params:
|
||||
- 2
|
||||
- 2
|
||||
- 2
|
||||
KalmanFilter_3_2_3:
|
||||
qualname: frc::KalmanFilter
|
||||
params:
|
||||
- 3
|
||||
- 2
|
||||
- 3
|
||||
@@ -0,0 +1,14 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
classes:
|
||||
frc::LTVDifferentialDriveController:
|
||||
methods:
|
||||
LTVDifferentialDriveController:
|
||||
AtReference:
|
||||
SetTolerance:
|
||||
Calculate:
|
||||
overloads:
|
||||
? const Pose2d&, units::meters_per_second_t, units::meters_per_second_t, const Pose2d&, units::meters_per_second_t, units::meters_per_second_t
|
||||
:
|
||||
const Pose2d&, units::meters_per_second_t, units::meters_per_second_t, const Trajectory::State&:
|
||||
@@ -0,0 +1,20 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
classes:
|
||||
frc::LTVUnicycleController:
|
||||
methods:
|
||||
LTVUnicycleController:
|
||||
overloads:
|
||||
units::second_t:
|
||||
const wpi::array<double, 3>&, const wpi::array<double, 2>&, units::second_t:
|
||||
# param_override:
|
||||
# maxVelocity:
|
||||
# default: 9_mps
|
||||
AtReference:
|
||||
SetTolerance:
|
||||
Calculate:
|
||||
overloads:
|
||||
const Pose2d&, const Pose2d&, units::meters_per_second_t, units::radians_per_second_t:
|
||||
const Pose2d&, const Trajectory::State&:
|
||||
SetEnabled:
|
||||
@@ -0,0 +1,52 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
classes:
|
||||
frc::LinearPlantInversionFeedforward:
|
||||
template_params:
|
||||
- int States
|
||||
- int Inputs
|
||||
methods:
|
||||
LinearPlantInversionFeedforward:
|
||||
overloads:
|
||||
const LinearSystem<States, Inputs, Outputs>&, units::second_t:
|
||||
ignore: true
|
||||
const Matrixd<States, States>&, const Matrixd<States, Inputs>&, units::second_t:
|
||||
Uff:
|
||||
overloads:
|
||||
'[const]':
|
||||
int [const]:
|
||||
R:
|
||||
overloads:
|
||||
'[const]':
|
||||
int [const]:
|
||||
Reset:
|
||||
overloads:
|
||||
const StateVector&:
|
||||
'':
|
||||
Calculate:
|
||||
overloads:
|
||||
const StateVector&:
|
||||
const StateVector&, const StateVector&:
|
||||
|
||||
templates:
|
||||
LinearPlantInversionFeedforward_1_1:
|
||||
qualname: frc::LinearPlantInversionFeedforward
|
||||
params:
|
||||
- 1
|
||||
- 1
|
||||
LinearPlantInversionFeedforward_2_1:
|
||||
qualname: frc::LinearPlantInversionFeedforward
|
||||
params:
|
||||
- 2
|
||||
- 1
|
||||
LinearPlantInversionFeedforward_2_2:
|
||||
qualname: frc::LinearPlantInversionFeedforward
|
||||
params:
|
||||
- 2
|
||||
- 2
|
||||
LinearPlantInversionFeedforward_3_2:
|
||||
qualname: frc::LinearPlantInversionFeedforward
|
||||
params:
|
||||
- 3
|
||||
- 2
|
||||
@@ -0,0 +1,66 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
classes:
|
||||
frc::LinearQuadraticRegulator:
|
||||
template_params:
|
||||
- int States
|
||||
- int Inputs
|
||||
methods:
|
||||
LinearQuadraticRegulator:
|
||||
overloads:
|
||||
const LinearSystem<States, Inputs, Outputs>&, const StateArray&, const InputArray&, units::second_t:
|
||||
ignore: true
|
||||
const Matrixd<States, States>&, const Matrixd<States, Inputs>&, const StateArray&, const InputArray&, units::second_t:
|
||||
? const Matrixd<States, States>&, const Matrixd<States, Inputs>&, const Matrixd<States, States>&, const Matrixd<Inputs, Inputs>&, units::second_t
|
||||
:
|
||||
? const Matrixd<States, States>&, const Matrixd<States, Inputs>&, const Matrixd<States, States>&, const Matrixd<Inputs, Inputs>&, const Matrixd<States, Inputs>&, units::second_t
|
||||
:
|
||||
K:
|
||||
overloads:
|
||||
'[const]':
|
||||
int, int [const]:
|
||||
R:
|
||||
overloads:
|
||||
'[const]':
|
||||
int [const]:
|
||||
U:
|
||||
overloads:
|
||||
'[const]':
|
||||
int [const]:
|
||||
Reset:
|
||||
Calculate:
|
||||
overloads:
|
||||
const StateVector&:
|
||||
const StateVector&, const StateVector&:
|
||||
LatencyCompensate:
|
||||
template_impls:
|
||||
- ['1']
|
||||
- ['2']
|
||||
template_inline_code: |
|
||||
cls_LinearQuadraticRegulator
|
||||
.def(py::init<const frc::LinearSystem<States, Inputs, 1>&, const wpi::array<double, States>&, const wpi::array<double, Inputs>&, units::second_t>())
|
||||
.def(py::init<const frc::LinearSystem<States, Inputs, 2>&, const wpi::array<double, States>&, const wpi::array<double, Inputs>&, units::second_t>())
|
||||
.def(py::init<const frc::LinearSystem<States, Inputs, 3>&, const wpi::array<double, States>&, const wpi::array<double, Inputs>&, units::second_t>());
|
||||
|
||||
templates:
|
||||
LinearQuadraticRegulator_1_1:
|
||||
qualname: frc::LinearQuadraticRegulator
|
||||
params:
|
||||
- 1
|
||||
- 1
|
||||
LinearQuadraticRegulator_2_1:
|
||||
qualname: frc::LinearQuadraticRegulator
|
||||
params:
|
||||
- 2
|
||||
- 1
|
||||
LinearQuadraticRegulator_2_2:
|
||||
qualname: frc::LinearQuadraticRegulator
|
||||
params:
|
||||
- 2
|
||||
- 2
|
||||
LinearQuadraticRegulator_3_2:
|
||||
qualname: frc::LinearQuadraticRegulator
|
||||
params:
|
||||
- 3
|
||||
- 2
|
||||
106
wpimath/src/main/python/semiwrap/controls/LinearSystem.yml
Normal file
106
wpimath/src/main/python/semiwrap/controls/LinearSystem.yml
Normal file
@@ -0,0 +1,106 @@
|
||||
defaults:
|
||||
subpackage: system
|
||||
|
||||
classes:
|
||||
frc::LinearSystem:
|
||||
template_params:
|
||||
- int States
|
||||
- int Inputs
|
||||
- int Outputs
|
||||
methods:
|
||||
LinearSystem:
|
||||
A:
|
||||
overloads:
|
||||
'[const]':
|
||||
int, int [const]:
|
||||
B:
|
||||
overloads:
|
||||
'[const]':
|
||||
int, int [const]:
|
||||
C:
|
||||
overloads:
|
||||
'[const]':
|
||||
int, int [const]:
|
||||
D:
|
||||
overloads:
|
||||
'[const]':
|
||||
int, int [const]:
|
||||
CalculateX:
|
||||
CalculateY:
|
||||
Slice:
|
||||
# TODO?
|
||||
ignore: true
|
||||
|
||||
templates:
|
||||
LinearSystem_1_1_1:
|
||||
qualname: frc::LinearSystem
|
||||
params:
|
||||
- 1
|
||||
- 1
|
||||
- 1
|
||||
LinearSystem_1_1_2:
|
||||
qualname: frc::LinearSystem
|
||||
params:
|
||||
- 1
|
||||
- 1
|
||||
- 2
|
||||
LinearSystem_1_1_3:
|
||||
qualname: frc::LinearSystem
|
||||
params:
|
||||
- 1
|
||||
- 1
|
||||
- 3
|
||||
LinearSystem_2_1_1:
|
||||
qualname: frc::LinearSystem
|
||||
params:
|
||||
- 2
|
||||
- 1
|
||||
- 1
|
||||
LinearSystem_2_1_2:
|
||||
qualname: frc::LinearSystem
|
||||
params:
|
||||
- 2
|
||||
- 1
|
||||
- 2
|
||||
LinearSystem_2_1_3:
|
||||
qualname: frc::LinearSystem
|
||||
params:
|
||||
- 2
|
||||
- 1
|
||||
- 3
|
||||
LinearSystem_2_2_1:
|
||||
qualname: frc::LinearSystem
|
||||
params:
|
||||
- 2
|
||||
- 2
|
||||
- 1
|
||||
LinearSystem_2_2_2:
|
||||
qualname: frc::LinearSystem
|
||||
params:
|
||||
- 2
|
||||
- 2
|
||||
- 2
|
||||
LinearSystem_2_2_3:
|
||||
qualname: frc::LinearSystem
|
||||
params:
|
||||
- 2
|
||||
- 2
|
||||
- 3
|
||||
LinearSystem_3_2_1:
|
||||
qualname: frc::LinearSystem
|
||||
params:
|
||||
- 3
|
||||
- 2
|
||||
- 1
|
||||
LinearSystem_3_2_2:
|
||||
qualname: frc::LinearSystem
|
||||
params:
|
||||
- 3
|
||||
- 2
|
||||
- 2
|
||||
LinearSystem_3_2_3:
|
||||
qualname: frc::LinearSystem
|
||||
params:
|
||||
- 3
|
||||
- 2
|
||||
- 3
|
||||
62
wpimath/src/main/python/semiwrap/controls/LinearSystemId.yml
Normal file
62
wpimath/src/main/python/semiwrap/controls/LinearSystemId.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
defaults:
|
||||
subpackage: plant
|
||||
|
||||
classes:
|
||||
frc::LinearSystemId:
|
||||
typealias:
|
||||
- kv_meters = units::unit_t<units::compound_unit<units::volts, units::inverse<units::meters_per_second>>>
|
||||
- kv_radians = units::unit_t<units::compound_unit<units::volts, units::inverse<units::radians_per_second>>>
|
||||
- ka_meters = units::unit_t<units::compound_unit<units::volts, units::inverse<units::meters_per_second_squared>>>
|
||||
- ka_radians = units::unit_t<units::compound_unit<units::volts, units::inverse<units::radians_per_second_squared>>>
|
||||
methods:
|
||||
ElevatorSystem:
|
||||
SingleJointedArmSystem:
|
||||
IdentifyVelocitySystem:
|
||||
rename: identifyVelocitySystemMeters
|
||||
cpp_code: |
|
||||
[](kv_meters kV, ka_meters kA) {
|
||||
return frc::LinearSystemId::IdentifyVelocitySystem<units::meter>(kV, kA);
|
||||
}
|
||||
IdentifyPositionSystem:
|
||||
rename: identifyPositionSystemMeters
|
||||
cpp_code: |
|
||||
[](kv_meters kV, ka_meters kA) {
|
||||
return frc::LinearSystemId::IdentifyPositionSystem<units::meter>(kV, kA);
|
||||
}
|
||||
IdentifyDrivetrainSystem:
|
||||
overloads:
|
||||
decltype(1_V/1_mps), decltype(1_V/1_mps_sq), decltype(1_V/1_mps), decltype(1_V/1_mps_sq):
|
||||
cpp_code: |
|
||||
[](kv_meters kVlinear, ka_meters kAlinear, kv_meters kVangular, ka_meters kAangular) {
|
||||
return frc::LinearSystemId::IdentifyDrivetrainSystem(kVlinear, kAlinear, kVangular, kAangular);
|
||||
}
|
||||
decltype(1_V/1_mps), decltype(1_V/1_mps_sq), decltype(1_V/1_rad_per_s), decltype(1_V/1_rad_per_s_sq), units::meter_t:
|
||||
cpp_code: |
|
||||
[](kv_meters kVlinear, ka_meters kAlinear, kv_radians kVangular, ka_radians kAangular, units::meter_t trackWidth) {
|
||||
return frc::LinearSystemId::IdentifyDrivetrainSystem(kVlinear, kAlinear, kVangular, kAangular, trackWidth);
|
||||
}
|
||||
FlywheelSystem:
|
||||
DCMotorSystem:
|
||||
overloads:
|
||||
DCMotor, units::kilogram_square_meter_t, double:
|
||||
decltype(1_V/Velocity_t<Distance> (1)), decltype(1_V/Acceleration_t<Distance> (1)):
|
||||
cpp_code: |
|
||||
[](kv_meters kv, ka_meters ka) {
|
||||
return frc::LinearSystemId::DCMotorSystem<units::meter>(kv, ka);
|
||||
}
|
||||
DrivetrainVelocitySystem:
|
||||
|
||||
inline_code: |
|
||||
.def_static("DCMotorSystemRadians", [](kv_radians kV, ka_radians kA) {
|
||||
return frc::LinearSystemId::DCMotorSystem<units::radian>(kV, kA);
|
||||
}, py::arg("kV"), py::arg("kA"), release_gil()
|
||||
)
|
||||
|
||||
.def_static("identifyVelocitySystemRadians", [](kv_radians kV, ka_radians kA) {
|
||||
return frc::LinearSystemId::IdentifyVelocitySystem<units::radian>(kV, kA);
|
||||
}, py::arg("kV"), py::arg("kA"), release_gil()
|
||||
)
|
||||
.def_static("identifyPositionSystemRadians", [](kv_radians kV, ka_radians kA) {
|
||||
return frc::LinearSystemId::IdentifyPositionSystem<units::radian>(kV, kA);
|
||||
}, py::arg("kV"), py::arg("kA"), release_gil()
|
||||
)
|
||||
@@ -0,0 +1,79 @@
|
||||
defaults:
|
||||
subpackage: system
|
||||
|
||||
classes:
|
||||
frc::LinearSystemLoop:
|
||||
template_params:
|
||||
- int States
|
||||
- int Inputs
|
||||
- int Outputs
|
||||
methods:
|
||||
LinearSystemLoop:
|
||||
overloads:
|
||||
? LinearSystem<States, Inputs, Outputs>&, LinearQuadraticRegulator<States, Inputs>&, KalmanFilter<States, Inputs, Outputs>&, units::volt_t, units::second_t
|
||||
:
|
||||
? LinearSystem<States, Inputs, Outputs>&, LinearQuadraticRegulator<States, Inputs>&, KalmanFilter<States, Inputs, Outputs>&, std::function<InputVector (const InputVector&)>, units::second_t
|
||||
:
|
||||
? LinearQuadraticRegulator<States, Inputs>&, const LinearPlantInversionFeedforward<States, Inputs>&, KalmanFilter<States, Inputs, Outputs>&, units::volt_t
|
||||
:
|
||||
? LinearQuadraticRegulator<States, Inputs>&, const LinearPlantInversionFeedforward<States, Inputs>&, KalmanFilter<States, Inputs, Outputs>&, std::function<InputVector (const InputVector&)>
|
||||
:
|
||||
Xhat:
|
||||
overloads:
|
||||
'[const]':
|
||||
int [const]:
|
||||
NextR:
|
||||
overloads:
|
||||
'[const]':
|
||||
int [const]:
|
||||
U:
|
||||
overloads:
|
||||
'[const]':
|
||||
int [const]:
|
||||
SetXhat:
|
||||
overloads:
|
||||
const StateVector&:
|
||||
int, double:
|
||||
SetNextR:
|
||||
Controller:
|
||||
ignore: true # TODO
|
||||
Feedforward:
|
||||
ignore: true # TODO
|
||||
Observer:
|
||||
ignore: true # TODO
|
||||
Reset:
|
||||
Error:
|
||||
Correct:
|
||||
Predict:
|
||||
ClampInput:
|
||||
templates:
|
||||
LinearSystemLoop_1_1_1:
|
||||
qualname: frc::LinearSystemLoop
|
||||
params:
|
||||
- 1
|
||||
- 1
|
||||
- 1
|
||||
LinearSystemLoop_2_1_1:
|
||||
qualname: frc::LinearSystemLoop
|
||||
params:
|
||||
- 2
|
||||
- 1
|
||||
- 1
|
||||
LinearSystemLoop_2_1_2:
|
||||
qualname: frc::LinearSystemLoop
|
||||
params:
|
||||
- 2
|
||||
- 1
|
||||
- 2
|
||||
LinearSystemLoop_2_2_2:
|
||||
qualname: frc::LinearSystemLoop
|
||||
params:
|
||||
- 2
|
||||
- 2
|
||||
- 2
|
||||
LinearSystemLoop_3_2_3:
|
||||
qualname: frc::LinearSystemLoop
|
||||
params:
|
||||
- 3
|
||||
- 2
|
||||
- 3
|
||||
@@ -0,0 +1,18 @@
|
||||
defaults:
|
||||
subpackage: constraint
|
||||
|
||||
classes:
|
||||
frc::MaxVelocityConstraint:
|
||||
typealias:
|
||||
- frc::TrajectoryConstraint::MinMax
|
||||
methods:
|
||||
MaxVelocityConstraint:
|
||||
MaxVelocity:
|
||||
MinMaxAcceleration:
|
||||
|
||||
inline_code: |-
|
||||
cls_MaxVelocityConstraint
|
||||
.def_static("fromFps", [](units::feet_per_second_t maxVelocity) {
|
||||
return std::make_shared<frc::MaxVelocityConstraint>(maxVelocity);
|
||||
}, py::arg("maxVelocity"))
|
||||
;
|
||||
@@ -0,0 +1,19 @@
|
||||
defaults:
|
||||
subpackage: constraint
|
||||
|
||||
classes:
|
||||
frc::MecanumDriveKinematicsConstraint:
|
||||
typealias:
|
||||
- frc::TrajectoryConstraint::MinMax
|
||||
methods:
|
||||
MecanumDriveKinematicsConstraint:
|
||||
MaxVelocity:
|
||||
MinMaxAcceleration:
|
||||
|
||||
inline_code: |-
|
||||
cls_MecanumDriveKinematicsConstraint
|
||||
.def_static("fromFps", [](const frc::MecanumDriveKinematics& kinematics,
|
||||
units::feet_per_second_t maxSpeed) {
|
||||
return std::make_shared<frc::MecanumDriveKinematicsConstraint>(kinematics, maxSpeed);
|
||||
}, py::arg("kinematics"), py::arg("maxSpeed"))
|
||||
;
|
||||
@@ -0,0 +1,38 @@
|
||||
defaults:
|
||||
subpackage: estimator
|
||||
|
||||
classes:
|
||||
frc::MecanumDrivePoseEstimator:
|
||||
force_no_trampoline: true
|
||||
doc: |
|
||||
This class wraps an Unscented Kalman Filter to fuse latency-compensated
|
||||
vision measurements with mecanum drive encoder velocity measurements. It will
|
||||
correct for noisy measurements and encoder drift. It is intended to be an
|
||||
easy but more accurate drop-in for :class:`MecanumDriveOdometry`.
|
||||
|
||||
:meth:`update` should be called every robot loop. If your loops are faster or
|
||||
slower than the default of 0.02s, then you should change the nominal delta
|
||||
time by specifying it in the constructor.
|
||||
|
||||
:meth:`addVisionMeasurement` can be called as infrequently as you want; if you
|
||||
never call it, then this class will behave mostly like regular encoder
|
||||
odometry.
|
||||
|
||||
The state-space system used internally has the following states (x), inputs
|
||||
(u), and outputs (y):
|
||||
|
||||
:math:`x = [x, y, \theta]^T` in the field-coordinate system
|
||||
containing x position, y position, and heading.
|
||||
|
||||
:math:`u = [v_x, v_y, \omega]^T` containing x velocity, y velocity,
|
||||
and angular velocity in the field-coordinate system.
|
||||
|
||||
:math:`y = [x, y, \theta]^T` from vision containing x position, y
|
||||
position, and heading; or :math:`y = [theta]^T` containing gyro
|
||||
heading.
|
||||
methods:
|
||||
MecanumDrivePoseEstimator:
|
||||
overloads:
|
||||
MecanumDriveKinematics&, const Rotation2d&, const MecanumDriveWheelPositions&, const Pose2d&:
|
||||
? MecanumDriveKinematics&, const Rotation2d&, const MecanumDriveWheelPositions&, const Pose2d&, const wpi::array<double, 3>&, const wpi::array<double, 3>&
|
||||
:
|
||||
@@ -0,0 +1,12 @@
|
||||
defaults:
|
||||
subpackage: estimator
|
||||
|
||||
classes:
|
||||
frc::MecanumDrivePoseEstimator3d:
|
||||
force_no_trampoline: true
|
||||
methods:
|
||||
MecanumDrivePoseEstimator3d:
|
||||
overloads:
|
||||
MecanumDriveKinematics&, const Rotation3d&, const MecanumDriveWheelPositions&, const Pose3d&:
|
||||
? MecanumDriveKinematics&, const Rotation3d&, const MecanumDriveWheelPositions&, const Pose3d&, const wpi::array<double, 4>&, const wpi::array<double, 4>&
|
||||
:
|
||||
45
wpimath/src/main/python/semiwrap/controls/PIDController.yml
Normal file
45
wpimath/src/main/python/semiwrap/controls/PIDController.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
classes:
|
||||
frc::PIDController:
|
||||
ignored_bases:
|
||||
- wpi::SendableHelper<PIDController>
|
||||
methods:
|
||||
PIDController:
|
||||
param_override:
|
||||
period:
|
||||
default: 0.020_s
|
||||
SetPID:
|
||||
SetP:
|
||||
SetI:
|
||||
SetD:
|
||||
SetIZone:
|
||||
GetP:
|
||||
GetI:
|
||||
GetD:
|
||||
GetIZone:
|
||||
GetPeriod:
|
||||
GetErrorTolerance:
|
||||
GetErrorDerivativeTolerance:
|
||||
GetPositionTolerance:
|
||||
GetVelocityTolerance:
|
||||
GetAccumulatedError:
|
||||
SetSetpoint:
|
||||
GetSetpoint:
|
||||
AtSetpoint:
|
||||
EnableContinuousInput:
|
||||
DisableContinuousInput:
|
||||
IsContinuousInputEnabled:
|
||||
SetIntegratorRange:
|
||||
SetTolerance:
|
||||
GetError:
|
||||
GetErrorDerivative:
|
||||
GetPositionError:
|
||||
GetVelocityError:
|
||||
Calculate:
|
||||
overloads:
|
||||
double:
|
||||
double, double:
|
||||
Reset:
|
||||
InitSendable:
|
||||
63
wpimath/src/main/python/semiwrap/controls/PoseEstimator.yml
Normal file
63
wpimath/src/main/python/semiwrap/controls/PoseEstimator.yml
Normal file
@@ -0,0 +1,63 @@
|
||||
defaults:
|
||||
subpackage: estimator
|
||||
|
||||
extra_includes:
|
||||
- frc/kinematics/DifferentialDriveWheelPositions.h
|
||||
- frc/kinematics/DifferentialDriveWheelSpeeds.h
|
||||
- frc/kinematics/MecanumDriveWheelPositions.h
|
||||
- frc/kinematics/MecanumDriveWheelSpeeds.h
|
||||
- frc/kinematics/SwerveDriveKinematics.h
|
||||
|
||||
|
||||
classes:
|
||||
frc::PoseEstimator:
|
||||
template_params:
|
||||
- WheelSpeeds
|
||||
- WheelPositions
|
||||
methods:
|
||||
PoseEstimator:
|
||||
SetVisionMeasurementStdDevs:
|
||||
ResetPosition:
|
||||
ResetPose:
|
||||
ResetTranslation:
|
||||
ResetRotation:
|
||||
GetEstimatedPosition:
|
||||
SampleAt:
|
||||
AddVisionMeasurement:
|
||||
overloads:
|
||||
const Pose2d&, units::second_t:
|
||||
const Pose2d&, units::second_t, const wpi::array<double, 3>&:
|
||||
Update:
|
||||
UpdateWithTime:
|
||||
|
||||
templates:
|
||||
DifferentialDrivePoseEstimatorBase:
|
||||
qualname: frc::PoseEstimator
|
||||
params:
|
||||
- frc::DifferentialDriveWheelSpeeds
|
||||
- frc::DifferentialDriveWheelPositions
|
||||
MecanumDrivePoseEstimatorBase:
|
||||
qualname: frc::PoseEstimator
|
||||
params:
|
||||
- frc::MecanumDriveWheelSpeeds
|
||||
- frc::MecanumDriveWheelPositions
|
||||
SwerveDrive2PoseEstimatorBase:
|
||||
qualname: frc::PoseEstimator
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,2>
|
||||
- wpi::array<frc::SwerveModulePosition,2>
|
||||
SwerveDrive3PoseEstimatorBase:
|
||||
qualname: frc::PoseEstimator
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,3>
|
||||
- wpi::array<frc::SwerveModulePosition,3>
|
||||
SwerveDrive4PoseEstimatorBase:
|
||||
qualname: frc::PoseEstimator
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,4>
|
||||
- wpi::array<frc::SwerveModulePosition,4>
|
||||
SwerveDrive6PoseEstimatorBase:
|
||||
qualname: frc::PoseEstimator
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,6>
|
||||
- wpi::array<frc::SwerveModulePosition,6>
|
||||
@@ -0,0 +1,63 @@
|
||||
defaults:
|
||||
subpackage: estimator
|
||||
|
||||
extra_includes:
|
||||
- frc/kinematics/DifferentialDriveWheelPositions.h
|
||||
- frc/kinematics/DifferentialDriveWheelSpeeds.h
|
||||
- frc/kinematics/MecanumDriveWheelPositions.h
|
||||
- frc/kinematics/MecanumDriveWheelSpeeds.h
|
||||
- frc/kinematics/SwerveDriveKinematics.h
|
||||
|
||||
classes:
|
||||
frc::PoseEstimator3d:
|
||||
template_params:
|
||||
- WheelSpeeds
|
||||
- WheelPositions
|
||||
methods:
|
||||
PoseEstimator3d:
|
||||
SetVisionMeasurementStdDevs:
|
||||
ResetPosition:
|
||||
ResetPose:
|
||||
ResetTranslation:
|
||||
ResetRotation:
|
||||
GetEstimatedPosition:
|
||||
SampleAt:
|
||||
AddVisionMeasurement:
|
||||
overloads:
|
||||
const Pose3d&, units::second_t:
|
||||
const Pose3d&, units::second_t, const wpi::array<double, 4>&:
|
||||
Update:
|
||||
UpdateWithTime:
|
||||
|
||||
|
||||
templates:
|
||||
DifferentialDrivePoseEstimator3dBase:
|
||||
qualname: frc::PoseEstimator3d
|
||||
params:
|
||||
- frc::DifferentialDriveWheelSpeeds
|
||||
- frc::DifferentialDriveWheelPositions
|
||||
MecanumDrivePoseEstimator3dBase:
|
||||
qualname: frc::PoseEstimator3d
|
||||
params:
|
||||
- frc::MecanumDriveWheelSpeeds
|
||||
- frc::MecanumDriveWheelPositions
|
||||
SwerveDrive2PoseEstimator3dBase:
|
||||
qualname: frc::PoseEstimator3d
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,2>
|
||||
- wpi::array<frc::SwerveModulePosition,2>
|
||||
SwerveDrive3PoseEstimator3dBase:
|
||||
qualname: frc::PoseEstimator3d
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,3>
|
||||
- wpi::array<frc::SwerveModulePosition,3>
|
||||
SwerveDrive4PoseEstimator3dBase:
|
||||
qualname: frc::PoseEstimator3d
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,4>
|
||||
- wpi::array<frc::SwerveModulePosition,4>
|
||||
SwerveDrive6PoseEstimator3dBase:
|
||||
qualname: frc::PoseEstimator3d
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,6>
|
||||
- wpi::array<frc::SwerveModulePosition,6>
|
||||
@@ -0,0 +1,80 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
functions:
|
||||
IncrementAndGetProfiledPIDControllerInstances:
|
||||
ignore: true
|
||||
classes:
|
||||
frc::ProfiledPIDController:
|
||||
force_type_casters:
|
||||
- units::radians_per_second
|
||||
template_params:
|
||||
- Distance
|
||||
ignored_bases:
|
||||
- wpi::SendableHelper<ProfiledPIDController<Distance>>
|
||||
typealias:
|
||||
- typename frc::ProfiledPIDController<Distance>::Velocity
|
||||
- typename frc::ProfiledPIDController<Distance>::Velocity_t
|
||||
methods:
|
||||
ProfiledPIDController:
|
||||
param_override:
|
||||
constraints:
|
||||
x_type: typename TrapezoidProfile<Distance>::Constraints
|
||||
period:
|
||||
default: 0.020_s
|
||||
SetPID:
|
||||
SetP:
|
||||
SetI:
|
||||
SetD:
|
||||
SetIZone:
|
||||
GetP:
|
||||
GetI:
|
||||
GetD:
|
||||
GetIZone:
|
||||
GetPeriod:
|
||||
GetPositionTolerance:
|
||||
GetVelocityTolerance:
|
||||
GetAccumulatedError:
|
||||
SetGoal:
|
||||
overloads:
|
||||
State:
|
||||
Distance_t:
|
||||
GetGoal:
|
||||
AtGoal:
|
||||
SetConstraints:
|
||||
GetConstraints:
|
||||
GetSetpoint:
|
||||
AtSetpoint:
|
||||
EnableContinuousInput:
|
||||
DisableContinuousInput:
|
||||
SetIntegratorRange:
|
||||
SetTolerance:
|
||||
GetPositionError:
|
||||
GetVelocityError:
|
||||
Calculate:
|
||||
overloads:
|
||||
Distance_t:
|
||||
Distance_t, State:
|
||||
Distance_t, Distance_t:
|
||||
Distance_t, Distance_t, typename frc::TrapezoidProfile<Distance>::Constraints:
|
||||
param_override:
|
||||
constraints:
|
||||
x_type: typename TrapezoidProfile<Distance>::Constraints
|
||||
Reset:
|
||||
overloads:
|
||||
const State&:
|
||||
Distance_t, Velocity_t:
|
||||
Distance_t:
|
||||
InitSendable:
|
||||
|
||||
templates:
|
||||
ProfiledPIDController:
|
||||
qualname: frc::ProfiledPIDController
|
||||
params:
|
||||
- units::dimensionless::scalar
|
||||
|
||||
# needed for HolonomicDriveController
|
||||
ProfiledPIDControllerRadians:
|
||||
qualname: frc::ProfiledPIDController
|
||||
params:
|
||||
- units::radian
|
||||
@@ -0,0 +1,25 @@
|
||||
defaults:
|
||||
subpackage: constraint
|
||||
|
||||
extra_includes:
|
||||
- PyTrajectoryConstraint.h
|
||||
|
||||
classes:
|
||||
frc::RectangularRegionConstraint:
|
||||
template_params:
|
||||
- typename Constraint
|
||||
typealias:
|
||||
- frc::TrajectoryConstraint::MinMax
|
||||
methods:
|
||||
RectangularRegionConstraint:
|
||||
overloads:
|
||||
const Translation2d&, const Translation2d&, const Constraint&:
|
||||
const Rectangle2d&, const Constraint&:
|
||||
MaxVelocity:
|
||||
MinMaxAcceleration:
|
||||
|
||||
templates:
|
||||
RectangularRegionConstraint:
|
||||
qualname: frc::RectangularRegionConstraint
|
||||
params:
|
||||
- frc::PyTrajectoryConstraint
|
||||
@@ -0,0 +1,57 @@
|
||||
defaults:
|
||||
subpackage: controller
|
||||
|
||||
extra_includes:
|
||||
- units/dimensionless.h
|
||||
|
||||
classes:
|
||||
frc::SimpleMotorFeedforward:
|
||||
force_type_casters:
|
||||
- units::meters_per_second
|
||||
- units::meters_per_second_squared
|
||||
- units::radians_per_second
|
||||
- units::radians_per_second_squared
|
||||
typealias:
|
||||
- typename frc::SimpleMotorFeedforward<Distance>::Velocity
|
||||
- typename frc::SimpleMotorFeedforward<Distance>::Acceleration
|
||||
- typename frc::SimpleMotorFeedforward<Distance>::kv_unit
|
||||
- typename frc::SimpleMotorFeedforward<Distance>::ka_unit
|
||||
template_params:
|
||||
- Distance
|
||||
methods:
|
||||
SimpleMotorFeedforward:
|
||||
overloads:
|
||||
'':
|
||||
units::volt_t, units::unit_t<kv_unit>, units::unit_t<ka_unit>:
|
||||
Calculate:
|
||||
overloads:
|
||||
units::unit_t<Velocity> [const]:
|
||||
units::unit_t<Velocity>, units::unit_t<Velocity> [const]:
|
||||
MaxAchievableVelocity:
|
||||
MinAchievableVelocity:
|
||||
MaxAchievableAcceleration:
|
||||
MinAchievableAcceleration:
|
||||
GetKs:
|
||||
GetKv:
|
||||
GetKa:
|
||||
GetDt:
|
||||
SetKs:
|
||||
SetKv:
|
||||
SetKa:
|
||||
|
||||
templates:
|
||||
# Unfortunately this is broken because calculate requires an SI unit
|
||||
# SimpleMotorFeedforward:
|
||||
# qualname: frc::SimpleMotorFeedforward
|
||||
# params:
|
||||
# - units::dimensionless::scalar
|
||||
|
||||
SimpleMotorFeedforwardMeters:
|
||||
qualname: frc::SimpleMotorFeedforward
|
||||
params:
|
||||
- units::meter
|
||||
|
||||
SimpleMotorFeedforwardRadians:
|
||||
qualname: frc::SimpleMotorFeedforward
|
||||
params:
|
||||
- units::radian
|
||||
@@ -0,0 +1,19 @@
|
||||
defaults:
|
||||
subpackage: optimization
|
||||
|
||||
extra_includes:
|
||||
- gilsafe_object.h
|
||||
|
||||
classes:
|
||||
frc::SimulatedAnnealing:
|
||||
template_params:
|
||||
- State
|
||||
methods:
|
||||
SimulatedAnnealing:
|
||||
Solve:
|
||||
|
||||
templates:
|
||||
SimulatedAnnealing:
|
||||
qualname: frc::SimulatedAnnealing
|
||||
params:
|
||||
- semiwrap::gilsafe_object
|
||||
@@ -0,0 +1,38 @@
|
||||
defaults:
|
||||
subpackage: constraint
|
||||
|
||||
classes:
|
||||
frc::SwerveDriveKinematicsConstraint:
|
||||
template_params:
|
||||
- size_t NumModules
|
||||
typealias:
|
||||
- frc::TrajectoryConstraint::MinMax
|
||||
methods:
|
||||
SwerveDriveKinematicsConstraint:
|
||||
MaxVelocity:
|
||||
MinMaxAcceleration:
|
||||
template_inline_code: |
|
||||
cls_SwerveDriveKinematicsConstraint
|
||||
.def_static("fromFps", [](const frc::SwerveDriveKinematics<NumModules>& kinematics,
|
||||
units::feet_per_second_t maxSpeed) {
|
||||
return std::make_shared<frc::SwerveDriveKinematicsConstraint<NumModules>>(kinematics, maxSpeed);
|
||||
}, py::arg("kinematics"), py::arg("maxSpeed"))
|
||||
;
|
||||
|
||||
templates:
|
||||
SwerveDrive2KinematicsConstraint:
|
||||
qualname: frc::SwerveDriveKinematicsConstraint
|
||||
params:
|
||||
- 2
|
||||
SwerveDrive3KinematicsConstraint:
|
||||
qualname: frc::SwerveDriveKinematicsConstraint
|
||||
params:
|
||||
- 3
|
||||
SwerveDrive4KinematicsConstraint:
|
||||
qualname: frc::SwerveDriveKinematicsConstraint
|
||||
params:
|
||||
- 4
|
||||
SwerveDrive6KinematicsConstraint:
|
||||
qualname: frc::SwerveDriveKinematicsConstraint
|
||||
params:
|
||||
- 6
|
||||
@@ -0,0 +1,53 @@
|
||||
defaults:
|
||||
subpackage: estimator
|
||||
|
||||
extra_includes:
|
||||
- frc/kinematics/SwerveModuleState.h
|
||||
|
||||
classes:
|
||||
frc::SwerveDrivePoseEstimator:
|
||||
force_no_trampoline: true
|
||||
doc: |
|
||||
This class wraps Swerve Drive Odometry to fuse latency-compensated
|
||||
vision measurements with swerve drive encoder distance measurements. It is
|
||||
intended to be a drop-in for :class:`SwerveDriveOdometry`.
|
||||
|
||||
:meth:`update` should be called every robot loop.
|
||||
|
||||
:meth:`addVisionMeasurement` can be called as infrequently as you want; if you
|
||||
never call it, then this class will behave as regular encoder odometry.
|
||||
|
||||
The state-space system used internally has the following states (x) and outputs (y):
|
||||
|
||||
:math:`x = [x, y, \theta]^T` in the field-coordinate system
|
||||
containing x position, y position, and heading.
|
||||
|
||||
:math:`y = [x, y, \theta]^T` from vision containing x position, y
|
||||
position, and heading; or :math:`y = [theta]^T` containing gyro
|
||||
heading.
|
||||
template_params:
|
||||
- size_t NumModules
|
||||
methods:
|
||||
SwerveDrivePoseEstimator:
|
||||
overloads:
|
||||
SwerveDriveKinematics<NumModules>&, const Rotation2d&, const wpi::array<SwerveModulePosition, NumModules>&, const Pose2d&:
|
||||
? SwerveDriveKinematics<NumModules>&, const Rotation2d&, const wpi::array<SwerveModulePosition, NumModules>&, const Pose2d&, const wpi::array<double, 3>&, const wpi::array<double, 3>&
|
||||
:
|
||||
|
||||
templates:
|
||||
SwerveDrive2PoseEstimator:
|
||||
qualname: frc::SwerveDrivePoseEstimator
|
||||
params:
|
||||
- 2
|
||||
SwerveDrive3PoseEstimator:
|
||||
qualname: frc::SwerveDrivePoseEstimator
|
||||
params:
|
||||
- 3
|
||||
SwerveDrive4PoseEstimator:
|
||||
qualname: frc::SwerveDrivePoseEstimator
|
||||
params:
|
||||
- 4
|
||||
SwerveDrive6PoseEstimator:
|
||||
qualname: frc::SwerveDrivePoseEstimator
|
||||
params:
|
||||
- 6
|
||||
@@ -0,0 +1,36 @@
|
||||
defaults:
|
||||
subpackage: estimator
|
||||
|
||||
extra_includes:
|
||||
- frc/kinematics/SwerveModuleState.h
|
||||
|
||||
classes:
|
||||
frc::SwerveDrivePoseEstimator3d:
|
||||
force_no_trampoline: true
|
||||
template_params:
|
||||
- size_t NumModules
|
||||
methods:
|
||||
SwerveDrivePoseEstimator3d:
|
||||
overloads:
|
||||
SwerveDriveKinematics<NumModules>&, const Rotation3d&, const wpi::array<SwerveModulePosition, NumModules>&, const Pose3d&:
|
||||
? SwerveDriveKinematics<NumModules>&, const Rotation3d&, const wpi::array<SwerveModulePosition, NumModules>&, const Pose3d&, const wpi::array<double, 4>&, const wpi::array<double, 4>&
|
||||
:
|
||||
|
||||
|
||||
templates:
|
||||
SwerveDrive2PoseEstimator3d:
|
||||
qualname: frc::SwerveDrivePoseEstimator3d
|
||||
params:
|
||||
- 2
|
||||
SwerveDrive3PoseEstimator3d:
|
||||
qualname: frc::SwerveDrivePoseEstimator3d
|
||||
params:
|
||||
- 3
|
||||
SwerveDrive4PoseEstimator3d:
|
||||
qualname: frc::SwerveDrivePoseEstimator3d
|
||||
params:
|
||||
- 4
|
||||
SwerveDrive6PoseEstimator3d:
|
||||
qualname: frc::SwerveDrivePoseEstimator3d
|
||||
params:
|
||||
- 6
|
||||
71
wpimath/src/main/python/semiwrap/controls/Trajectory.yml
Normal file
71
wpimath/src/main/python/semiwrap/controls/Trajectory.yml
Normal file
@@ -0,0 +1,71 @@
|
||||
defaults:
|
||||
subpackage: trajectory
|
||||
|
||||
extra_includes:
|
||||
- rpy/geometryToString.h
|
||||
|
||||
functions:
|
||||
to_json:
|
||||
ignore: true
|
||||
from_json:
|
||||
ignore: true
|
||||
classes:
|
||||
frc::Trajectory:
|
||||
force_type_casters:
|
||||
- units::curvature_t
|
||||
methods:
|
||||
Trajectory:
|
||||
overloads:
|
||||
'':
|
||||
const std::vector<State>&:
|
||||
TotalTime:
|
||||
States:
|
||||
Sample:
|
||||
TransformBy:
|
||||
RelativeTo:
|
||||
InitialPose:
|
||||
operator+:
|
||||
operator==:
|
||||
frc::Trajectory::State:
|
||||
force_no_default_constructor: true
|
||||
attributes:
|
||||
t:
|
||||
velocity:
|
||||
acceleration:
|
||||
pose:
|
||||
curvature:
|
||||
methods:
|
||||
operator==:
|
||||
Interpolate:
|
||||
|
||||
inline_code: |
|
||||
cls_State
|
||||
.def(
|
||||
py::init<
|
||||
units::second_t,
|
||||
units::meters_per_second_t,
|
||||
units::meters_per_second_squared_t,
|
||||
Pose2d,
|
||||
units::curvature_t
|
||||
>(),
|
||||
py::arg("t") = 0_s,
|
||||
py::arg("velocity") = 0_mps,
|
||||
py::arg("acceleration") = 0_mps_sq,
|
||||
py::arg("pose") = Pose2d(),
|
||||
py::arg("curvature") = 0.0
|
||||
)
|
||||
.def_property_readonly("velocity_fps", [](frc::Trajectory::State * self) -> units::feet_per_second_t {
|
||||
return self->velocity;
|
||||
})
|
||||
.def_property_readonly("acceleration_fps", [](frc::Trajectory::State * self) -> units::feet_per_second_squared_t {
|
||||
return self->acceleration;
|
||||
})
|
||||
.def("__repr__", [](frc::Trajectory::State *self) {
|
||||
return "Trajectory.State("
|
||||
"t=" + std::to_string(self->t()) + ", "
|
||||
"velocity=" + std::to_string(self->velocity()) + ", "
|
||||
"acceleration=" + std::to_string(self->acceleration()) + ", "
|
||||
"pose=" + rpy::toString(self->pose) + ", "
|
||||
"curvature=" + std::to_string(self->curvature()) + ")";
|
||||
})
|
||||
.def_readwrite("curvature", &frc::Trajectory::State::curvature);
|
||||
@@ -0,0 +1,74 @@
|
||||
defaults:
|
||||
subpackage: trajectory
|
||||
|
||||
extra_includes:
|
||||
- PyTrajectoryConstraint.h
|
||||
|
||||
classes:
|
||||
frc::TrajectoryConfig:
|
||||
methods:
|
||||
TrajectoryConfig:
|
||||
SetStartVelocity:
|
||||
SetEndVelocity:
|
||||
SetReversed:
|
||||
AddConstraint:
|
||||
template_impls:
|
||||
- [PyTrajectoryConstraint]
|
||||
SetKinematics:
|
||||
overloads:
|
||||
const DifferentialDriveKinematics&:
|
||||
MecanumDriveKinematics:
|
||||
SwerveDriveKinematics<NumModules>&:
|
||||
ignore: true
|
||||
StartVelocity:
|
||||
EndVelocity:
|
||||
MaxVelocity:
|
||||
MaxAcceleration:
|
||||
Constraints:
|
||||
ignore: true # seems hard, let me know if you need it
|
||||
IsReversed:
|
||||
|
||||
inline_code: |-
|
||||
cls_TrajectoryConfig
|
||||
.def_static("fromFps", [](units::feet_per_second_t maxVelocity, units::feet_per_second_squared_t maxAcceleration) {
|
||||
return std::make_shared<TrajectoryConfig>(maxVelocity, maxAcceleration);
|
||||
}, py::arg("maxVelocity"), py::arg("maxAcceleration"))
|
||||
|
||||
// TODO: robotpy-build bug
|
||||
|
||||
.def("setKinematics", static_cast<void (frc::TrajectoryConfig::*)(frc::SwerveDriveKinematics<2>&)>(
|
||||
&frc::TrajectoryConfig::SetKinematics<2>),
|
||||
py::arg("kinematics"), release_gil(), py::doc(
|
||||
"Adds a swerve drive kinematics constraint to ensure that\n"
|
||||
"no wheel velocity of a swerve drive goes above the max velocity.\n"
|
||||
"\n"
|
||||
":param kinematics: The swerve drive kinematics.")
|
||||
)
|
||||
|
||||
.def("setKinematics", static_cast<void (frc::TrajectoryConfig::*)(frc::SwerveDriveKinematics<3>&)>(
|
||||
&frc::TrajectoryConfig::SetKinematics<3>),
|
||||
py::arg("kinematics"), release_gil(), py::doc(
|
||||
"Adds a swerve drive kinematics constraint to ensure that\n"
|
||||
"no wheel velocity of a swerve drive goes above the max velocity.\n"
|
||||
"\n"
|
||||
":param kinematics: The swerve drive kinematics.")
|
||||
)
|
||||
|
||||
.def("setKinematics", static_cast<void (frc::TrajectoryConfig::*)(frc::SwerveDriveKinematics<4>&)>(
|
||||
&frc::TrajectoryConfig::SetKinematics<4>),
|
||||
py::arg("kinematics"), release_gil(), py::doc(
|
||||
"Adds a swerve drive kinematics constraint to ensure that\n"
|
||||
"no wheel velocity of a swerve drive goes above the max velocity.\n"
|
||||
"\n"
|
||||
":param kinematics: The swerve drive kinematics.")
|
||||
)
|
||||
|
||||
.def("setKinematics", static_cast<void (frc::TrajectoryConfig::*)(frc::SwerveDriveKinematics<6>&)>(
|
||||
&frc::TrajectoryConfig::SetKinematics<6>),
|
||||
py::arg("kinematics"), release_gil(), py::doc(
|
||||
"Adds a swerve drive kinematics constraint to ensure that\n"
|
||||
"no wheel velocity of a swerve drive goes above the max velocity.\n"
|
||||
"\n"
|
||||
":param kinematics: The swerve drive kinematics.")
|
||||
)
|
||||
;
|
||||
@@ -0,0 +1,38 @@
|
||||
defaults:
|
||||
subpackage: constraint
|
||||
|
||||
classes:
|
||||
frc::TrajectoryConstraint:
|
||||
force_type_casters:
|
||||
- units::meters_per_second_squared
|
||||
methods:
|
||||
TrajectoryConstraint:
|
||||
MaxVelocity:
|
||||
MinMaxAcceleration:
|
||||
frc::TrajectoryConstraint::MinMax:
|
||||
attributes:
|
||||
minAcceleration:
|
||||
maxAcceleration:
|
||||
inline_code: |
|
||||
.def(py::init([](
|
||||
units::meters_per_second_squared_t minAcceleration,
|
||||
units::meters_per_second_squared_t maxAcceleration) {
|
||||
return frc::TrajectoryConstraint::MinMax{minAcceleration, maxAcceleration};
|
||||
}), py::arg("minAcceleration"), py::arg("maxAcceleration"))
|
||||
|
||||
.def("__len__", [](const frc::TrajectoryConstraint::MinMax& self) { return 2; })
|
||||
.def("__getitem__", [](const frc::TrajectoryConstraint::MinMax& self, int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return self.minAcceleration;
|
||||
case 1:
|
||||
return self.maxAcceleration;
|
||||
default:
|
||||
throw std::out_of_range("TrajectoryConstraint.MinMax index out of range");
|
||||
}
|
||||
})
|
||||
|
||||
.def("__repr__", [](const frc::TrajectoryConstraint::MinMax &self) {
|
||||
return py::str("TrajectoryConstraint.MinMax(minAcceleration={}, maxAcceleration={})").format(
|
||||
self.minAcceleration, self.maxAcceleration);
|
||||
})
|
||||
@@ -0,0 +1,25 @@
|
||||
defaults:
|
||||
subpackage: trajectory
|
||||
|
||||
extra_includes:
|
||||
- frc/spline/CubicHermiteSpline.h
|
||||
- frc/spline/QuinticHermiteSpline.h
|
||||
|
||||
classes:
|
||||
frc::TrajectoryGenerator:
|
||||
force_type_casters:
|
||||
- units::unit_t
|
||||
- units::curvature_t
|
||||
methods:
|
||||
GenerateTrajectory:
|
||||
overloads:
|
||||
Spline<3>::ControlVector, const std::vector<Translation2d>&, Spline<3>::ControlVector, const TrajectoryConfig&:
|
||||
const Pose2d&, const std::vector<Translation2d>&, const Pose2d&, const TrajectoryConfig&:
|
||||
std::vector<Spline<5>::ControlVector>, const TrajectoryConfig&:
|
||||
const std::vector<Pose2d>&, const TrajectoryConfig&:
|
||||
SplinePointsFromSplines:
|
||||
template_impls:
|
||||
- [CubicHermiteSpline]
|
||||
- [QuinticHermiteSpline]
|
||||
SetErrorHandler:
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
defaults:
|
||||
subpackage: trajectory
|
||||
|
||||
classes:
|
||||
frc::TrajectoryParameterizer:
|
||||
force_type_casters:
|
||||
- units::unit_t
|
||||
- units::curvature_t
|
||||
methods:
|
||||
TimeParameterizeTrajectory:
|
||||
106
wpimath/src/main/python/semiwrap/controls/TrapezoidProfile.yml
Normal file
106
wpimath/src/main/python/semiwrap/controls/TrapezoidProfile.yml
Normal file
@@ -0,0 +1,106 @@
|
||||
defaults:
|
||||
subpackage: trajectory
|
||||
|
||||
classes:
|
||||
frc::TrapezoidProfile:
|
||||
force_type_casters:
|
||||
- units::second_t
|
||||
- units::radians_per_second
|
||||
- units::radians_per_second_squared
|
||||
template_params:
|
||||
- Distance
|
||||
doc: |
|
||||
A trapezoid-shaped velocity profile.
|
||||
|
||||
While this class can be used for a profiled movement from start to finish,
|
||||
the intended usage is to filter a reference's dynamics based on trapezoidal
|
||||
velocity constraints. To compute the reference obeying this constraint, do
|
||||
the following.
|
||||
|
||||
Initialization::
|
||||
|
||||
constraints = TrapezoidProfile.Constraints(kMaxV, kMaxA)
|
||||
previousProfiledReference = initialReference
|
||||
|
||||
Run on update::
|
||||
|
||||
profile = TrapezoidProfile(constraints, unprofiledReference, previousProfiledReference)
|
||||
previousProfiledReference = profile.calculate(timeSincePreviousUpdate)
|
||||
|
||||
where ``unprofiledReference`` is free to change between calls. Note that
|
||||
when the unprofiled reference is within the constraints,
|
||||
:meth:`calculate` returns the unprofiled reference unchanged.
|
||||
|
||||
Otherwise, a timer can be started to provide monotonic values for
|
||||
``calculate()`` and to determine when the profile has completed via
|
||||
:meth:`isFinished`.
|
||||
methods:
|
||||
TrapezoidProfile:
|
||||
param_override:
|
||||
constraints:
|
||||
x_type: typename TrapezoidProfile<Distance>::Constraints
|
||||
goal:
|
||||
x_type: typename TrapezoidProfile<Distance>::State
|
||||
initial:
|
||||
x_type: typename TrapezoidProfile<Distance>::State
|
||||
Calculate:
|
||||
TimeLeftUntil:
|
||||
TotalTime:
|
||||
IsFinished:
|
||||
template_inline_code: |
|
||||
{
|
||||
std::string clsNameCopy = clsName;
|
||||
|
||||
cls_Constraints
|
||||
.def("__repr__", [clsNameCopy](const Constraints &self) {
|
||||
return clsNameCopy + ".Constraints("
|
||||
"maxVelocity=" + std::to_string(self.maxVelocity()) + ", "
|
||||
"maxAcceleration=" + std::to_string(self.maxAcceleration()) + ")";
|
||||
});
|
||||
|
||||
cls_State
|
||||
.def(
|
||||
py::init<Distance_t, Velocity_t>(),
|
||||
py::arg("position") = 0,
|
||||
py::arg("velocity") = 0
|
||||
)
|
||||
.def("__repr__", [clsNameCopy](const State &self) {
|
||||
return clsNameCopy + ".State("
|
||||
"position=" + std::to_string(self.position()) + ", "
|
||||
"velocity=" + std::to_string(self.velocity()) + ")";
|
||||
});
|
||||
}
|
||||
frc::TrapezoidProfile::Constraints:
|
||||
attributes:
|
||||
maxVelocity:
|
||||
maxAcceleration:
|
||||
methods:
|
||||
Constraints:
|
||||
overloads:
|
||||
'':
|
||||
ignore: true
|
||||
Velocity_t, Acceleration_t:
|
||||
param_override:
|
||||
maxVelocity:
|
||||
default: '0'
|
||||
maxAcceleration:
|
||||
default: '0'
|
||||
frc::TrapezoidProfile::State:
|
||||
force_no_default_constructor: true
|
||||
attributes:
|
||||
position:
|
||||
velocity:
|
||||
methods:
|
||||
operator==:
|
||||
cpp_code: py::self == State()
|
||||
templates:
|
||||
TrapezoidProfile:
|
||||
qualname: frc::TrapezoidProfile
|
||||
params:
|
||||
- units::dimensionless::scalar
|
||||
|
||||
# needed for HolonomicDriveController
|
||||
TrapezoidProfileRadians:
|
||||
qualname: frc::TrapezoidProfile
|
||||
params:
|
||||
- units::radian
|
||||
@@ -0,0 +1,15 @@
|
||||
defaults:
|
||||
subpackage: path
|
||||
|
||||
classes:
|
||||
frc::TravelingSalesman:
|
||||
methods:
|
||||
TravelingSalesman:
|
||||
overloads:
|
||||
'':
|
||||
std::function<double (Pose2d, Pose2d)>:
|
||||
Solve:
|
||||
overloads:
|
||||
const wpi::array<Pose2d, Poses>&, int:
|
||||
ignore: true
|
||||
std::span<const Pose2d>, int:
|
||||
Reference in New Issue
Block a user