mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +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:
@@ -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);
|
||||
Reference in New Issue
Block a user