mrtautopilot 9__tar.gz → 11__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: 11
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__ = "11"
2
2
 
3
3
  from .autopilot import *
4
4
  from .mission import *
@@ -314,9 +314,9 @@ class Gps2Raw:
314
314
  self.vdop = None
315
315
 
316
316
  if msg.vel != 0xFFFF:
317
- self.velocity_mps = msg.vel / 100
317
+ self.speed_mps = msg.vel / 100
318
318
  else:
319
- self.velocity_mps = None
319
+ self.speed_mps = None
320
320
 
321
321
  if msg.cog != 0xFFFF:
322
322
  self.course_deg = msg.cog / 100
@@ -324,9 +324,9 @@ class Gps2Raw:
324
324
  self.course_deg = None
325
325
 
326
326
  if msg.satellites_visible != 0xFF:
327
- self.num_set = msg.satellites_visible
327
+ self.num_satellites = msg.satellites_visible
328
328
  else:
329
- self.num_set = None
329
+ self.num_satellites = None
330
330
 
331
331
  timestamp: datetime.datetime
332
332
  fix_type: GpsFixType
@@ -335,9 +335,9 @@ class Gps2Raw:
335
335
  altitude_m: Union[float, None]
336
336
  hdop: Union[float, None]
337
337
  vdop: Union[float, None]
338
- velocity_mps: Union[float, None]
338
+ speed_mps: Union[float, None]
339
339
  course_deg: Union[float, None]
340
- num_set: Union[int, None]
340
+ num_satellites: Union[int, None]
341
341
 
342
342
 
343
343
  @dataclass
@@ -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: 11
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