pyMAVLinCS 1.0.3__tar.gz → 1.0.5__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.4
2
2
  Name: pyMAVLinCS
3
- Version: 1.0.3
3
+ Version: 1.0.5
4
4
  Summary: Python API for autonomous drone control based on pymavlink
5
5
  Author-email: Noah Redon <redonnoah.cs@gmail.com>
6
6
  License: GPL-3.0-or-later
@@ -3130,8 +3130,8 @@ class MAVLinCS:
3130
3130
 
3131
3131
  condition = (
3132
3132
  f"COMMAND_ACK.command == {command} and "
3133
- f"getattr(COMMAND_ACK, 'target_system', {self.master.target_system}) == {self.master.target_system} and "
3134
- f"getattr(COMMAND_ACK, 'target_component', {self.master.target_component}) == {self.master.target_component}"
3133
+ f"getattr(COMMAND_ACK, 'target_system', {self.master.source_system}) == {self.master.source_system} and "
3134
+ f"getattr(COMMAND_ACK, 'target_component', {self.master.source_component}) == {self.master.source_component}"
3135
3135
  )
3136
3136
  m = self.recv_match(
3137
3137
  type="COMMAND_ACK",
@@ -3182,8 +3182,8 @@ class MAVLinCS:
3182
3182
 
3183
3183
  condition = (
3184
3184
  f"({mission_type} is None or getattr(MISSION_ACK, 'mission_type', {mission_type}) == {mission_type}) and "
3185
- f"MISSION_ACK.target_system == {self.master.target_system} and "
3186
- f"MISSION_ACK.target_component == {self.master.target_component}"
3185
+ f"MISSION_ACK.target_system == {self.master.source_system} and "
3186
+ f"MISSION_ACK.target_component == {self.master.source_component}"
3187
3187
  )
3188
3188
 
3189
3189
  m = self.recv_match(
@@ -3290,6 +3290,12 @@ class MAVLinCS:
3290
3290
  - Starts background MAV thread for message handling.
3291
3291
  - If pos_rate<=0, doesn't request position.
3292
3292
  """
3293
+ self.logger.debug("Loading MAVLink version and dialect..")
3294
+ os.environ['MAVLINK20'] = '1'
3295
+ os.environ.pop('MAVLINK09', None)
3296
+ mavutil.set_dialect(dialect=dialect)
3297
+ self.logger.debug("MAVLink version and dialect loaded")
3298
+
3293
3299
  self.logger.debug("Creating master object..")
3294
3300
  self.master: mavutil.mavfile = mavutil.mavlink_connection(
3295
3301
  device=address,
@@ -3300,11 +3306,15 @@ class MAVLinCS:
3300
3306
  )
3301
3307
 
3302
3308
  try:
3303
- self.logger.debug("Master object created")
3309
+ self.master.first_byte = False
3310
+ self.master.mav.set_callback(self._recv_msg_callback)
3311
+ self.master.mav.set_send_callback(self._send_callback)
3304
3312
  self.timesync_handler.set_master(self.master)
3313
+ self.mavthread.set_master(self.master)
3314
+
3315
+ self.logger.debug("Master object created")
3305
3316
 
3306
3317
  if timeout_heartbeat != 0:
3307
- self.master.mav.set_callback(self._recv_msg_callback)
3308
3318
  self.logger.info("Waiting for HEARTBEAT%s", f" from ({target_system}:1)" if target_system else "")
3309
3319
  start_time = time.time()
3310
3320
  while True:
@@ -3326,19 +3336,9 @@ class MAVLinCS:
3326
3336
  break
3327
3337
  else:
3328
3338
  self.logger.info("No timeout for HEARTBEAT specified")
3329
- self.master.first_byte = False
3330
- self.master.WIRE_PROTOCOL_VERSION = "2.0"
3331
- os.environ['MAVLINK20'] = '1'
3332
- mavutil.set_dialect(dialect=dialect)
3333
- self.master.mav = mavutil.mavlink.MAVLink(self.master, srcSystem=self.master.source_system, srcComponent=self.master.source_component)
3334
- self.master.mav.robust_parsing = self.master.robust_parsing
3335
- self.master.WIRE_PROTOCOL_VERSION = mavutil.mavlink.WIRE_PROTOCOL_VERSION
3336
- self.master.mav.set_callback(self._recv_msg_callback)
3337
3339
  self.master.target_system = 1 if target_system is None else target_system
3338
3340
  self.master.target_component = mavutil.mavlink.MAV_COMP_ID_AUTOPILOT1
3339
3341
 
3340
- self.master.mav.set_send_callback(self._send_callback)
3341
-
3342
3342
  self._sysid_to_request_home.clear()
3343
3343
  sysid_to_request_home = self.data_init.get("sysid_to_request_home", None)
3344
3344
  if isinstance(sysid_to_request_home, int):
@@ -3374,7 +3374,6 @@ class MAVLinCS:
3374
3374
  self.logger.warning("%s is not a MAV_CMD", cmd)
3375
3375
 
3376
3376
  # Start MAV thread
3377
- self.mavthread.set_master(self.master)
3378
3377
  self.mavthread.start_thread()
3379
3378
 
3380
3379
  if timeout_heartbeat != 0 and pos_rate>0:
@@ -20,6 +20,7 @@ try:
20
20
  colorama_init()
21
21
  _ENABLE_COLORS = True
22
22
  except ImportError:
23
+ print("Warning: colorama isn't installed. No logging color available")
23
24
  _ENABLE_COLORS = False
24
25
 
25
26
  _COLORS = {
@@ -28,7 +29,7 @@ _COLORS = {
28
29
  logging.WARNING: Fore.YELLOW,
29
30
  logging.ERROR: Fore.RED,
30
31
  logging.CRITICAL: Fore.RED + Style.BRIGHT,
31
- }
32
+ } if _ENABLE_COLORS else {}
32
33
  _RESET = Style.RESET_ALL if _ENABLE_COLORS else ""
33
34
 
34
35
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyMAVLinCS
3
- Version: 1.0.3
3
+ Version: 1.0.5
4
4
  Summary: Python API for autonomous drone control based on pymavlink
5
5
  Author-email: Noah Redon <redonnoah.cs@gmail.com>
6
6
  License: GPL-3.0-or-later
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyMAVLinCS"
7
- version = "1.0.3"
7
+ version = "1.0.5"
8
8
  description = "Python API for autonomous drone control based on pymavlink"
9
9
  authors = [
10
10
  {name="Noah Redon", email="redonnoah.cs@gmail.com"}
File without changes
File without changes
File without changes