Skip to content

Commit

Permalink
refactored conversion functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Herpderk committed Aug 20, 2023
1 parent a74d43e commit 0dc43da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions px4_offboard_mpc/ned_enu_conversions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

def convert_NED_ENU_in_inertial(self, x) -> np.ndarray:
def convert_NED_ENU_in_inertial(x) -> np.ndarray:
''' Converts a state between NED or ENU inertial frames.
This operation is commutative.
'''
Expand All @@ -10,7 +10,7 @@ def convert_NED_ENU_in_inertial(self, x) -> np.ndarray:
return new_x


def convert_NED_ENU_in_body(self, x) -> np.ndarray:
def convert_NED_ENU_in_body(x) -> np.ndarray:
''' Converts a state between NED or ENU body frames.
(More formally known as FRD or RLU body frames)
This operation is commutative.
Expand All @@ -21,7 +21,7 @@ def convert_NED_ENU_in_body(self, x) -> np.ndarray:
return new_x


def convert_body_to_inertial_frame(self, ang_rate_body, ang) -> np.ndarray:
def convert_body_to_inertial_frame(ang_rate_body, ang) -> np.ndarray:
''' Converts body euler angle rates to their inertial frame counterparts.
'''
assert len(ang_rate_body) == 3
Expand All @@ -37,7 +37,7 @@ def convert_body_to_inertial_frame(self, ang_rate_body, ang) -> np.ndarray:
return ang_rate_inertial


def convert_inertial_to_body_frame(self, ang_rate_inertial, ang) -> np.ndarray:
def convert_inertial_to_body_frame(ang_rate_inertial, ang) -> np.ndarray:
''' Converts inertial euler angle rates to their body frame counterparts.
'''
assert len(ang_rate_inertial) == 3
Expand Down
2 changes: 1 addition & 1 deletion scripts/px4_interface_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
OffboardControlMode, VehicleCommand, VehicleStatus, VehicleLocalPosition, VehicleOdometry
from uavf_msgs.msg import NedEnuOdometry, CommanderOutput

from ned_enu_converions import convert_NED_ENU_in_inertial, convert_NED_ENU_in_body, \
from px4_offboard_mpc.ned_enu_conversions import convert_NED_ENU_in_inertial, convert_NED_ENU_in_body, \
convert_body_to_inertial_frame, convert_inertial_to_body_frame
import numpy as np
from scipy.spatial.transform import Rotation
Expand Down

0 comments on commit 0dc43da

Please sign in to comment.