diff --git a/dev/mar_test.py b/dev/mar_test.py index 1564306..4e0142b 100644 --- a/dev/mar_test.py +++ b/dev/mar_test.py @@ -12,13 +12,17 @@ local_pos = messages.LocalPositionNED() device.add_listener(local_pos) -request_local_pos = protocols.RequestMessageProtocol(messages.IntervalMessageID.LOCAL_POSITION_NED, rate_hz=50.0) +request_local_pos = protocols.RequestMessageProtocol( + messages.IntervalMessageID.LOCAL_POSITION_NED, rate_hz=50.0 +) device.run_protocol(request_local_pos) imu = messages.RawIMU() device.add_listener(imu) -request_imu = protocols.RequestMessageProtocol(messages.IntervalMessageID.RAW_IMU, rate_hz=50.0) +request_imu = protocols.RequestMessageProtocol( + messages.IntervalMessageID.RAW_IMU, rate_hz=50.0 +) device.run_protocol(request_imu) time.sleep(1) diff --git a/messages/attitude_target_msg.py b/messages/attitude_target_msg.py index 69bf9c8..12b2534 100644 --- a/messages/attitude_target_msg.py +++ b/messages/attitude_target_msg.py @@ -30,7 +30,9 @@ def __init__( self.target_system = target_system self.target_component = target_component - self.boot_time_ms = boot_time_ms # time since system boot in milliseconds (for sync) + self.boot_time_ms = ( + boot_time_ms # time since system boot in milliseconds (for sync) + ) # quaternion (w, x, y, z) self.q = np.array(q, dtype=float) @@ -90,13 +92,13 @@ def set_ignore_body_rates(self, ignore: bool = True): def set_ignore_attitude(self, ignore: bool = True): if ignore: - self.type_mask |= (1 << 6) + self.type_mask |= 1 << 6 else: self.type_mask &= ~(1 << 6) def set_ignore_thrust(self, ignore: bool = True): if ignore: - self.type_mask |= (1 << 7) + self.type_mask |= 1 << 7 else: self.type_mask &= ~(1 << 7) diff --git a/messages/raw_imu_msg.py b/messages/raw_imu_msg.py index 09822d2..bd988dc 100644 --- a/messages/raw_imu_msg.py +++ b/messages/raw_imu_msg.py @@ -3,7 +3,6 @@ class RawIMU(MAVMessage): - def __init__(self): super().__init__("RAW_IMU") self.xac = 0.0 diff --git a/protocols/__init__.py b/protocols/__init__.py index e4610c8..2003976 100644 --- a/protocols/__init__.py +++ b/protocols/__init__.py @@ -1,4 +1,6 @@ -from mavcore.protocols.attitude_setpoint_protocol import AttitudeSetpointProtocol as AttitudeSetpointProtocol +from mavcore.protocols.attitude_setpoint_protocol import ( + AttitudeSetpointProtocol as AttitudeSetpointProtocol, +) from mavcore.protocols.battery_update_protocol import ( UpdateBatteryProtocol as UpdateBatteryProtocol, ) diff --git a/protocols/attitude_setpoint_protocol.py b/protocols/attitude_setpoint_protocol.py index 6294a22..9e3d636 100644 --- a/protocols/attitude_setpoint_protocol.py +++ b/protocols/attitude_setpoint_protocol.py @@ -7,7 +7,6 @@ class AttitudeSetpointProtocol(MAVProtocol): - def __init__( self, current_pos: LocalPositionNED, @@ -27,7 +26,11 @@ def __init__( self.thrust = 0.1 self.setpoint_msg = SetpointAttitude( - self.target_system, self.target_component, self.boot_time_ms, self.q, self.thrust + self.target_system, + self.target_component, + self.boot_time_ms, + self.q, + self.thrust, ) def run(self, sender, receiver): @@ -38,6 +41,4 @@ def run(self, sender, receiver): gs = np.linalg.norm([self.imu.xac, self.imu.yac, self.imu.zac]) if gs > highest: highest = gs - #print(f"highest G: {highest}", flush=True) - - + # print(f"highest G: {highest}", flush=True) diff --git a/protocols/request_msg_protocol.py b/protocols/request_msg_protocol.py index c3861df..b30443d 100644 --- a/protocols/request_msg_protocol.py +++ b/protocols/request_msg_protocol.py @@ -15,7 +15,7 @@ def __init__( target_system: int = 1, target_component: int = 0, rate_hz: float = 4.0, - wait_for_ack: bool = True + wait_for_ack: bool = True, ): super().__init__() self.msg_id = msg_id