Skip to content

Commit

Permalink
feat: add bindings for ConstantThrust static constructors (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishwa2710 authored Oct 6, 2023
1 parent 3a708d6 commit 4465595
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
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

0 comments on commit 4465595

Please sign in to comment.