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:
7
wpimath/src/main/python/README.md
Normal file
7
wpimath/src/main/python/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
robotpy-wpimath
|
||||
===============
|
||||
|
||||
Python wrappers for WPILib's wpimath library.
|
||||
|
||||
* Installation instructions can be found in the [RobotPy documentation](https://robotpy.readthedocs.io/en/latest/getting_started.html)
|
||||
* Documentation can be found at [readthedocs](https://robotpy.readthedocs.io/projects/wpimath/en/stable/api.html)
|
||||
39
wpimath/src/main/python/native-pyproject.toml
Normal file
39
wpimath/src/main/python/native-pyproject.toml
Normal file
@@ -0,0 +1,39 @@
|
||||
[build-system]
|
||||
build-backend = "hatchling.build"
|
||||
requires = [
|
||||
"hatchling",
|
||||
"hatch-nativelib~=0.2.0",
|
||||
"hatch-robotpy~=0.2.1",
|
||||
"robotpy-native-wpiutil==2027.0.0a2",
|
||||
]
|
||||
|
||||
[project]
|
||||
name = "robotpy-native-wpimath"
|
||||
version = "2027.0.0a2"
|
||||
description = "WPILib Math Library"
|
||||
license = "BSD-3-Clause"
|
||||
|
||||
dependencies = [
|
||||
"robotpy-native-wpiutil==2027.0.0a2",
|
||||
]
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/native"]
|
||||
|
||||
[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
|
||||
artifact_id = "wpimath-cpp"
|
||||
group_id = "edu.wpi.first.wpimath"
|
||||
repo_url = "https://frcmaven.wpi.edu/artifactory/release-2027"
|
||||
version = "2027.0.0-alpha-2"
|
||||
|
||||
extract_to = "src/native/wpimath"
|
||||
libs = ["wpimath"]
|
||||
|
||||
[[tool.hatch.build.hooks.nativelib.pcfile]]
|
||||
pcfile = "src/native/wpimath/robotpy-native-wpimath.pc"
|
||||
name = "wpimath"
|
||||
|
||||
includedir = "src/native/wpimath/include"
|
||||
libdir = "src/native/wpimath/lib"
|
||||
shared_libraries = ["wpimath"]
|
||||
requires = ["robotpy-native-wpiutil"]
|
||||
1638
wpimath/src/main/python/pyproject.toml
Normal file
1638
wpimath/src/main/python/pyproject.toml
Normal file
File diff suppressed because it is too large
Load Diff
2
wpimath/src/main/python/semiwrap/ComputerVisionUtil.yml
Normal file
2
wpimath/src/main/python/semiwrap/ComputerVisionUtil.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
functions:
|
||||
ObjectToRobotPose:
|
||||
47
wpimath/src/main/python/semiwrap/MathUtil.yml
Normal file
47
wpimath/src/main/python/semiwrap/MathUtil.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
functions:
|
||||
InputModulus:
|
||||
template_impls:
|
||||
- [double]
|
||||
AngleModulus:
|
||||
FloorDiv:
|
||||
template_impls:
|
||||
- [int64_t, int64_t]
|
||||
# work around GCC 10 issue on raspbian
|
||||
cpp_code: |
|
||||
[](int64_t x, int64_t y) -> int64_t {
|
||||
return frc::FloorDiv(x, y);
|
||||
}
|
||||
FloorMod:
|
||||
template_impls:
|
||||
- [int64_t, int64_t]
|
||||
# work around GCC 10 issue on raspbian
|
||||
cpp_code: |
|
||||
[](int64_t x, int64_t y) -> int64_t {
|
||||
return frc::FloorMod(x, y);
|
||||
}
|
||||
ApplyDeadband:
|
||||
param_override:
|
||||
maxMagnitude:
|
||||
default: '1.0'
|
||||
template_impls:
|
||||
- [double]
|
||||
CopySignPow:
|
||||
param_override:
|
||||
maxMagnitude:
|
||||
default: '1.0'
|
||||
template_impls:
|
||||
- [double]
|
||||
IsNear:
|
||||
overloads:
|
||||
T, T, T:
|
||||
ignore: true
|
||||
template_impls:
|
||||
- [double]
|
||||
T, T, T, T, T:
|
||||
ignore: true
|
||||
template_impls:
|
||||
- [double]
|
||||
SlewRateLimit:
|
||||
overloads:
|
||||
const Translation2d&, const Translation2d&, units::second_t, units::meters_per_second_t:
|
||||
const Translation3d&, const Translation3d&, units::second_t, units::meters_per_second_t:
|
||||
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:
|
||||
14
wpimath/src/main/python/semiwrap/filter/Debouncer.yml
Normal file
14
wpimath/src/main/python/semiwrap/filter/Debouncer.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
classes:
|
||||
frc::Debouncer:
|
||||
enums:
|
||||
DebounceType:
|
||||
methods:
|
||||
Debouncer:
|
||||
param_override:
|
||||
type:
|
||||
default: frc::Debouncer::DebounceType::kRising
|
||||
Calculate:
|
||||
SetDebounceTime:
|
||||
GetDebounceTime:
|
||||
SetDebounceType:
|
||||
GetDebounceType:
|
||||
29
wpimath/src/main/python/semiwrap/filter/LinearFilter.yml
Normal file
29
wpimath/src/main/python/semiwrap/filter/LinearFilter.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
classes:
|
||||
frc::LinearFilter:
|
||||
template_params:
|
||||
- T
|
||||
methods:
|
||||
LinearFilter:
|
||||
overloads:
|
||||
std::span<const double>, std::span<const double>:
|
||||
std::initializer_list<double>, std::initializer_list<double>:
|
||||
ignore: true
|
||||
SinglePoleIIR:
|
||||
HighPass:
|
||||
MovingAverage:
|
||||
Reset:
|
||||
overloads:
|
||||
'':
|
||||
std::span<const T>, std::span<const T>:
|
||||
Calculate:
|
||||
LastValue:
|
||||
BackwardFiniteDifference:
|
||||
ignore: true # TODO: template_impls
|
||||
FiniteDifference:
|
||||
ignore: true # TODO: template_impls
|
||||
|
||||
templates:
|
||||
LinearFilter:
|
||||
qualname: frc::LinearFilter
|
||||
params:
|
||||
- double
|
||||
15
wpimath/src/main/python/semiwrap/filter/MedianFilter.yml
Normal file
15
wpimath/src/main/python/semiwrap/filter/MedianFilter.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
classes:
|
||||
frc::MedianFilter:
|
||||
template_params:
|
||||
- T
|
||||
methods:
|
||||
MedianFilter:
|
||||
Calculate:
|
||||
LastValue:
|
||||
Reset:
|
||||
|
||||
templates:
|
||||
MedianFilter:
|
||||
qualname: frc::MedianFilter
|
||||
params:
|
||||
- double
|
||||
21
wpimath/src/main/python/semiwrap/filter/SlewRateLimiter.yml
Normal file
21
wpimath/src/main/python/semiwrap/filter/SlewRateLimiter.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
classes:
|
||||
frc::SlewRateLimiter:
|
||||
template_params:
|
||||
- Unit
|
||||
typealias:
|
||||
- Unit_t = units::unit_t<Unit>
|
||||
- Rate = units::compound_unit<Unit, units::inverse<units::seconds>>
|
||||
methods:
|
||||
SlewRateLimiter:
|
||||
overloads:
|
||||
Rate_t, Rate_t, Unit_t:
|
||||
Rate_t:
|
||||
Calculate:
|
||||
LastValue:
|
||||
Reset:
|
||||
|
||||
templates:
|
||||
SlewRateLimiter:
|
||||
qualname: frc::SlewRateLimiter
|
||||
params:
|
||||
- units::dimensionless::scalar
|
||||
10
wpimath/src/main/python/semiwrap/geometry/CoordinateAxis.yml
Normal file
10
wpimath/src/main/python/semiwrap/geometry/CoordinateAxis.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
classes:
|
||||
frc::CoordinateAxis:
|
||||
methods:
|
||||
CoordinateAxis:
|
||||
N:
|
||||
S:
|
||||
E:
|
||||
W:
|
||||
U:
|
||||
D:
|
||||
@@ -0,0 +1,13 @@
|
||||
classes:
|
||||
frc::CoordinateSystem:
|
||||
methods:
|
||||
CoordinateSystem:
|
||||
NWU:
|
||||
EDN:
|
||||
NED:
|
||||
Convert:
|
||||
overloads:
|
||||
const Translation3d&, const CoordinateSystem&, const CoordinateSystem&:
|
||||
const Rotation3d&, const CoordinateSystem&, const CoordinateSystem&:
|
||||
const Pose3d&, const CoordinateSystem&, const CoordinateSystem&:
|
||||
const Transform3d&, const CoordinateSystem&, const CoordinateSystem&:
|
||||
46
wpimath/src/main/python/semiwrap/geometry/Ellipse2d.yml
Normal file
46
wpimath/src/main/python/semiwrap/geometry/Ellipse2d.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
extra_includes:
|
||||
- rpy/geometryToString.h
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::Ellipse2d:
|
||||
force_type_casters:
|
||||
- units::foot_t
|
||||
- units::meter_t
|
||||
methods:
|
||||
Ellipse2d:
|
||||
overloads:
|
||||
const Pose2d&, units::meter_t, units::meter_t:
|
||||
const Translation2d&, double:
|
||||
Center:
|
||||
Rotation:
|
||||
XSemiAxis:
|
||||
ignore: true
|
||||
YSemiAxis:
|
||||
ignore: true
|
||||
FocalPoints:
|
||||
TransformBy:
|
||||
RotateBy:
|
||||
Intersects:
|
||||
Contains:
|
||||
Distance:
|
||||
operator==:
|
||||
Nearest:
|
||||
|
||||
inline_code: |-
|
||||
cls_Ellipse2d
|
||||
.def_static("fromFeet", [](const Pose2d& center, units::foot_t xSemiAxis, units::foot_t ySemiAxis) {
|
||||
return std::make_unique<Ellipse2d>(center, xSemiAxis, ySemiAxis);
|
||||
}, py::arg("center"), py::arg("xSemiAxis"), py::arg("ySemiAxis"))
|
||||
.def_property_readonly("xsemiaxis", &Ellipse2d::XSemiAxis)
|
||||
.def_property_readonly("ysemiaxis", &Ellipse2d::YSemiAxis)
|
||||
.def_property_readonly("xsemiaxis_feet", [](Ellipse2d &self) -> units::foot_t {
|
||||
return self.XSemiAxis();
|
||||
})
|
||||
.def_property_readonly("ysemiaxis_feet", [](Ellipse2d &self) -> units::foot_t {
|
||||
return self.YSemiAxis();
|
||||
})
|
||||
.def("__repr__", py::overload_cast<const Ellipse2d&>(&rpy::toString));
|
||||
|
||||
|
||||
SetupWPyStruct<frc::Ellipse2d>(cls_Ellipse2d);
|
||||
68
wpimath/src/main/python/semiwrap/geometry/Pose2d.yml
Normal file
68
wpimath/src/main/python/semiwrap/geometry/Pose2d.yml
Normal file
@@ -0,0 +1,68 @@
|
||||
extra_includes:
|
||||
- rpy/geometryToString.h
|
||||
- wpystruct.h
|
||||
|
||||
functions:
|
||||
to_json:
|
||||
ignore: true
|
||||
from_json:
|
||||
ignore: true
|
||||
classes:
|
||||
frc::Pose2d:
|
||||
force_type_casters:
|
||||
- units::foot_t
|
||||
- units::meter_t
|
||||
- units::radian_t
|
||||
methods:
|
||||
Pose2d:
|
||||
overloads:
|
||||
'':
|
||||
Translation2d, Rotation2d:
|
||||
units::meter_t, units::meter_t, Rotation2d:
|
||||
const Eigen::Matrix3d&:
|
||||
rename: fromMatrix
|
||||
keepalive: []
|
||||
Translation:
|
||||
Rotation:
|
||||
RotateBy:
|
||||
TransformBy:
|
||||
RelativeTo:
|
||||
Exp:
|
||||
Log:
|
||||
ToMatrix:
|
||||
Nearest:
|
||||
overloads:
|
||||
std::span<const Pose2d> [const]:
|
||||
std::initializer_list<Pose2d> [const]:
|
||||
ignore: true
|
||||
X:
|
||||
Y:
|
||||
operator+:
|
||||
operator-:
|
||||
operator==:
|
||||
operator*:
|
||||
operator/:
|
||||
RotateAround:
|
||||
|
||||
inline_code: |
|
||||
cls_Pose2d
|
||||
.def_static("fromFeet", [](units::foot_t x, units::foot_t y, Rotation2d r) {
|
||||
return std::make_unique<Pose2d>(x, y, r);
|
||||
}, py::arg("x"), py::arg("y"), py::arg("r"))
|
||||
.def_static("fromFeet", [](units::foot_t x, units::foot_t y, units::radian_t angle) {
|
||||
return std::make_unique<Pose2d>(x, y, Rotation2d(angle));
|
||||
}, py::arg("x"), py::arg("y"), py::arg("angle"))
|
||||
.def(py::init([](units::meter_t x, units::meter_t y, units::radian_t angle) {
|
||||
return std::make_unique<Pose2d>(x, y, angle);
|
||||
}), py::arg("x"), py::arg("y"), py::arg("angle"))
|
||||
.def_property_readonly("x", &Pose2d::X)
|
||||
.def_property_readonly("y", &Pose2d::Y)
|
||||
.def_property_readonly("x_feet", [](Pose2d * self) -> units::foot_t {
|
||||
return self->X();
|
||||
})
|
||||
.def_property_readonly("y_feet", [](Pose2d * self) -> units::foot_t {
|
||||
return self->Y();
|
||||
})
|
||||
.def("__repr__", py::overload_cast<const Pose2d&>(&rpy::toString));
|
||||
|
||||
SetupWPyStruct<frc::Pose2d>(cls_Pose2d);
|
||||
71
wpimath/src/main/python/semiwrap/geometry/Pose3d.yml
Normal file
71
wpimath/src/main/python/semiwrap/geometry/Pose3d.yml
Normal file
@@ -0,0 +1,71 @@
|
||||
extra_includes:
|
||||
- rpy/geometryToString.h
|
||||
- wpystruct.h
|
||||
|
||||
functions:
|
||||
to_json:
|
||||
ignore: true
|
||||
from_json:
|
||||
ignore: true
|
||||
RotationVectorToMatrix:
|
||||
overloads:
|
||||
const ct_vector3d&:
|
||||
ignore: true
|
||||
const Eigen::Vector3d&:
|
||||
classes:
|
||||
frc::Pose3d:
|
||||
methods:
|
||||
Pose3d:
|
||||
overloads:
|
||||
'':
|
||||
Translation3d, Rotation3d:
|
||||
units::meter_t, units::meter_t, units::meter_t, Rotation3d:
|
||||
const Pose2d&:
|
||||
keepalive: []
|
||||
const Eigen::Matrix4d&:
|
||||
rename: fromMatrix
|
||||
keepalive: []
|
||||
operator+:
|
||||
operator-:
|
||||
operator==:
|
||||
Translation:
|
||||
X:
|
||||
Y:
|
||||
Z:
|
||||
Rotation:
|
||||
operator*:
|
||||
operator/:
|
||||
RotateBy:
|
||||
RotateAround:
|
||||
TransformBy:
|
||||
RelativeTo:
|
||||
Exp:
|
||||
Log:
|
||||
ToMatrix:
|
||||
ToPose2d:
|
||||
Nearest:
|
||||
overloads:
|
||||
std::span<const Pose3d> [const]:
|
||||
std::initializer_list<Pose3d> [const]:
|
||||
ignore: true
|
||||
|
||||
inline_code: |
|
||||
cls_Pose3d
|
||||
.def_static("fromFeet", [](units::foot_t x, units::foot_t y, units::foot_t z, Rotation3d r) {
|
||||
return std::make_unique<Pose3d>(x, y, z, r);
|
||||
}, py::arg("x"), py::arg("y"), py::arg("z"), py::arg("r"))
|
||||
.def_property_readonly("x", &Pose3d::X)
|
||||
.def_property_readonly("y", &Pose3d::Y)
|
||||
.def_property_readonly("z", &Pose3d::Z)
|
||||
.def_property_readonly("x_feet", [](const Pose3d * self) -> units::foot_t {
|
||||
return self->X();
|
||||
})
|
||||
.def_property_readonly("y_feet", [](const Pose3d * self) -> units::foot_t {
|
||||
return self->Y();
|
||||
})
|
||||
.def_property_readonly("z_feet", [](const Pose3d * self) -> units::foot_t {
|
||||
return self->Z();
|
||||
})
|
||||
.def("__repr__", py::overload_cast<const Pose3d&>(&rpy::toString));
|
||||
|
||||
SetupWPyStruct<frc::Pose3d>(cls_Pose3d);
|
||||
50
wpimath/src/main/python/semiwrap/geometry/Quaternion.yml
Normal file
50
wpimath/src/main/python/semiwrap/geometry/Quaternion.yml
Normal file
@@ -0,0 +1,50 @@
|
||||
extra_includes:
|
||||
- rpy/geometryToString.h
|
||||
- wpystruct.h
|
||||
|
||||
functions:
|
||||
to_json:
|
||||
ignore: true
|
||||
from_json:
|
||||
ignore: true
|
||||
classes:
|
||||
frc::Quaternion:
|
||||
methods:
|
||||
Quaternion:
|
||||
overloads:
|
||||
'':
|
||||
double, double, double, double:
|
||||
operator+:
|
||||
operator-:
|
||||
operator*:
|
||||
overloads:
|
||||
double [const]:
|
||||
const Quaternion& [const]:
|
||||
operator/:
|
||||
operator==:
|
||||
Dot:
|
||||
Conjugate:
|
||||
Inverse:
|
||||
Normalize:
|
||||
Norm:
|
||||
Pow:
|
||||
Exp:
|
||||
overloads:
|
||||
const Quaternion& [const]:
|
||||
'[const]':
|
||||
Log:
|
||||
overloads:
|
||||
const Quaternion& [const]:
|
||||
'[const]':
|
||||
W:
|
||||
X:
|
||||
Y:
|
||||
Z:
|
||||
ToRotationVector:
|
||||
FromRotationVector:
|
||||
|
||||
inline_code: |
|
||||
cls_Quaternion
|
||||
.def("__repr__", py::overload_cast<const Quaternion&>(&rpy::toString));
|
||||
|
||||
SetupWPyStruct<frc::Quaternion>(cls_Quaternion);
|
||||
45
wpimath/src/main/python/semiwrap/geometry/Rectangle2d.yml
Normal file
45
wpimath/src/main/python/semiwrap/geometry/Rectangle2d.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
extra_includes:
|
||||
- rpy/geometryToString.h
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::Rectangle2d:
|
||||
force_type_casters:
|
||||
- units::foot_t
|
||||
- units::meter_t
|
||||
methods:
|
||||
Rectangle2d:
|
||||
overloads:
|
||||
const Pose2d&, units::meter_t, units::meter_t:
|
||||
const Translation2d&, const Translation2d&:
|
||||
Center:
|
||||
Rotation:
|
||||
XWidth:
|
||||
ignore: true
|
||||
YWidth:
|
||||
ignore: true
|
||||
TransformBy:
|
||||
RotateBy:
|
||||
Intersects:
|
||||
Contains:
|
||||
Distance:
|
||||
operator==:
|
||||
Nearest:
|
||||
|
||||
inline_code: |-
|
||||
cls_Rectangle2d
|
||||
.def_static("fromFeet", [](const Pose2d& center, units::foot_t xWidth, units::foot_t yWidth) {
|
||||
return std::make_unique<Rectangle2d>(center, xWidth, yWidth);
|
||||
}, py::arg("center"), py::arg("xWidth"), py::arg("yWidth"))
|
||||
.def_property_readonly("xwidth", &Rectangle2d::XWidth)
|
||||
.def_property_readonly("ywidth", &Rectangle2d::YWidth)
|
||||
.def_property_readonly("xwidth_feet", [](Rectangle2d &self) -> units::foot_t {
|
||||
return self.XWidth();
|
||||
})
|
||||
.def_property_readonly("ywidth_feet", [](Rectangle2d &self) -> units::foot_t {
|
||||
return self.YWidth();
|
||||
})
|
||||
.def("__repr__", py::overload_cast<const Rectangle2d&>(&rpy::toString));
|
||||
|
||||
|
||||
SetupWPyStruct<frc::Rectangle2d>(cls_Rectangle2d);
|
||||
55
wpimath/src/main/python/semiwrap/geometry/Rotation2d.yml
Normal file
55
wpimath/src/main/python/semiwrap/geometry/Rotation2d.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
extra_includes:
|
||||
- rpy/geometryToString.h
|
||||
- wpystruct.h
|
||||
|
||||
functions:
|
||||
to_json:
|
||||
ignore: true
|
||||
from_json:
|
||||
ignore: true
|
||||
classes:
|
||||
frc::Rotation2d:
|
||||
methods:
|
||||
Rotation2d:
|
||||
overloads:
|
||||
'':
|
||||
auto:
|
||||
doc: |
|
||||
Constructs a Rotation2d with the given radian value.
|
||||
:param value: The value of the angle in radians.
|
||||
param_override:
|
||||
value:
|
||||
x_type: units::radian_t
|
||||
template_impls:
|
||||
- [units::radian_t]
|
||||
double, double:
|
||||
const Eigen::Matrix2d&:
|
||||
rename: fromMatrix
|
||||
keepalive: []
|
||||
RotateBy:
|
||||
ToMatrix:
|
||||
Radians:
|
||||
Degrees:
|
||||
Cos:
|
||||
Sin:
|
||||
Tan:
|
||||
operator+:
|
||||
operator-:
|
||||
overloads:
|
||||
const Rotation2d& [const]:
|
||||
'[const]':
|
||||
operator*:
|
||||
operator/:
|
||||
operator==:
|
||||
|
||||
inline_code: |
|
||||
cls_Rotation2d
|
||||
.def_static("fromDegrees", [](units::degree_t value) {
|
||||
return std::make_unique<Rotation2d>(value);
|
||||
}, py::arg("value"))
|
||||
.def_static("fromRotations", [](units::turn_t value) {
|
||||
return std::make_unique<Rotation2d>(value);
|
||||
})
|
||||
.def("__repr__", py::overload_cast<const Rotation2d&>(&rpy::toString));
|
||||
|
||||
SetupWPyStruct<frc::Rotation2d>(cls_Rotation2d);
|
||||
71
wpimath/src/main/python/semiwrap/geometry/Rotation3d.yml
Normal file
71
wpimath/src/main/python/semiwrap/geometry/Rotation3d.yml
Normal file
@@ -0,0 +1,71 @@
|
||||
extra_includes:
|
||||
- rpy/geometryToString.h
|
||||
- wpystruct.h
|
||||
|
||||
functions:
|
||||
to_json:
|
||||
ignore: true
|
||||
from_json:
|
||||
ignore: true
|
||||
classes:
|
||||
frc::Rotation3d:
|
||||
methods:
|
||||
Rotation3d:
|
||||
overloads:
|
||||
'':
|
||||
const Quaternion&:
|
||||
keepalive: []
|
||||
units::radian_t, units::radian_t, units::radian_t:
|
||||
const Eigen::Vector3d&, units::radian_t:
|
||||
keepalive: []
|
||||
const Eigen::Vector3d&:
|
||||
keepalive: []
|
||||
const Eigen::Matrix3d&:
|
||||
keepalive: []
|
||||
const Eigen::Vector3d&, const Eigen::Vector3d&:
|
||||
keepalive: []
|
||||
const Rotation2d&:
|
||||
keepalive: []
|
||||
operator+:
|
||||
operator-:
|
||||
overloads:
|
||||
const Rotation3d& [const]:
|
||||
'[const]':
|
||||
operator*:
|
||||
operator/:
|
||||
operator==:
|
||||
RotateBy:
|
||||
GetQuaternion:
|
||||
X:
|
||||
Y:
|
||||
Z:
|
||||
Axis:
|
||||
Angle:
|
||||
ToMatrix:
|
||||
ToRotation2d:
|
||||
ToVector:
|
||||
|
||||
inline_code: |
|
||||
cls_Rotation3d
|
||||
.def_static("fromDegrees", [](units::degree_t roll, units::degree_t pitch, units::degree_t yaw) {
|
||||
return std::make_unique<Rotation3d>(roll, pitch, yaw);
|
||||
}, py::arg("roll"), py::arg("pitch"), py::arg("yaw"))
|
||||
.def_property_readonly("x", &Rotation3d::X)
|
||||
.def_property_readonly("y", &Rotation3d::Y)
|
||||
.def_property_readonly("z", &Rotation3d::Z)
|
||||
.def_property_readonly("angle", &Rotation3d::Angle)
|
||||
.def_property_readonly("x_degrees", [](const Rotation3d * self) -> units::degree_t {
|
||||
return self->X();
|
||||
})
|
||||
.def_property_readonly("y_degrees", [](const Rotation3d * self) -> units::degree_t {
|
||||
return self->Y();
|
||||
})
|
||||
.def_property_readonly("z_degrees", [](const Rotation3d * self) -> units::degree_t {
|
||||
return self->Z();
|
||||
})
|
||||
.def_property_readonly("angle_degrees", [](const Rotation3d * self) -> units::degree_t {
|
||||
return self->Angle();
|
||||
})
|
||||
.def("__repr__", py::overload_cast<const Rotation3d&>(&rpy::toString));
|
||||
|
||||
SetupWPyStruct<frc::Rotation3d>(cls_Rotation3d);
|
||||
53
wpimath/src/main/python/semiwrap/geometry/Transform2d.yml
Normal file
53
wpimath/src/main/python/semiwrap/geometry/Transform2d.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
extra_includes:
|
||||
- frc/geometry/Pose2d.h
|
||||
- rpy/geometryToString.h
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::Transform2d:
|
||||
force_type_casters:
|
||||
- units::foot_t
|
||||
- units::meter_t
|
||||
- units::radian_t
|
||||
methods:
|
||||
Transform2d:
|
||||
overloads:
|
||||
const Pose2d&, const Pose2d&:
|
||||
keepalive: []
|
||||
Translation2d, Rotation2d:
|
||||
units::meter_t, units::meter_t, Rotation2d:
|
||||
const Eigen::Matrix3d&:
|
||||
rename: fromMatrix
|
||||
keepalive: []
|
||||
'':
|
||||
Translation:
|
||||
X:
|
||||
Y:
|
||||
ToMatrix:
|
||||
Rotation:
|
||||
Inverse:
|
||||
operator*:
|
||||
operator/:
|
||||
operator==:
|
||||
operator+:
|
||||
|
||||
inline_code: |
|
||||
cls_Transform2d
|
||||
.def_static("fromFeet", [](units::foot_t x, units::foot_t y, units::radian_t angle){
|
||||
return std::make_unique<Transform2d>(Translation2d(x, y), Rotation2d(angle));
|
||||
}, py::arg("x"), py::arg("y"), py::arg("angle"))
|
||||
.def(py::init([](units::meter_t x, units::meter_t y, units::radian_t angle) {
|
||||
return std::make_unique<Transform2d>(Translation2d(x, y), Rotation2d(angle));
|
||||
}), py::arg("x"), py::arg("y"), py::arg("angle"))
|
||||
.def_property_readonly("x", &Transform2d::X)
|
||||
.def_property_readonly("y", &Transform2d::Y)
|
||||
.def_property_readonly("x_feet", [](Transform2d * self) -> units::foot_t {
|
||||
return self->X();
|
||||
})
|
||||
.def_property_readonly("y_feet", [](Transform2d * self) -> units::foot_t {
|
||||
return self->Y();
|
||||
})
|
||||
.def("__repr__", py::overload_cast<const Transform2d&>(&rpy::toString));
|
||||
;
|
||||
|
||||
SetupWPyStruct<frc::Transform2d>(cls_Transform2d);
|
||||
49
wpimath/src/main/python/semiwrap/geometry/Transform3d.yml
Normal file
49
wpimath/src/main/python/semiwrap/geometry/Transform3d.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
extra_includes:
|
||||
- rpy/geometryToString.h
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::Transform3d:
|
||||
methods:
|
||||
Transform3d:
|
||||
overloads:
|
||||
const Pose3d&, const Pose3d&:
|
||||
keepalive: []
|
||||
Translation3d, Rotation3d:
|
||||
units::meter_t, units::meter_t, units::meter_t, Rotation3d:
|
||||
const Eigen::Matrix4d&:
|
||||
rename: fromMatrix
|
||||
keepalive: []
|
||||
'':
|
||||
const frc::Transform2d&:
|
||||
keepalive: []
|
||||
Translation:
|
||||
X:
|
||||
Y:
|
||||
Z:
|
||||
ToMatrix:
|
||||
Rotation:
|
||||
Inverse:
|
||||
operator*:
|
||||
operator/:
|
||||
operator+:
|
||||
operator==:
|
||||
|
||||
|
||||
inline_code: |
|
||||
cls_Transform3d
|
||||
.def_property_readonly("x", &Transform3d::X)
|
||||
.def_property_readonly("y", &Transform3d::Y)
|
||||
.def_property_readonly("z", &Transform3d::Z)
|
||||
.def_property_readonly("x_feet", [](const Transform3d * self) -> units::foot_t {
|
||||
return self->X();
|
||||
})
|
||||
.def_property_readonly("y_feet", [](const Transform3d * self) -> units::foot_t {
|
||||
return self->Y();
|
||||
})
|
||||
.def_property_readonly("z_feet", [](const Transform3d * self) -> units::foot_t {
|
||||
return self->Z();
|
||||
})
|
||||
.def("__repr__", py::overload_cast<const Transform3d&>(&rpy::toString));
|
||||
|
||||
SetupWPyStruct<frc::Transform3d>(cls_Transform3d);
|
||||
78
wpimath/src/main/python/semiwrap/geometry/Translation2d.yml
Normal file
78
wpimath/src/main/python/semiwrap/geometry/Translation2d.yml
Normal file
@@ -0,0 +1,78 @@
|
||||
extra_includes:
|
||||
- rpy/geometryToString.h
|
||||
- wpystruct.h
|
||||
- pybind11/eigen.h
|
||||
|
||||
functions:
|
||||
to_json:
|
||||
ignore: true
|
||||
from_json:
|
||||
ignore: true
|
||||
classes:
|
||||
frc::Translation2d:
|
||||
methods:
|
||||
Translation2d:
|
||||
overloads:
|
||||
'':
|
||||
units::meter_t, units::meter_t:
|
||||
units::meter_t, const Rotation2d&:
|
||||
const Eigen::Vector2d&:
|
||||
Distance:
|
||||
X:
|
||||
Y:
|
||||
ToVector:
|
||||
Norm:
|
||||
Angle:
|
||||
RotateBy:
|
||||
RotateAround:
|
||||
Nearest:
|
||||
overloads:
|
||||
std::span<const Translation2d> [const]:
|
||||
std::initializer_list<Translation2d> [const]:
|
||||
ignore: true
|
||||
operator+:
|
||||
operator-:
|
||||
overloads:
|
||||
const Translation2d& [const]:
|
||||
'[const]':
|
||||
operator*:
|
||||
operator/:
|
||||
operator==:
|
||||
|
||||
inline_code: |
|
||||
cls_Translation2d
|
||||
.def_static("fromFeet", [](units::foot_t x, units::foot_t y){
|
||||
return std::make_unique<Translation2d>(x, y);
|
||||
}, py::arg("x"), py::arg("y"))
|
||||
.def_static("fromFeet", [](units::foot_t distance, const Rotation2d &angle) {
|
||||
return std::make_unique<Translation2d>(distance, angle);
|
||||
}, py::arg("distance"), py::arg("angle"))
|
||||
.def_property_readonly("x", &Translation2d::X)
|
||||
.def_property_readonly("y", &Translation2d::Y)
|
||||
.def_property_readonly("x_feet", [](Translation2d * self) -> units::foot_t {
|
||||
return self->X();
|
||||
})
|
||||
.def_property_readonly("y_feet", [](Translation2d * self) -> units::foot_t {
|
||||
return self->Y();
|
||||
})
|
||||
.def("distanceFeet", [](Translation2d * self, const Translation2d &other) -> units::foot_t {
|
||||
return self->Distance(other);
|
||||
})
|
||||
.def("normFeet", [](Translation2d * self) -> units::foot_t {
|
||||
return self->Norm();
|
||||
})
|
||||
.def("__abs__", &Translation2d::Norm)
|
||||
.def("__len__", [](const Translation2d& self) { return 2; })
|
||||
.def("__getitem__", [](const Translation2d& self, int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return self.X();
|
||||
case 1:
|
||||
return self.Y();
|
||||
default:
|
||||
throw std::out_of_range("Translation2d index out of range");
|
||||
}
|
||||
})
|
||||
.def("__repr__", py::overload_cast<const Translation2d&>(&rpy::toString));
|
||||
|
||||
SetupWPyStruct<frc::Translation2d>(cls_Translation2d);
|
||||
83
wpimath/src/main/python/semiwrap/geometry/Translation3d.yml
Normal file
83
wpimath/src/main/python/semiwrap/geometry/Translation3d.yml
Normal file
@@ -0,0 +1,83 @@
|
||||
extra_includes:
|
||||
- rpy/geometryToString.h
|
||||
- wpystruct.h
|
||||
- pybind11/eigen.h
|
||||
|
||||
functions:
|
||||
to_json:
|
||||
ignore: true
|
||||
from_json:
|
||||
ignore: true
|
||||
classes:
|
||||
frc::Translation3d:
|
||||
methods:
|
||||
Translation3d:
|
||||
overloads:
|
||||
'':
|
||||
units::meter_t, units::meter_t, units::meter_t:
|
||||
units::meter_t, const Rotation3d&:
|
||||
const Eigen::Vector3d&:
|
||||
const Translation2d&:
|
||||
Distance:
|
||||
X:
|
||||
Y:
|
||||
Z:
|
||||
ToVector:
|
||||
Norm:
|
||||
RotateBy:
|
||||
ToTranslation2d:
|
||||
operator+:
|
||||
operator-:
|
||||
overloads:
|
||||
const Translation3d& [const]:
|
||||
'[const]':
|
||||
operator*:
|
||||
operator/:
|
||||
operator==:
|
||||
Nearest:
|
||||
overloads:
|
||||
std::span<const Translation3d> [const]:
|
||||
std::initializer_list<Translation3d> [const]:
|
||||
ignore: true
|
||||
|
||||
RotateAround:
|
||||
inline_code: |
|
||||
cls_Translation3d
|
||||
.def_static("fromFeet", [](units::foot_t x, units::foot_t y, units::foot_t z){
|
||||
return std::make_unique<Translation3d>(x, y, z);
|
||||
}, py::arg("x"), py::arg("y"), py::arg("z"))
|
||||
.def_property_readonly("x", &Translation3d::X)
|
||||
.def_property_readonly("y", &Translation3d::Y)
|
||||
.def_property_readonly("z", &Translation3d::Z)
|
||||
.def_property_readonly("x_feet", [](const Translation3d * self) -> units::foot_t {
|
||||
return self->X();
|
||||
})
|
||||
.def_property_readonly("y_feet", [](const Translation3d * self) -> units::foot_t {
|
||||
return self->Y();
|
||||
})
|
||||
.def_property_readonly("z_feet", [](const Translation3d * self) -> units::foot_t {
|
||||
return self->Z();
|
||||
})
|
||||
.def("distanceFeet", [](Translation3d * self, const Translation3d &other) -> units::foot_t {
|
||||
return self->Distance(other);
|
||||
})
|
||||
.def("normFeet", [](const Translation3d * self) -> units::foot_t {
|
||||
return self->Norm();
|
||||
})
|
||||
.def("__abs__", &Translation3d::Norm)
|
||||
.def("__len__", [](const Translation3d& self) { return 3; })
|
||||
.def("__getitem__", [](const Translation3d& self, int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return self.X();
|
||||
case 1:
|
||||
return self.Y();
|
||||
case 2:
|
||||
return self.Z();
|
||||
default:
|
||||
throw std::out_of_range("Translation3d index out of range");
|
||||
}
|
||||
})
|
||||
.def("__repr__", py::overload_cast<const Translation3d&>(&rpy::toString));
|
||||
|
||||
SetupWPyStruct<frc::Translation3d>(cls_Translation3d);
|
||||
55
wpimath/src/main/python/semiwrap/geometry/Twist2d.yml
Normal file
55
wpimath/src/main/python/semiwrap/geometry/Twist2d.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::Twist2d:
|
||||
force_no_default_constructor: true
|
||||
attributes:
|
||||
dx:
|
||||
dy:
|
||||
dtheta:
|
||||
methods:
|
||||
operator==:
|
||||
operator*:
|
||||
|
||||
inline_code: |
|
||||
cls_Twist2d
|
||||
.def(
|
||||
py::init<units::meter_t, units::meter_t, units::radian_t>(),
|
||||
py::arg("dx") = 0, py::arg("dy") = 0, py::arg("dtheta") = 0
|
||||
)
|
||||
.def_static("fromFeet", [](units::foot_t dx, units::foot_t dy, units::radian_t dtheta){
|
||||
return Twist2d{dx, dy, dtheta};
|
||||
}, py::arg("dx") = 0, py::arg("dy") = 0, py::arg("dtheta") = 0)
|
||||
.def_property("dx_feet",
|
||||
[](Twist2d * self) -> units::foot_t {
|
||||
return self->dx;
|
||||
},
|
||||
[](Twist2d * self, units::foot_t dx) {
|
||||
self->dx = dx;
|
||||
}
|
||||
)
|
||||
.def_property("dy_feet",
|
||||
[](Twist2d * self) -> units::foot_t {
|
||||
return self->dy;
|
||||
},
|
||||
[](Twist2d * self, units::foot_t dy) {
|
||||
self->dy = dy;
|
||||
}
|
||||
)
|
||||
.def_property("dtheta_degrees",
|
||||
[](Twist2d * self) -> units::degree_t {
|
||||
return self->dtheta;
|
||||
},
|
||||
[](Twist2d * self, units::degree_t dtheta) {
|
||||
self->dtheta = dtheta;
|
||||
}
|
||||
)
|
||||
.def("__repr__", [](const Twist2d &tw) -> std::string {
|
||||
return "Twist2d(dx=" + std::to_string(tw.dx()) + ", "
|
||||
"dy=" + std::to_string(tw.dy()) + ", "
|
||||
"dtheta=" + std::to_string(tw.dtheta()) + ")";
|
||||
})
|
||||
;
|
||||
|
||||
SetupWPyStruct<frc::Twist2d>(cls_Twist2d);
|
||||
90
wpimath/src/main/python/semiwrap/geometry/Twist3d.yml
Normal file
90
wpimath/src/main/python/semiwrap/geometry/Twist3d.yml
Normal file
@@ -0,0 +1,90 @@
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::Twist3d:
|
||||
force_no_default_constructor: true
|
||||
attributes:
|
||||
dx:
|
||||
dy:
|
||||
dz:
|
||||
rx:
|
||||
ry:
|
||||
rz:
|
||||
methods:
|
||||
operator==:
|
||||
operator*:
|
||||
|
||||
inline_code: |-
|
||||
cls_Twist3d
|
||||
.def(
|
||||
py::init<units::meter_t, units::meter_t, units::meter_t,
|
||||
units::radian_t, units::radian_t, units::radian_t>(),
|
||||
py::arg("dx") = 0, py::arg("dy") = 0, py::arg("dz") = 0,
|
||||
py::arg("rx") = 0, py::arg("ry") = 0, py::arg("rz") = 0)
|
||||
.def_static("fromFeet", [](
|
||||
units::foot_t dx, units::foot_t dy, units::foot_t dz,
|
||||
units::radian_t rx, units::radian_t ry, units::radian_t rz){
|
||||
return Twist3d{dx, dy, dz, rx, ry, rz};
|
||||
},
|
||||
py::arg("dx") = 0, py::arg("dy") = 0, py::arg("dz") = 0,
|
||||
py::arg("rx") = 0, py::arg("ry") = 0, py::arg("rz") = 0)
|
||||
.def_property("dx_feet",
|
||||
[](Twist3d * self) -> units::foot_t {
|
||||
return self->dx;
|
||||
},
|
||||
[](Twist3d * self, units::foot_t dx) {
|
||||
self->dx = dx;
|
||||
}
|
||||
)
|
||||
.def_property("dy_feet",
|
||||
[](Twist3d * self) -> units::foot_t {
|
||||
return self->dy;
|
||||
},
|
||||
[](Twist3d * self, units::foot_t dy) {
|
||||
self->dy = dy;
|
||||
}
|
||||
)
|
||||
.def_property("dz_feet",
|
||||
[](Twist3d * self) -> units::foot_t {
|
||||
return self->dz;
|
||||
},
|
||||
[](Twist3d * self, units::foot_t dz) {
|
||||
self->dz = dz;
|
||||
}
|
||||
)
|
||||
.def_property("rx_degrees",
|
||||
[](Twist3d * self) -> units::degree_t {
|
||||
return self->rx;
|
||||
},
|
||||
[](Twist3d * self, units::degree_t rx) {
|
||||
self->rx = rx;
|
||||
}
|
||||
)
|
||||
.def_property("ry_degrees",
|
||||
[](Twist3d * self) -> units::degree_t {
|
||||
return self->ry;
|
||||
},
|
||||
[](Twist3d * self, units::degree_t ry) {
|
||||
self->ry = ry;
|
||||
}
|
||||
)
|
||||
.def_property("rz_degrees",
|
||||
[](Twist3d * self) -> units::degree_t {
|
||||
return self->rz;
|
||||
},
|
||||
[](Twist3d * self, units::degree_t rz) {
|
||||
self->rz = rz;
|
||||
}
|
||||
)
|
||||
.def("__repr__", [](const Twist3d &tw) -> std::string {
|
||||
return "Twist3d(dx=" + std::to_string(tw.dx()) + ", "
|
||||
"dy=" + std::to_string(tw.dy()) + ", "
|
||||
"dz=" + std::to_string(tw.dz()) + ", "
|
||||
"rx=" + std::to_string(tw.rx()) + ", "
|
||||
"ry=" + std::to_string(tw.ry()) + ", "
|
||||
"rz=" + std::to_string(tw.rz()) + ")";
|
||||
})
|
||||
;
|
||||
|
||||
SetupWPyStruct<frc::Twist3d>(cls_Twist3d);
|
||||
@@ -0,0 +1,50 @@
|
||||
extra_includes:
|
||||
- "frc/geometry/Pose3d.h"
|
||||
|
||||
classes:
|
||||
frc::TimeInterpolatableBuffer:
|
||||
template_params:
|
||||
- T
|
||||
methods:
|
||||
TimeInterpolatableBuffer:
|
||||
overloads:
|
||||
units::second_t, std::function<T (const T&, const T&, double)>:
|
||||
units::second_t:
|
||||
AddSample:
|
||||
Clear:
|
||||
Sample:
|
||||
GetInternalBuffer:
|
||||
overloads:
|
||||
"":
|
||||
'[const]':
|
||||
ignore: true
|
||||
|
||||
templates:
|
||||
TimeInterpolatablePose2dBuffer:
|
||||
qualname: frc::TimeInterpolatableBuffer
|
||||
params:
|
||||
- frc::Pose2d
|
||||
TimeInterpolatablePose3dBuffer:
|
||||
qualname: frc::TimeInterpolatableBuffer
|
||||
params:
|
||||
- frc::Pose3d
|
||||
TimeInterpolatableRotation2dBuffer:
|
||||
qualname: frc::TimeInterpolatableBuffer
|
||||
params:
|
||||
- frc::Rotation2d
|
||||
TimeInterpolatableRotation3dBuffer:
|
||||
qualname: frc::TimeInterpolatableBuffer
|
||||
params:
|
||||
- frc::Rotation3d
|
||||
TimeInterpolatableTranslation2dBuffer:
|
||||
qualname: frc::TimeInterpolatableBuffer
|
||||
params:
|
||||
- frc::Translation2d
|
||||
TimeInterpolatableTranslation3dBuffer:
|
||||
qualname: frc::TimeInterpolatableBuffer
|
||||
params:
|
||||
- frc::Translation3d
|
||||
TimeInterpolatableFloatBuffer:
|
||||
qualname: frc::TimeInterpolatableBuffer
|
||||
params:
|
||||
- double
|
||||
@@ -0,0 +1,84 @@
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::ChassisSpeeds:
|
||||
force_no_default_constructor: true
|
||||
attributes:
|
||||
vx:
|
||||
vy:
|
||||
omega:
|
||||
methods:
|
||||
ToTwist2d:
|
||||
Discretize:
|
||||
overloads:
|
||||
units::meters_per_second_t, units::meters_per_second_t, units::radians_per_second_t, units::second_t:
|
||||
const ChassisSpeeds&, units::second_t:
|
||||
operator+:
|
||||
operator-:
|
||||
overloads:
|
||||
const ChassisSpeeds& [const]:
|
||||
'[const]':
|
||||
operator*:
|
||||
operator/:
|
||||
operator==:
|
||||
ToRobotRelative:
|
||||
ToFieldRelative:
|
||||
|
||||
inline_code: |
|
||||
cls_ChassisSpeeds
|
||||
.def(
|
||||
py::init<
|
||||
units::meters_per_second_t, units::meters_per_second_t,
|
||||
units::radians_per_second_t
|
||||
>(),
|
||||
py::arg("vx") = 0, py::arg("vy") = 0, py::arg("omega") = 0
|
||||
)
|
||||
.def_static("fromFeet", [](units::feet_per_second_t vx, units::feet_per_second_t vy, units::radians_per_second_t omega){
|
||||
return ChassisSpeeds{vx, vy, omega};
|
||||
}, py::arg("vx") = 0, py::arg("vy") = 0, py::arg("omega") = 0)
|
||||
.def_property("vx_fps",
|
||||
[](ChassisSpeeds * self) -> units::feet_per_second_t {
|
||||
return self->vx;
|
||||
},
|
||||
[](ChassisSpeeds * self, units::feet_per_second_t vx) {
|
||||
self->vx = vx;
|
||||
}
|
||||
)
|
||||
.def_property("vy_fps",
|
||||
[](ChassisSpeeds * self) -> units::feet_per_second_t {
|
||||
return self->vy;
|
||||
},
|
||||
[](ChassisSpeeds * self, units::feet_per_second_t vy) {
|
||||
self->vy = vy;
|
||||
}
|
||||
)
|
||||
.def_property("omega_dps",
|
||||
[](ChassisSpeeds * self) -> units::degrees_per_second_t {
|
||||
return self->omega;
|
||||
},
|
||||
[](ChassisSpeeds * self, units::degrees_per_second_t omega) {
|
||||
self->omega = omega;
|
||||
}
|
||||
)
|
||||
.def("__len__", [](const ChassisSpeeds &self) { return 3; })
|
||||
.def("__getitem__", [](const ChassisSpeeds &self, int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return self.vx();
|
||||
case 1:
|
||||
return self.vy();
|
||||
case 2:
|
||||
return self.omega();
|
||||
default:
|
||||
throw std::out_of_range("ChassisSpeeds index out of range");
|
||||
}
|
||||
})
|
||||
.def("__repr__", [](const ChassisSpeeds &cs) -> std::string {
|
||||
return "ChassisSpeeds(vx=" + std::to_string(cs.vx()) + ", "
|
||||
"vy=" + std::to_string(cs.vy()) + ", "
|
||||
"omega=" + std::to_string(cs.omega()) + ")";
|
||||
})
|
||||
;
|
||||
|
||||
SetupWPyStruct<frc::ChassisSpeeds>(cls_ChassisSpeeds);
|
||||
@@ -0,0 +1,19 @@
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::DifferentialDriveKinematics:
|
||||
attributes:
|
||||
trackwidth:
|
||||
methods:
|
||||
DifferentialDriveKinematics:
|
||||
ToChassisSpeeds:
|
||||
ToWheelSpeeds:
|
||||
ToTwist2d:
|
||||
overloads:
|
||||
const units::meter_t, const units::meter_t [const]:
|
||||
const DifferentialDriveWheelPositions&, const DifferentialDriveWheelPositions& [const]:
|
||||
Interpolate:
|
||||
|
||||
inline_code: |
|
||||
SetupWPyStruct<frc::DifferentialDriveKinematics>(cls_DifferentialDriveKinematics);
|
||||
@@ -0,0 +1,7 @@
|
||||
classes:
|
||||
frc::DifferentialDriveOdometry:
|
||||
force_no_trampoline: true
|
||||
methods:
|
||||
DifferentialDriveOdometry:
|
||||
ResetPosition:
|
||||
Update:
|
||||
@@ -0,0 +1,7 @@
|
||||
classes:
|
||||
frc::DifferentialDriveOdometry3d:
|
||||
force_no_trampoline: true
|
||||
methods:
|
||||
DifferentialDriveOdometry3d:
|
||||
ResetPosition:
|
||||
Update:
|
||||
@@ -0,0 +1,8 @@
|
||||
classes:
|
||||
frc::DifferentialDriveWheelPositions:
|
||||
attributes:
|
||||
left:
|
||||
right:
|
||||
methods:
|
||||
operator==:
|
||||
Interpolate:
|
||||
@@ -0,0 +1,53 @@
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::DifferentialDriveWheelSpeeds:
|
||||
force_no_default_constructor: true
|
||||
attributes:
|
||||
left:
|
||||
right:
|
||||
methods:
|
||||
Desaturate:
|
||||
operator+:
|
||||
operator-:
|
||||
overloads:
|
||||
const DifferentialDriveWheelSpeeds& [const]:
|
||||
'[const]':
|
||||
operator*:
|
||||
operator/:
|
||||
|
||||
|
||||
inline_code: |
|
||||
cls_DifferentialDriveWheelSpeeds
|
||||
.def(
|
||||
py::init<units::meters_per_second_t, units::meters_per_second_t>(),
|
||||
py::arg("left") = 0, py::arg("right") = 0
|
||||
)
|
||||
.def_static("fromFeet", [](units::feet_per_second_t left, units::feet_per_second_t right){
|
||||
return DifferentialDriveWheelSpeeds{left, right};
|
||||
}, py::arg("left"), py::arg("right"))
|
||||
.def_property("left_fps",
|
||||
[](DifferentialDriveWheelSpeeds * self) -> units::feet_per_second_t {
|
||||
return self->left;
|
||||
},
|
||||
[](DifferentialDriveWheelSpeeds * self, units::feet_per_second_t left) {
|
||||
self->left = left;
|
||||
}
|
||||
)
|
||||
.def_property("right_fps",
|
||||
[](DifferentialDriveWheelSpeeds * self) -> units::feet_per_second_t {
|
||||
return self->right;
|
||||
},
|
||||
[](DifferentialDriveWheelSpeeds * self, units::feet_per_second_t right) {
|
||||
self->right = right;
|
||||
}
|
||||
)
|
||||
.def("__repr__", [](const DifferentialDriveWheelSpeeds &dds) -> std::string {
|
||||
return "DifferentialDriveWheelSpeeds(left=" + std::to_string(dds.left()) + ", "
|
||||
"right=" + std::to_string(dds.right()) + ")";
|
||||
})
|
||||
;
|
||||
|
||||
SetupWPyStruct<frc::DifferentialDriveWheelSpeeds>(cls_DifferentialDriveWheelSpeeds);
|
||||
|
||||
53
wpimath/src/main/python/semiwrap/kinematics/Kinematics.yml
Normal file
53
wpimath/src/main/python/semiwrap/kinematics/Kinematics.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
extra_includes:
|
||||
- frc/kinematics/DifferentialDriveWheelPositions.h
|
||||
- frc/kinematics/DifferentialDriveWheelSpeeds.h
|
||||
- frc/kinematics/MecanumDriveWheelPositions.h
|
||||
- frc/kinematics/MecanumDriveWheelSpeeds.h
|
||||
- frc/kinematics/SwerveDriveKinematics.h
|
||||
|
||||
|
||||
classes:
|
||||
frc::Kinematics:
|
||||
force_type_casters:
|
||||
- wpi::array
|
||||
template_params:
|
||||
- WheelSpeeds
|
||||
- WheelPositions
|
||||
methods:
|
||||
ToChassisSpeeds:
|
||||
ToWheelSpeeds:
|
||||
ToTwist2d:
|
||||
Interpolate:
|
||||
|
||||
|
||||
templates:
|
||||
DifferentialDriveKinematicsBase:
|
||||
qualname: frc::Kinematics
|
||||
params:
|
||||
- frc::DifferentialDriveWheelSpeeds
|
||||
- frc::DifferentialDriveWheelPositions
|
||||
MecanumDriveKinematicsBase:
|
||||
qualname: frc::Kinematics
|
||||
params:
|
||||
- frc::MecanumDriveWheelSpeeds
|
||||
- frc::MecanumDriveWheelPositions
|
||||
SwerveDrive2KinematicsBase:
|
||||
qualname: frc::Kinematics
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,2>
|
||||
- wpi::array<frc::SwerveModulePosition,2>
|
||||
SwerveDrive3KinematicsBase:
|
||||
qualname: frc::Kinematics
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,3>
|
||||
- wpi::array<frc::SwerveModulePosition,3>
|
||||
SwerveDrive4KinematicsBase:
|
||||
qualname: frc::Kinematics
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,4>
|
||||
- wpi::array<frc::SwerveModulePosition,4>
|
||||
SwerveDrive6KinematicsBase:
|
||||
qualname: frc::Kinematics
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,6>
|
||||
- wpi::array<frc::SwerveModulePosition,6>
|
||||
@@ -0,0 +1,50 @@
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::MecanumDriveKinematics:
|
||||
methods:
|
||||
MecanumDriveKinematics:
|
||||
ToWheelSpeeds:
|
||||
doc: |
|
||||
Performs inverse kinematics to return the wheel speeds from a desired
|
||||
chassis velocity. This method is often used to convert joystick values into
|
||||
wheel speeds.
|
||||
|
||||
This function also supports variable centers of rotation. During normal
|
||||
operations, the center of rotation is usually the same as the physical
|
||||
center of the robot; therefore, the argument is defaulted to that use case.
|
||||
However, if you wish to change the center of rotation for evasive
|
||||
maneuvers, vision alignment, or for any other use case, you can do so.
|
||||
|
||||
:param chassisSpeeds: The desired chassis speed.
|
||||
:param centerOfRotation: The center of rotation. For example, if you set the
|
||||
center of rotation at one corner of the robot and
|
||||
provide a chassis speed that only has a dtheta
|
||||
component, the robot will rotate around that
|
||||
corner.
|
||||
|
||||
:returns: The wheel speeds. Use caution because they are not normalized.
|
||||
Sometimes, a user input may cause one of the wheel speeds to go
|
||||
above the attainable max velocity. Use the
|
||||
:meth:`MecanumDriveWheelSpeeds.normalize` method to rectify
|
||||
this issue. In addition, you can use Python unpacking syntax
|
||||
to directly assign the wheel speeds to variables::
|
||||
|
||||
fl, fr, bl, br = kinematics.toWheelSpeeds(chassisSpeeds)
|
||||
overloads:
|
||||
const ChassisSpeeds&, const Translation2d& [const]:
|
||||
const ChassisSpeeds& [const]:
|
||||
ToChassisSpeeds:
|
||||
ToTwist2d:
|
||||
overloads:
|
||||
const MecanumDriveWheelPositions&, const MecanumDriveWheelPositions& [const]:
|
||||
const MecanumDriveWheelPositions& [const]:
|
||||
GetFrontLeft:
|
||||
GetFrontRight:
|
||||
GetRearLeft:
|
||||
GetRearRight:
|
||||
Interpolate:
|
||||
|
||||
inline_code: |
|
||||
SetupWPyStruct<frc::MecanumDriveKinematics>(cls_MecanumDriveKinematics);
|
||||
@@ -0,0 +1,5 @@
|
||||
classes:
|
||||
frc::MecanumDriveOdometry:
|
||||
force_no_trampoline: true
|
||||
methods:
|
||||
MecanumDriveOdometry:
|
||||
@@ -0,0 +1,5 @@
|
||||
classes:
|
||||
frc::MecanumDriveOdometry3d:
|
||||
force_no_trampoline: true
|
||||
methods:
|
||||
MecanumDriveOdometry3d:
|
||||
@@ -0,0 +1,10 @@
|
||||
classes:
|
||||
frc::MecanumDriveWheelPositions:
|
||||
attributes:
|
||||
frontLeft:
|
||||
frontRight:
|
||||
rearLeft:
|
||||
rearRight:
|
||||
methods:
|
||||
operator==:
|
||||
Interpolate:
|
||||
@@ -0,0 +1,81 @@
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::MecanumDriveWheelSpeeds:
|
||||
force_no_default_constructor: true
|
||||
attributes:
|
||||
frontLeft:
|
||||
frontRight:
|
||||
rearLeft:
|
||||
rearRight:
|
||||
methods:
|
||||
Desaturate:
|
||||
operator+:
|
||||
operator-:
|
||||
overloads:
|
||||
const MecanumDriveWheelSpeeds& [const]:
|
||||
'[const]':
|
||||
operator*:
|
||||
operator/:
|
||||
|
||||
inline_code: |
|
||||
cls_MecanumDriveWheelSpeeds
|
||||
.def(
|
||||
py::init<
|
||||
units::meters_per_second_t, units::meters_per_second_t,
|
||||
units::meters_per_second_t, units::meters_per_second_t
|
||||
>(),
|
||||
py::arg("frontLeft") = 0, py::arg("frontRight") = 0,
|
||||
py::arg("rearLeft") = 0, py::arg("rearRight") = 0
|
||||
)
|
||||
.def_static("fromFeet", [](
|
||||
units::feet_per_second_t frontLeft,
|
||||
units::feet_per_second_t frontRight,
|
||||
units::feet_per_second_t rearLeft,
|
||||
units::feet_per_second_t rearRight
|
||||
){
|
||||
return MecanumDriveWheelSpeeds{frontLeft, frontRight, rearLeft, rearRight};
|
||||
}, py::arg("frontLeft"), py::arg("frontRight"),
|
||||
py::arg("rearLeft"), py::arg("rearRight"))
|
||||
.def_property("frontLeft_fps",
|
||||
[](MecanumDriveWheelSpeeds * self) -> units::feet_per_second_t {
|
||||
return self->frontLeft;
|
||||
},
|
||||
[](MecanumDriveWheelSpeeds * self, units::feet_per_second_t fps) {
|
||||
self->frontLeft = fps;
|
||||
}
|
||||
)
|
||||
.def_property("frontRight_fps",
|
||||
[](MecanumDriveWheelSpeeds * self) -> units::feet_per_second_t {
|
||||
return self->frontRight;
|
||||
},
|
||||
[](MecanumDriveWheelSpeeds * self, units::feet_per_second_t fps) {
|
||||
self->frontRight = fps;
|
||||
}
|
||||
)
|
||||
.def_property("rearLeft_fps",
|
||||
[](MecanumDriveWheelSpeeds * self) -> units::feet_per_second_t {
|
||||
return self->rearLeft;
|
||||
},
|
||||
[](MecanumDriveWheelSpeeds * self, units::feet_per_second_t fps) {
|
||||
self->rearLeft = fps;
|
||||
}
|
||||
)
|
||||
.def_property("rearRight_fps",
|
||||
[](MecanumDriveWheelSpeeds * self) -> units::feet_per_second_t {
|
||||
return self->rearRight;
|
||||
},
|
||||
[](MecanumDriveWheelSpeeds * self, units::feet_per_second_t fps) {
|
||||
self->rearRight = fps;
|
||||
}
|
||||
)
|
||||
.def("__repr__", [](const MecanumDriveWheelSpeeds &ms) -> std::string {
|
||||
return "MecanumDriveWheelSpeeds(frontLeft=" + std::to_string(ms.frontLeft()) + ", "
|
||||
"frontRight=" + std::to_string(ms.frontRight()) + ", "
|
||||
"rearLeft=" + std::to_string(ms.rearLeft()) + ", "
|
||||
"rearRight=" + std::to_string(ms.rearRight()) + ")";
|
||||
})
|
||||
;
|
||||
|
||||
SetupWPyStruct<frc::MecanumDriveWheelSpeeds>(cls_MecanumDriveWheelSpeeds);
|
||||
52
wpimath/src/main/python/semiwrap/kinematics/Odometry.yml
Normal file
52
wpimath/src/main/python/semiwrap/kinematics/Odometry.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
extra_includes:
|
||||
- frc/kinematics/DifferentialDriveWheelPositions.h
|
||||
- frc/kinematics/DifferentialDriveWheelSpeeds.h
|
||||
- frc/kinematics/MecanumDriveWheelPositions.h
|
||||
- frc/kinematics/MecanumDriveWheelSpeeds.h
|
||||
- frc/kinematics/SwerveDriveKinematics.h
|
||||
|
||||
classes:
|
||||
frc::Odometry:
|
||||
template_params:
|
||||
- WheelSpeeds
|
||||
- WheelPositions
|
||||
methods:
|
||||
Odometry:
|
||||
ResetPosition:
|
||||
ResetPose:
|
||||
ResetTranslation:
|
||||
ResetRotation:
|
||||
GetPose:
|
||||
Update:
|
||||
|
||||
templates:
|
||||
DifferentialDriveOdometryBase:
|
||||
qualname: frc::Odometry
|
||||
params:
|
||||
- frc::DifferentialDriveWheelSpeeds
|
||||
- frc::DifferentialDriveWheelPositions
|
||||
MecanumDriveOdometryBase:
|
||||
qualname: frc::Odometry
|
||||
params:
|
||||
- frc::MecanumDriveWheelSpeeds
|
||||
- frc::MecanumDriveWheelPositions
|
||||
SwerveDrive2OdometryBase:
|
||||
qualname: frc::Odometry
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,2>
|
||||
- wpi::array<frc::SwerveModulePosition,2>
|
||||
SwerveDrive3OdometryBase:
|
||||
qualname: frc::Odometry
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,3>
|
||||
- wpi::array<frc::SwerveModulePosition,3>
|
||||
SwerveDrive4OdometryBase:
|
||||
qualname: frc::Odometry
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,4>
|
||||
- wpi::array<frc::SwerveModulePosition,4>
|
||||
SwerveDrive6OdometryBase:
|
||||
qualname: frc::Odometry
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,6>
|
||||
- wpi::array<frc::SwerveModulePosition,6>
|
||||
53
wpimath/src/main/python/semiwrap/kinematics/Odometry3d.yml
Normal file
53
wpimath/src/main/python/semiwrap/kinematics/Odometry3d.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
extra_includes:
|
||||
- frc/kinematics/DifferentialDriveWheelPositions.h
|
||||
- frc/kinematics/DifferentialDriveWheelSpeeds.h
|
||||
- frc/kinematics/MecanumDriveWheelPositions.h
|
||||
- frc/kinematics/MecanumDriveWheelSpeeds.h
|
||||
- frc/kinematics/SwerveDriveKinematics.h
|
||||
|
||||
classes:
|
||||
frc::Odometry3d:
|
||||
template_params:
|
||||
- WheelSpeeds
|
||||
- WheelPositions
|
||||
methods:
|
||||
Odometry3d:
|
||||
ResetPosition:
|
||||
ResetPose:
|
||||
ResetTranslation:
|
||||
ResetRotation:
|
||||
GetPose:
|
||||
Update:
|
||||
|
||||
|
||||
templates:
|
||||
DifferentialDriveOdometry3dBase:
|
||||
qualname: frc::Odometry3d
|
||||
params:
|
||||
- frc::DifferentialDriveWheelSpeeds
|
||||
- frc::DifferentialDriveWheelPositions
|
||||
MecanumDriveOdometry3dBase:
|
||||
qualname: frc::Odometry3d
|
||||
params:
|
||||
- frc::MecanumDriveWheelSpeeds
|
||||
- frc::MecanumDriveWheelPositions
|
||||
SwerveDrive2Odometry3dBase:
|
||||
qualname: frc::Odometry3d
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,2>
|
||||
- wpi::array<frc::SwerveModulePosition,2>
|
||||
SwerveDrive3Odometry3dBase:
|
||||
qualname: frc::Odometry3d
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,3>
|
||||
- wpi::array<frc::SwerveModulePosition,3>
|
||||
SwerveDrive4Odometry3dBase:
|
||||
qualname: frc::Odometry3d
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,4>
|
||||
- wpi::array<frc::SwerveModulePosition,4>
|
||||
SwerveDrive6Odometry3dBase:
|
||||
qualname: frc::Odometry3d
|
||||
params:
|
||||
- wpi::array<frc::SwerveModuleState,6>
|
||||
- wpi::array<frc::SwerveModulePosition,6>
|
||||
@@ -0,0 +1,108 @@
|
||||
classes:
|
||||
frc::SwerveDriveKinematics:
|
||||
force_type_casters:
|
||||
- wpi::array
|
||||
template_params:
|
||||
- size_t NumModules
|
||||
methods:
|
||||
SwerveDriveKinematics:
|
||||
overloads:
|
||||
ModuleTranslations&&...:
|
||||
ignore: true
|
||||
const wpi::array<Translation2d, NumModules>&:
|
||||
ignore: true
|
||||
|
||||
ResetHeadings:
|
||||
overloads:
|
||||
ModuleHeadings&&...:
|
||||
ignore: true
|
||||
wpi::array<Rotation2d, NumModules>:
|
||||
|
||||
ToSwerveModuleStates:
|
||||
doc: |
|
||||
Performs inverse kinematics to return the module states from a desired
|
||||
chassis velocity. This method is often used to convert joystick values into
|
||||
module speeds and angles.
|
||||
|
||||
This function also supports variable centers of rotation. During normal
|
||||
operations, the center of rotation is usually the same as the physical
|
||||
center of the robot; therefore, the argument is defaulted to that use case.
|
||||
However, if you wish to change the center of rotation for evasive
|
||||
maneuvers, vision alignment, or for any other use case, you can do so.
|
||||
|
||||
:param chassisSpeeds: The desired chassis speed.
|
||||
:param centerOfRotation: The center of rotation. For example, if you set the
|
||||
center of rotation at one corner of the robot and provide a chassis speed
|
||||
that only has a dtheta component, the robot will rotate around that corner.
|
||||
|
||||
:returns: An array containing the module states. Use caution because these
|
||||
module states are not normalized. Sometimes, a user input may cause one of
|
||||
the module speeds to go above the attainable max velocity. Use the
|
||||
:meth:`desaturateWheelSpeeds` function to rectify this issue.
|
||||
In addition, you can use Python unpacking syntax
|
||||
to directly assign the module states to variables::
|
||||
|
||||
fl, fr, bl, br = kinematics.toSwerveModuleStates(chassisSpeeds)
|
||||
ToWheelSpeeds:
|
||||
ToChassisSpeeds:
|
||||
overloads:
|
||||
ModuleStates&&... [const]:
|
||||
ignore: true
|
||||
const wpi::array<SwerveModuleState, NumModules>& [const]:
|
||||
ToTwist2d:
|
||||
overloads:
|
||||
ModuleDeltas&&... [const]:
|
||||
ignore: true
|
||||
wpi::array<SwerveModulePosition, NumModules> [const]:
|
||||
const wpi::array<SwerveModulePosition, NumModules>&, const wpi::array<SwerveModulePosition, NumModules>& [const]:
|
||||
DesaturateWheelSpeeds:
|
||||
overloads:
|
||||
wpi::array<SwerveModuleState, NumModules>*, units::meters_per_second_t:
|
||||
cpp_code: |
|
||||
[](wpi::array<SwerveModuleState, NumModules> moduleStates, units::meters_per_second_t attainableMaxSpeed) {
|
||||
frc::SwerveDriveKinematics<NumModules>::DesaturateWheelSpeeds(&moduleStates, attainableMaxSpeed);
|
||||
return moduleStates;
|
||||
}
|
||||
? wpi::array<SwerveModuleState, NumModules>*, ChassisSpeeds, units::meters_per_second_t, units::meters_per_second_t, units::radians_per_second_t
|
||||
: cpp_code: |
|
||||
[](wpi::array<SwerveModuleState, NumModules> moduleStates,
|
||||
ChassisSpeeds currentChassisSpeed,
|
||||
units::meters_per_second_t attainableMaxModuleSpeed,
|
||||
units::meters_per_second_t attainableMaxRobotTranslationSpeed,
|
||||
units::radians_per_second_t attainableMaxRobotRotationSpeed) {
|
||||
frc::SwerveDriveKinematics<NumModules>::DesaturateWheelSpeeds(&moduleStates, currentChassisSpeed, attainableMaxModuleSpeed, attainableMaxRobotTranslationSpeed, attainableMaxRobotRotationSpeed);
|
||||
return moduleStates;
|
||||
}
|
||||
|
||||
Interpolate:
|
||||
GetModules:
|
||||
|
||||
template_inline_code: |
|
||||
if constexpr (NumModules == 2) {
|
||||
cls_SwerveDriveKinematics.def(py::init<Translation2d, Translation2d>());
|
||||
} else if constexpr (NumModules == 3) {
|
||||
cls_SwerveDriveKinematics.def(py::init<Translation2d, Translation2d, Translation2d>());
|
||||
} else if constexpr (NumModules == 4) {
|
||||
cls_SwerveDriveKinematics.def(py::init<Translation2d, Translation2d, Translation2d, Translation2d>());
|
||||
} else if constexpr (NumModules == 6) {
|
||||
cls_SwerveDriveKinematics.def(py::init<Translation2d, Translation2d, Translation2d, Translation2d, Translation2d, Translation2d>());
|
||||
}
|
||||
|
||||
|
||||
templates:
|
||||
SwerveDrive2Kinematics:
|
||||
qualname: frc::SwerveDriveKinematics
|
||||
params:
|
||||
- 2
|
||||
SwerveDrive3Kinematics:
|
||||
qualname: frc::SwerveDriveKinematics
|
||||
params:
|
||||
- 3
|
||||
SwerveDrive4Kinematics:
|
||||
qualname: frc::SwerveDriveKinematics
|
||||
params:
|
||||
- 4
|
||||
SwerveDrive6Kinematics:
|
||||
qualname: frc::SwerveDriveKinematics
|
||||
params:
|
||||
- 6
|
||||
@@ -0,0 +1,24 @@
|
||||
classes:
|
||||
frc::SwerveDriveOdometry:
|
||||
force_no_trampoline: true
|
||||
template_params:
|
||||
- size_t NumModules
|
||||
methods:
|
||||
SwerveDriveOdometry:
|
||||
templates:
|
||||
SwerveDrive2Odometry:
|
||||
qualname: frc::SwerveDriveOdometry
|
||||
params:
|
||||
- 2
|
||||
SwerveDrive3Odometry:
|
||||
qualname: frc::SwerveDriveOdometry
|
||||
params:
|
||||
- 3
|
||||
SwerveDrive4Odometry:
|
||||
qualname: frc::SwerveDriveOdometry
|
||||
params:
|
||||
- 4
|
||||
SwerveDrive6Odometry:
|
||||
qualname: frc::SwerveDriveOdometry
|
||||
params:
|
||||
- 6
|
||||
@@ -0,0 +1,25 @@
|
||||
classes:
|
||||
frc::SwerveDriveOdometry3d:
|
||||
force_no_trampoline: true
|
||||
template_params:
|
||||
- size_t NumModules
|
||||
methods:
|
||||
SwerveDriveOdometry3d:
|
||||
|
||||
templates:
|
||||
SwerveDrive2Odometry3d:
|
||||
qualname: frc::SwerveDriveOdometry3d
|
||||
params:
|
||||
- 2
|
||||
SwerveDrive3Odometry3d:
|
||||
qualname: frc::SwerveDriveOdometry3d
|
||||
params:
|
||||
- 3
|
||||
SwerveDrive4Odometry3d:
|
||||
qualname: frc::SwerveDriveOdometry3d
|
||||
params:
|
||||
- 4
|
||||
SwerveDrive6Odometry3d:
|
||||
qualname: frc::SwerveDriveOdometry3d
|
||||
params:
|
||||
- 6
|
||||
@@ -0,0 +1,34 @@
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::SwerveModulePosition:
|
||||
force_no_default_constructor: true
|
||||
attributes:
|
||||
distance:
|
||||
angle:
|
||||
methods:
|
||||
Interpolate:
|
||||
operator==:
|
||||
inline_code: |
|
||||
.def(
|
||||
py::init<
|
||||
units::meter_t, frc::Rotation2d
|
||||
>(),
|
||||
py::arg("distance") = 0, py::arg("angle") = frc::Rotation2d()
|
||||
)
|
||||
.def_property("distance_ft",
|
||||
[](SwerveModulePosition * self) -> units::foot_t {
|
||||
return self->distance;
|
||||
},
|
||||
[](SwerveModulePosition * self, units::foot_t distance) {
|
||||
self->distance = distance;
|
||||
}
|
||||
)
|
||||
.def("__repr__", [](const SwerveModulePosition &ss) -> std::string {
|
||||
return "SwerveModulePosition(distance=" + std::to_string(ss.distance()) + ", "
|
||||
"angle=" + std::to_string(ss.angle.Radians()()) + ")";
|
||||
})
|
||||
|
||||
inline_code: |
|
||||
SetupWPyStruct<frc::SwerveModulePosition>(cls_SwerveModulePosition);
|
||||
@@ -0,0 +1,41 @@
|
||||
extra_includes:
|
||||
- wpystruct.h
|
||||
|
||||
classes:
|
||||
frc::SwerveModuleState:
|
||||
force_no_default_constructor: true
|
||||
attributes:
|
||||
speed:
|
||||
angle:
|
||||
methods:
|
||||
operator==:
|
||||
Optimize:
|
||||
overloads:
|
||||
const Rotation2d&:
|
||||
const SwerveModuleState&, const Rotation2d&:
|
||||
ignore: true
|
||||
CosineScale:
|
||||
|
||||
inline_code: |
|
||||
cls_SwerveModuleState
|
||||
.def(
|
||||
py::init<
|
||||
units::meters_per_second_t, frc::Rotation2d
|
||||
>(),
|
||||
py::arg("speed") = 0, py::arg("angle") = frc::Rotation2d()
|
||||
)
|
||||
.def_property("speed_fps",
|
||||
[](SwerveModuleState * self) -> units::feet_per_second_t {
|
||||
return self->speed;
|
||||
},
|
||||
[](SwerveModuleState * self, units::feet_per_second_t speed) {
|
||||
self->speed = speed;
|
||||
}
|
||||
)
|
||||
.def("__repr__", [](const SwerveModuleState &ss) -> std::string {
|
||||
return "SwerveModuleState(speed=" + std::to_string(ss.speed()) + ", "
|
||||
"angle=" + std::to_string(ss.angle.Radians()()) + ")";
|
||||
})
|
||||
;
|
||||
|
||||
SetupWPyStruct<frc::SwerveModuleState>(cls_SwerveModuleState);
|
||||
@@ -0,0 +1,10 @@
|
||||
classes:
|
||||
frc::CubicHermiteSpline:
|
||||
force_no_trampoline: true
|
||||
methods:
|
||||
CubicHermiteSpline:
|
||||
Coefficients:
|
||||
# otherwise we have to depend on numpy
|
||||
ignore: true
|
||||
GetInitialControlVector:
|
||||
GetFinalControlVector:
|
||||
@@ -0,0 +1,9 @@
|
||||
classes:
|
||||
frc::QuinticHermiteSpline:
|
||||
force_no_trampoline: true
|
||||
methods:
|
||||
QuinticHermiteSpline:
|
||||
Coefficients:
|
||||
ignore: true
|
||||
GetInitialControlVector:
|
||||
GetFinalControlVector:
|
||||
49
wpimath/src/main/python/semiwrap/spline/Spline.yml
Normal file
49
wpimath/src/main/python/semiwrap/spline/Spline.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
extra_includes:
|
||||
- pybind11/stl.h
|
||||
|
||||
classes:
|
||||
frc::Spline:
|
||||
is_polymorphic: true
|
||||
force_type_casters:
|
||||
- units::curvature_t
|
||||
- wpi::array
|
||||
template_params:
|
||||
- int Degree
|
||||
methods:
|
||||
Spline:
|
||||
GetPoint:
|
||||
Coefficients:
|
||||
ignore_pure: true
|
||||
GetInitialControlVector:
|
||||
ignore_pure: true
|
||||
GetFinalControlVector:
|
||||
ignore_pure: true
|
||||
ToVector:
|
||||
ignore: true
|
||||
FromVector:
|
||||
ignore: true
|
||||
template_inline_code: |
|
||||
cls_ControlVector
|
||||
.def(
|
||||
py::init<
|
||||
wpi::array<double, (Degree + 1) / 2>,
|
||||
wpi::array<double, (Degree + 1) / 2>>(),
|
||||
py::arg("x"),
|
||||
py::arg("y")
|
||||
);
|
||||
frc::Spline::ControlVector:
|
||||
force_no_default_constructor: true
|
||||
attributes:
|
||||
x:
|
||||
y:
|
||||
|
||||
templates:
|
||||
Spline3:
|
||||
qualname: frc::Spline
|
||||
params:
|
||||
- 3
|
||||
|
||||
Spline5:
|
||||
qualname: frc::Spline
|
||||
params:
|
||||
- 5
|
||||
8
wpimath/src/main/python/semiwrap/spline/SplineHelper.yml
Normal file
8
wpimath/src/main/python/semiwrap/spline/SplineHelper.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
classes:
|
||||
frc::SplineHelper:
|
||||
methods:
|
||||
CubicControlVectorsFromWaypoints:
|
||||
QuinticSplinesFromWaypoints:
|
||||
CubicSplinesFromControlVectors:
|
||||
QuinticSplinesFromControlVectors:
|
||||
OptimizeCurvature:
|
||||
@@ -0,0 +1,13 @@
|
||||
classes:
|
||||
frc::SplineParameterizer:
|
||||
force_no_default_constructor: true
|
||||
force_type_casters:
|
||||
- units::curvature_t
|
||||
methods:
|
||||
Parameterize:
|
||||
template_impls:
|
||||
- ['3']
|
||||
- ['5']
|
||||
|
||||
frc::SplineParameterizer::MalformedSplineException:
|
||||
ignore: true
|
||||
92
wpimath/src/main/python/tools/create_units.py
Executable file
92
wpimath/src/main/python/tools/create_units.py
Executable file
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import io
|
||||
import inspect
|
||||
import pathlib
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import toml
|
||||
|
||||
out = {}
|
||||
|
||||
for f in sorted(pathlib.Path(sys.argv[1]).glob("*.h")):
|
||||
if f.name == "base.h":
|
||||
continue
|
||||
|
||||
names = []
|
||||
|
||||
with open(f) as fp:
|
||||
last_line = None
|
||||
for line in fp.readlines():
|
||||
line = line.strip()
|
||||
if last_line is not None:
|
||||
line = last_line + line
|
||||
last_line = None
|
||||
elif line.endswith("(") or line.endswith(","):
|
||||
last_line = line
|
||||
continue
|
||||
|
||||
m = re.match(r"UNIT_ADD\(\w+, (\w+), (\w+),", line)
|
||||
if m:
|
||||
names.append((m.group(1), m.group(2)))
|
||||
else:
|
||||
m = re.match(r"UNIT_ADD_WITH_METRIC_PREFIXES\(\w+, (\w+), (\w+),", line)
|
||||
if m:
|
||||
names.append((m.group(1), m.group(2)))
|
||||
for i in ("nano", "micro", "milli", "kilo"):
|
||||
names.append((f"{i}{m.group(1)}", f"{i}{m.group(2)}"))
|
||||
|
||||
out_name = f"units_{f.name[:-2]}_type_caster.h"
|
||||
|
||||
if names:
|
||||
if True:
|
||||
ofp = io.StringIO()
|
||||
|
||||
ofp.write("#pragma once\n")
|
||||
ofp.write("\n")
|
||||
ofp.write(f"#include <units/{f.name}>\n")
|
||||
ofp.write("\n")
|
||||
|
||||
ofp.write("\nnamespace pybind11 { namespace detail {\n")
|
||||
|
||||
for single, double in names:
|
||||
ofp.write(
|
||||
inspect.cleandoc(
|
||||
f"""
|
||||
|
||||
template <> struct handle_type_name<units::{single}_t> {{
|
||||
static constexpr auto name = _("{double}");
|
||||
}};
|
||||
|
||||
template <> struct handle_type_name<units::{double}> {{
|
||||
static constexpr auto name = _("{double}");
|
||||
}};
|
||||
|
||||
"""
|
||||
)
|
||||
)
|
||||
ofp.write("\n\n")
|
||||
|
||||
ofp.write("\n}\n}\n\n")
|
||||
|
||||
ofp.write(f'#include "_units_base_type_caster.h"\n')
|
||||
ofp.write("\n")
|
||||
|
||||
ofp.seek(0)
|
||||
|
||||
content = subprocess.check_output(
|
||||
["clang-format"], input=ofp.getvalue(), encoding="utf-8"
|
||||
)
|
||||
|
||||
with open(out_name, "w+") as fp:
|
||||
fp.write(content)
|
||||
else:
|
||||
out[out_name] = sorted(
|
||||
[f"units::{single}_t" for single, _ in names]
|
||||
+ [f"units::{single}" for single, _ in names]
|
||||
+ [f"units::{double}" for _, double in names]
|
||||
)
|
||||
|
||||
|
||||
print(toml.dumps(dict(sup=out)))
|
||||
25
wpimath/src/main/python/wpimath/__init__.py
Normal file
25
wpimath/src/main/python/wpimath/__init__.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from . import _init__wpimath # noqa: F401
|
||||
|
||||
# Needed for stubgen
|
||||
from . import geometry
|
||||
|
||||
# autogenerated by 'semiwrap create-imports wpimath wpimath._wpimath'
|
||||
from ._wpimath import (
|
||||
angleModulus,
|
||||
applyDeadband,
|
||||
floorDiv,
|
||||
floorMod,
|
||||
inputModulus,
|
||||
objectToRobotPose,
|
||||
slewRateLimit,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"angleModulus",
|
||||
"applyDeadband",
|
||||
"floorDiv",
|
||||
"floorMod",
|
||||
"inputModulus",
|
||||
"objectToRobotPose",
|
||||
"slewRateLimit",
|
||||
]
|
||||
1
wpimath/src/main/python/wpimath/_controls/__init__.py
Normal file
1
wpimath/src/main/python/wpimath/_controls/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import _init__controls
|
||||
7
wpimath/src/main/python/wpimath/_controls/controls.cpp
Normal file
7
wpimath/src/main/python/wpimath/_controls/controls.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
#include "semiwrap_init.wpimath._controls._controls.hpp"
|
||||
|
||||
SEMIWRAP_PYBIND11_MODULE(m)
|
||||
{
|
||||
initWrapper(m);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user