-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Tabulated dynamics for custom contribution profiles (#317)
* feat: Tabulated dynamics for custom contribution profiles * feat: add print and ostream * test: add simple python tests * chore: args type in python fixed * feat: add access and get instants methods * fix: attempt to fix eigen in the CI * fix: use full path on load data files in test cpp * feat: fix test * feat: remove extra test * feat: address remaining feedback * feat: add frame getters --------- Co-authored-by: Remy Derollez <remy@loftorbital.com>
- Loading branch information
1 parent
2bb01de
commit 7032be1
Showing
12 changed files
with
2,254 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 125 additions & 0 deletions
125
bindings/python/src/OpenSpaceToolkitAstrodynamicsPy/Dynamics/Tabulated.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/// Apache License 2.0 | ||
|
||
#include <OpenSpaceToolkit/Astrodynamics/Dynamics/Tabulated.hpp> | ||
|
||
inline void OpenSpaceToolkitAstrodynamicsPy_Dynamics_Tabulated(pybind11::module& aModule) | ||
{ | ||
using namespace pybind11; | ||
|
||
using ostk::core::types::Shared; | ||
using ostk::core::ctnr::Array; | ||
|
||
using ostk::math::object::MatrixXd; | ||
|
||
using ostk::physics::time::Instant; | ||
using ostk::physics::coord::Frame; | ||
|
||
using ostk::astro::Dynamics; | ||
using ostk::astro::dynamics::Tabulated; | ||
using ostk::astro::trajectory::state::CoordinatesSubset; | ||
|
||
{ | ||
class_<Tabulated, Dynamics, Shared<Tabulated>>( | ||
aModule, | ||
"Tabulated", | ||
R"doc( | ||
The tabulated dynamics. | ||
Group: | ||
dynamics | ||
)doc" | ||
) | ||
.def( | ||
init< | ||
const Array<Instant>&, | ||
const MatrixXd&, | ||
const Array<Shared<const CoordinatesSubset>>&, | ||
const Shared<const Frame>>(), | ||
arg("instants"), | ||
arg("contribution_profile"), | ||
arg("coordinates_subsets"), | ||
arg("frame"), | ||
R"doc( | ||
Constructor. | ||
Args: | ||
instants (list[Instant]): An array of instants. | ||
contribution_profile (numpy.ndarray): A contribution profile. | ||
coordinates_subsets (list[CoordinatesSubset]): An array of coordinates subsets related to the contribution profile. | ||
frame (Frame): A frame. | ||
)doc" | ||
) | ||
|
||
.def("__str__", &(shiftToString<Tabulated>)) | ||
.def("__repr__", &(shiftToString<Tabulated>)) | ||
|
||
.def( | ||
"is_defined", | ||
&Tabulated::isDefined, | ||
R"doc( | ||
Check if the tabulated dynamics is defined. | ||
Returns: | ||
bool: True if the tabulated dynamics is defined, False otherwise. | ||
)doc" | ||
) | ||
|
||
.def( | ||
"get_instants", | ||
&Tabulated::getInstants, | ||
R"doc( | ||
Get the contribution instants. | ||
Returns: | ||
list[Instant]: The contribution instants. | ||
)doc" | ||
) | ||
|
||
.def( | ||
"get_contribution_profile", | ||
&Tabulated::getContributionProfile, | ||
R"doc( | ||
Get the contribution profile. | ||
Returns: | ||
np.ndarray: The contribution profile. | ||
)doc" | ||
) | ||
|
||
.def( | ||
"get_frame", | ||
&Tabulated::getFrame, | ||
R"doc( | ||
Get the reference frame. | ||
Returns: | ||
Frame: The reference frame. | ||
)doc" | ||
) | ||
|
||
.def( | ||
"compute_contribution", | ||
&Tabulated::computeContribution, | ||
arg("instant"), | ||
arg("x"), | ||
arg("frame"), | ||
R"doc( | ||
Compute the contribution from the contribution profile to the state vector. | ||
Args: | ||
instant (Instant): The instant of the state vector. | ||
x (numpy.ndarray): The state vector. | ||
frame (Frame): The reference frame. | ||
Returns: | ||
numpy.ndarray: The contribution from the contribution profile to the state vector. | ||
)doc" | ||
); | ||
} | ||
} |
Oops, something went wrong.