mrtautopilot 9__tar.gz → 10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mrtautopilot
3
- Version: 9
3
+ Version: 10
4
4
  Summary: Communicate with the MRT Autopilot Mavlink API
5
5
  Maintainer-email: Nathan Knotts <nathan@magothyrt.com>
6
6
  Project-URL: Homepage, https://www.magothyrt.com/
@@ -1,4 +1,4 @@
1
- __version__ = "9"
1
+ __version__ = "10"
2
2
 
3
3
  from .autopilot import *
4
4
  from .mission import *
@@ -460,6 +460,7 @@ class MavlinkThread:
460
460
  ):
461
461
  self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
462
462
  self.sock.setblocking(False)
463
+ self.msg_callback: Callable[[mrtmavlink.MAVLink_message], None] = lambda x: None
463
464
 
464
465
  if multicast_group:
465
466
  self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
@@ -561,7 +562,13 @@ class MavlinkThread:
561
562
  self.ack_result = result
562
563
  self.ack_cond.notify()
563
564
 
565
+ def register_message_callback(
566
+ self, callback: Callable[[mrtmavlink.MAVLink_message], None]
567
+ ):
568
+ self.msg_callback = callback
569
+
564
570
  def _msg_callback(self, msg: mrtmavlink.MAVLink_message):
571
+ self.msg_callback(msg)
565
572
  sys_id = msg.get_srcSystem()
566
573
  logging.debug(f"Received: {msg.msgname}, sys_id={sys_id}, {msg}")
567
574
  if self.system_id != sys_id:
@@ -1070,3 +1077,42 @@ class MavlinkThread:
1070
1077
 
1071
1078
  finally:
1072
1079
  self.is_sending_mission = False
1080
+
1081
+ def set_attitude(
1082
+ self,
1083
+ roll_rad: float = 0,
1084
+ pitch_rad: float = 0,
1085
+ yaw_rad: float = 0,
1086
+ roll_rate_rps: float = 0,
1087
+ pitch_rate_rps: float = 0,
1088
+ yaw_rate_rps: float = 0,
1089
+ ):
1090
+ self.loop.call_soon_threadsafe(
1091
+ lambda: self._set_attitude(
1092
+ roll_rad,
1093
+ pitch_rad,
1094
+ yaw_rad,
1095
+ roll_rate_rps,
1096
+ pitch_rate_rps,
1097
+ yaw_rate_rps,
1098
+ )
1099
+ )
1100
+
1101
+ def _set_attitude(
1102
+ self,
1103
+ roll_rad: float,
1104
+ pitch_rad: float,
1105
+ yaw_rad: float,
1106
+ roll_rate_rps: float,
1107
+ pitch_rate_rps: float,
1108
+ yaw_rate_rps: float,
1109
+ ):
1110
+ self.conn.attitude_send(
1111
+ 0,
1112
+ roll_rad,
1113
+ pitch_rad,
1114
+ yaw_rad,
1115
+ roll_rate_rps,
1116
+ pitch_rate_rps,
1117
+ yaw_rate_rps,
1118
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mrtautopilot
3
- Version: 9
3
+ Version: 10
4
4
  Summary: Communicate with the MRT Autopilot Mavlink API
5
5
  Maintainer-email: Nathan Knotts <nathan@magothyrt.com>
6
6
  Project-URL: Homepage, https://www.magothyrt.com/
File without changes
File without changes
File without changes