Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add bindings for ConstantThrust static constructors #232

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ inline void OpenSpaceToolkitAstrodynamicsPy_Dynamics_Thruster_ConstantThrust(pyb
using ostk::core::types::String;
using ostk::core::types::Shared;

using ostk::astro::flight::system::SatelliteSystem;
using ostk::astro::trajectory::LocalOrbitalFrameDirection;
using ostk::physics::coord::Frame;

using ostk::astro::Dynamics;
using ostk::astro::trajectory::LocalOrbitalFrameDirection;
using ostk::astro::dynamics::Thruster;
using ostk::astro::dynamics::thruster::ConstantThrust;
using ostk::astro::flight::system::SatelliteSystem;

{
class_<ConstantThrust, Thruster, Shared<ConstantThrust>>(aModule, "ConstantThrust")
Expand All @@ -36,6 +37,16 @@ inline void OpenSpaceToolkitAstrodynamicsPy_Dynamics_Thruster_ConstantThrust(pyb
.def("get_read_coordinates_subsets", &ConstantThrust::getReadCoordinatesSubsets)
.def("get_write_coordinates_subsets", &ConstantThrust::getWriteCoordinatesSubsets)

.def("compute_contribution", &ConstantThrust::computeContribution, arg("instant"), arg("x"), arg("frame"));
.def("compute_contribution", &ConstantThrust::computeContribution, arg("instant"), arg("x"), arg("frame"))

.def_static(
"intrack",
&ConstantThrust::Intrack,
arg("satellite_system"),
arg("velocity_direction") = true,
arg("frame") = Frame::GCRF()
)

;
}
}
20 changes: 20 additions & 0 deletions bindings/python/test/dynamics/thruster/test_constant_thrust.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,26 @@ def test_constructors(self, dynamics: ConstantThrust):
def test_getters(self, dynamics: ConstantThrust):
assert dynamics.get_local_thrust_direction() is not None

def test_static_constructors(self, satellite_system: SatelliteSystem, frame: Frame):
assert ConstantThrust.intrack(satellite_system=satellite_system) is not None

assert (
ConstantThrust.intrack(
satellite_system=satellite_system,
velocity_direction=False,
)
is not None
)

assert (
ConstantThrust.intrack(
satellite_system=satellite_system,
velocity_direction=True,
frame=frame,
)
is not None
)

def test_compute_contribution_success(self, dynamics: ConstantThrust, state: State):
contribution = dynamics.compute_contribution(
state.get_instant(), state.get_coordinates(), state.get_frame()
Expand Down
Loading