mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[copybara] Resync robotpy (#8585)
Project import generated by Copybara.
GitOrigin-RevId: fd000778e9b78c72cc7ca7b2ebe476129b78c6e0
This commit is contained in:
@@ -25,9 +25,31 @@ classes:
|
||||
CalculateX:
|
||||
CalculateY:
|
||||
Slice:
|
||||
# TODO?
|
||||
ignore: true
|
||||
|
||||
template_inline_code: |
|
||||
cls_LinearSystem.def("slice", [](wpi::math::LinearSystem<States, Inputs, Outputs> &self, int idx0) {
|
||||
return self.Slice(idx0);
|
||||
}, py::arg("outputIndex"),
|
||||
py::doc("Returns the LinearSystem with the outputs listed in outputIndices.")
|
||||
);
|
||||
|
||||
if constexpr (Outputs > 1) {
|
||||
cls_LinearSystem.def("slice", [](wpi::math::LinearSystem<States, Inputs, Outputs> &self, int idx0, int idx1) {
|
||||
return self.Slice(idx0, idx1);
|
||||
}, py::arg("outputIndex0"), py::arg("outputIndex1"),
|
||||
py::doc("Returns the LinearSystem with the outputs listed in outputIndices.")
|
||||
);
|
||||
}
|
||||
if constexpr (Outputs > 2) {
|
||||
cls_LinearSystem.def("slice", [](wpi::math::LinearSystem<States, Inputs, Outputs> &self, int idx0, int idx1, int idx2) {
|
||||
return self.Slice(idx0, idx1, idx2);
|
||||
}, py::arg("outputIndex0"), py::arg("outputIndex1"), py::arg("outputIndex2"),
|
||||
py::doc("Returns the LinearSystem with the outputs listed in outputIndices.")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
templates:
|
||||
LinearSystem_1_1_1:
|
||||
qualname: wpi::math::LinearSystem
|
||||
|
||||
25
wpimath/src/main/python/semiwrap/NumericalIntegration.yml
Normal file
25
wpimath/src/main/python/semiwrap/NumericalIntegration.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
extra_includes:
|
||||
- frc_eigen.h
|
||||
- wpi/math/linalg/EigenCore.hpp
|
||||
- pybind11/functional.h
|
||||
|
||||
functions:
|
||||
RK4:
|
||||
overloads:
|
||||
F&&, T, wpi::units::second_t:
|
||||
template_impls:
|
||||
- [std::function<Eigen::MatrixXd(Eigen::MatrixXd)>, Eigen::MatrixXd]
|
||||
F&&, T, U, wpi::units::second_t:
|
||||
template_impls:
|
||||
- ["std::function<Eigen::MatrixXd(Eigen::MatrixXd, Eigen::MatrixXd)>", Eigen::MatrixXd, Eigen::MatrixXd]
|
||||
F&&, wpi::units::second_t, T, wpi::units::second_t:
|
||||
template_impls:
|
||||
- ["std::function<Eigen::MatrixXd(wpi::units::second_t, Eigen::MatrixXd)>", Eigen::MatrixXd]
|
||||
RKDP:
|
||||
overloads:
|
||||
F&&, T, U, wpi::units::second_t, double:
|
||||
template_impls:
|
||||
- ["std::function<Eigen::MatrixXd(Eigen::MatrixXd, Eigen::MatrixXd)>", Eigen::MatrixXd, Eigen::MatrixXd]
|
||||
F&&, wpi::units::second_t, T, wpi::units::second_t, double:
|
||||
template_impls:
|
||||
- ["std::function<Eigen::MatrixXd(wpi::units::second_t, Eigen::MatrixXd)>", Eigen::MatrixXd]
|
||||
52
wpimath/src/main/python/semiwrap/NumericalJacobian.yml
Normal file
52
wpimath/src/main/python/semiwrap/NumericalJacobian.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
extra_includes:
|
||||
- frc_eigen.h
|
||||
- wpi/math/linalg/EigenCore.hpp
|
||||
- pybind11/functional.h
|
||||
- pybind11/typing.h
|
||||
|
||||
functions:
|
||||
NumericalJacobian:
|
||||
overloads:
|
||||
F&&, const Vectord<Cols>&:
|
||||
ignore: true
|
||||
F&&, const Eigen::VectorXd&:
|
||||
template_impls:
|
||||
- [std::function<Eigen::VectorXd(Eigen::VectorXd)>]
|
||||
NumericalJacobianX:
|
||||
overloads:
|
||||
F&&, const Vectord<States>&, const Vectord<Inputs>&, Args&&...:
|
||||
ignore: true
|
||||
F&&, const Eigen::VectorXd&, const Eigen::VectorXd&, Args&&...:
|
||||
# template_impls:
|
||||
# - ["std::function<Eigen::VectorXd(Eigen::VectorXd, Eigen::VectorXd, py::args)>", py::args, Eigen::MatrixXd]
|
||||
param_override:
|
||||
args:
|
||||
ignore: true
|
||||
no_release_gil: true
|
||||
cpp_code: |
|
||||
[](py::typing::Callable<Eigen::VectorXd(Eigen::VectorXd, Eigen::VectorXd, py::args)> fn,
|
||||
const Eigen::VectorXd& x, const Eigen::VectorXd& u, py::args args) {
|
||||
return wpi::math::NumericalJacobianX([=](const Eigen::VectorXd &ix, const Eigen::VectorXd &iu) {
|
||||
py::object r = fn(ix, iu, *args);
|
||||
return r.cast<Eigen::VectorXd>();
|
||||
}, x, u);
|
||||
}
|
||||
NumericalJacobianU:
|
||||
overloads:
|
||||
F&&, const Vectord<States>&, const Vectord<Inputs>&, Args&&...:
|
||||
ignore: true
|
||||
F&&, const Eigen::VectorXd&, const Eigen::VectorXd&, Args&&...:
|
||||
# template_impls:
|
||||
# - ["std::function<Eigen::VectorXd(Eigen::VectorXd, Eigen::VectorXd, py::args)>", py::args, Eigen::MatrixXd]
|
||||
param_override:
|
||||
args:
|
||||
ignore: true
|
||||
no_release_gil: true
|
||||
cpp_code: |-
|
||||
[](py::typing::Callable<Eigen::VectorXd(Eigen::VectorXd, Eigen::VectorXd, py::args)> fn,
|
||||
const Eigen::VectorXd& x, const Eigen::VectorXd& u, py::args args) {
|
||||
return wpi::math::NumericalJacobianU([=](const Eigen::VectorXd &ix, const Eigen::VectorXd &iu) {
|
||||
py::object r = fn(ix, iu, *args);
|
||||
return r.cast<Eigen::VectorXd>();
|
||||
}, x, u);
|
||||
}
|
||||
Reference in New Issue
Block a user