Skip to content

Commit 36b33d4

Browse files
authored
Add Takeoff Command Sequence, Home Location Reset, and Minor Bug Fixes (#66)
* Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Update Message Commands and Handlers (#15) * Add HRL Support (#10) * Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Removed ros commands, fixed gps, renamed outgoingmsg to agentmsg, fixed ack issue * fixed setup version * Cleaned up debug messages and fixed readme example * Add Param Setting and Reading (#19) * Resolved typo in readme * Re-update send command methods to use timeout instead of infinite loop * Refactored various send message functions into single function * Implemented starter waypoint and mission support * Added mission to agent object * Updated agent to have name field * Rename timeout period in agent * Modified agentmsg to be parent class and updated send method to used full msg * Refactored send message to be more usable and added new commands * Added waypoint and takeoff messages * Added simple takeoff and takeoff command support * Add catches to prevent invalid altitude settings * Code cleanup * Added missing method type hints * Fixed mission init and msgmap init * Updated common messages to use msg timeout * Fixed variable naming in msgs * Updated senders to check ack instead of in retry function * Add support to set parameters * Added support to set parameters and started process of enabling reading parameters * Cleaned up agent and modified parameters stored to be circular buffer * Added interface to read parameters * Removed unused files * Added assertions to message construction to ensure proper msg type is provided * Added debug statements to parameter read method * Resolved bugs in message sending and message map * Wrapped up implementation of initial parameter setting and reading feature * Removed unused comments * Refactored send message implementation to create new thread on call * Refactored parameter implementation to use independent threads * Removed log option and made just debug * Cleaned up parameter read implementation * Update README to Reflect Usage Changes (#31) * Updated readme example to use latest version of pymavswarm * Updated readme example to use latest version of pymavswarm * Resolve param retry error * Fixed incorrect mavlink message sent on takeoff command (#35) * Resolve Takeoff and Acknowledgement Bugs (#37) * Resolved typo in readme * Re-update send command methods to use timeout instead of infinite loop * Refactored various send message functions into single function * Implemented starter waypoint and mission support * Added mission to agent object * Updated agent to have name field * Rename timeout period in agent * Modified agentmsg to be parent class and updated send method to used full msg * Refactored send message to be more usable and added new commands * Added waypoint and takeoff messages * Added simple takeoff and takeoff command support * Add catches to prevent invalid altitude settings * Code cleanup * Added missing method type hints * Fixed mission init and msgmap init * Updated common messages to use msg timeout * Fixed variable naming in msgs * Updated senders to check ack instead of in retry function * Add support to set parameters * Added support to set parameters and started process of enabling reading parameters * Cleaned up agent and modified parameters stored to be circular buffer * Added interface to read parameters * Removed unused files * Added assertions to message construction to ensure proper msg type is provided * Added debug statements to parameter read method * Resolved bugs in message sending and message map * Wrapped up implementation of initial parameter setting and reading feature * Removed unused comments * Refactored send message implementation to create new thread on call * Refactored parameter implementation to use independent threads * Removed log option and made just debug * Cleaned up parameter read implementation * Resolved bugs in message acknowledgement and takeoff * Resolve Disconnect and Reconnect Bug (#40) * Update README Example to Use Latest Usage Changes (#32) * Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Update Message Commands and Handlers (#15) * Add HRL Support (#10) * Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Removed ros commands, fixed gps, renamed outgoingmsg to agentmsg, fixed ack issue * fixed setup version * Cleaned up debug messages and fixed readme example * Add Param Setting and Reading (#19) * Resolved typo in readme * Re-update send command methods to use timeout instead of infinite loop * Refactored various send message functions into single function * Implemented starter waypoint and mission support * Added mission to agent object * Updated agent to have name field * Rename timeout period in agent * Modified agentmsg to be parent class and updated send method to used full msg * Refactored send message to be more usable and added new commands * Added waypoint and takeoff messages * Added simple takeoff and takeoff command support * Add catches to prevent invalid altitude settings * Code cleanup * Added missing method type hints * Fixed mission init and msgmap init * Updated common messages to use msg timeout * Fixed variable naming in msgs * Updated senders to check ack instead of in retry function * Add support to set parameters * Added support to set parameters and started process of enabling reading parameters * Cleaned up agent and modified parameters stored to be circular buffer * Added interface to read parameters * Removed unused files * Added assertions to message construction to ensure proper msg type is provided * Added debug statements to parameter read method * Resolved bugs in message sending and message map * Wrapped up implementation of initial parameter setting and reading feature * Removed unused comments * Refactored send message implementation to create new thread on call * Refactored parameter implementation to use independent threads * Removed log option and made just debug * Cleaned up parameter read implementation * Update README to Reflect Usage Changes (#31) * Updated readme example to use latest version of pymavswarm * Updated readme example to use latest version of pymavswarm * Finalize Takeoff Command Integration (#36) * Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Update Message Commands and Handlers (#15) * Add HRL Support (#10) * Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Removed ros commands, fixed gps, renamed outgoingmsg to agentmsg, fixed ack issue * fixed setup version * Cleaned up debug messages and fixed readme example * Add Param Setting and Reading (#19) * Resolved typo in readme * Re-update send command methods to use timeout instead of infinite loop * Refactored various send message functions into single function * Implemented starter waypoint and mission support * Added mission to agent object * Updated agent to have name field * Rename timeout period in agent * Modified agentmsg to be parent class and updated send method to used full msg * Refactored send message to be more usable and added new commands * Added waypoint and takeoff messages * Added simple takeoff and takeoff command support * Add catches to prevent invalid altitude settings * Code cleanup * Added missing method type hints * Fixed mission init and msgmap init * Updated common messages to use msg timeout * Fixed variable naming in msgs * Updated senders to check ack instead of in retry function * Add support to set parameters * Added support to set parameters and started process of enabling reading parameters * Cleaned up agent and modified parameters stored to be circular buffer * Added interface to read parameters * Removed unused files * Added assertions to message construction to ensure proper msg type is provided * Added debug statements to parameter read method * Resolved bugs in message sending and message map * Wrapped up implementation of initial parameter setting and reading feature * Removed unused comments * Refactored send message implementation to create new thread on call * Refactored parameter implementation to use independent threads * Removed log option and made just debug * Cleaned up parameter read implementation * Update README to Reflect Usage Changes (#31) * Updated readme example to use latest version of pymavswarm * Updated readme example to use latest version of pymavswarm * Resolve param retry error * Fixed incorrect mavlink message sent on takeoff command (#35) * Resolve Merge Errors and Acknowledgement Bugs (#38) * Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Update Message Commands and Handlers (#15) * Add HRL Support (#10) * Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Removed ros commands, fixed gps, renamed outgoingmsg to agentmsg, fixed ack issue * fixed setup version * Cleaned up debug messages and fixed readme example * Add Param Setting and Reading (#19) * Resolved typo in readme * Re-update send command methods to use timeout instead of infinite loop * Refactored various send message functions into single function * Implemented starter waypoint and mission support * Added mission to agent object * Updated agent to have name field * Rename timeout period in agent * Modified agentmsg to be parent class and updated send method to used full msg * Refactored send message to be more usable and added new commands * Added waypoint and takeoff messages * Added simple takeoff and takeoff command support * Add catches to prevent invalid altitude settings * Code cleanup * Added missing method type hints * Fixed mission init and msgmap init * Updated common messages to use msg timeout * Fixed variable naming in msgs * Updated senders to check ack instead of in retry function * Add support to set parameters * Added support to set parameters and started process of enabling reading parameters * Cleaned up agent and modified parameters stored to be circular buffer * Added interface to read parameters * Removed unused files * Added assertions to message construction to ensure proper msg type is provided * Added debug statements to parameter read method * Resolved bugs in message sending and message map * Wrapped up implementation of initial parameter setting and reading feature * Removed unused comments * Refactored send message implementation to create new thread on call * Refactored parameter implementation to use independent threads * Removed log option and made just debug * Cleaned up parameter read implementation * Update README to Reflect Usage Changes (#31) * Updated readme example to use latest version of pymavswarm * Updated readme example to use latest version of pymavswarm * Resolve param retry error * Fixed incorrect mavlink message sent on takeoff command (#35) * Resolve Takeoff and Acknowledgement Bugs (#37) * Resolved typo in readme * Re-update send command methods to use timeout instead of infinite loop * Refactored various send message functions into single function * Implemented starter waypoint and mission support * Added mission to agent object * Updated agent to have name field * Rename timeout period in agent * Modified agentmsg to be parent class and updated send method to used full msg * Refactored send message to be more usable and added new commands * Added waypoint and takeoff messages * Added simple takeoff and takeoff command support * Add catches to prevent invalid altitude settings * Code cleanup * Added missing method type hints * Fixed mission init and msgmap init * Updated common messages to use msg timeout * Fixed variable naming in msgs * Updated senders to check ack instead of in retry function * Add support to set parameters * Added support to set parameters and started process of enabling reading parameters * Cleaned up agent and modified parameters stored to be circular buffer * Added interface to read parameters * Removed unused files * Added assertions to message construction to ensure proper msg type is provided * Added debug statements to parameter read method * Resolved bugs in message sending and message map * Wrapped up implementation of initial parameter setting and reading feature * Removed unused comments * Refactored send message implementation to create new thread on call * Refactored parameter implementation to use independent threads * Removed log option and made just debug * Cleaned up parameter read implementation * Resolved bugs in message acknowledgement and takeoff * Resolved failure to reconnect after disconnect * Added support for live hrl (#44) * Set Home Location (#46) * Update README Example to Use Latest Usage Changes (#32) * Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Update Message Commands and Handlers (#15) * Add HRL Support (#10) * Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Removed ros commands, fixed gps, renamed outgoingmsg to agentmsg, fixed ack issue * fixed setup version * Cleaned up debug messages and fixed readme example * Add Param Setting and Reading (#19) * Resolved typo in readme * Re-update send command methods to use timeout instead of infinite loop * Refactored various send message functions into single function * Implemented starter waypoint and mission support * Added mission to agent object * Updated agent to have name field * Rename timeout period in agent * Modified agentmsg to be parent class and updated send method to used full msg * Refactored send message to be more usable and added new commands * Added waypoint and takeoff messages * Added simple takeoff and takeoff command support * Add catches to prevent invalid altitude settings * Code cleanup * Added missing method type hints * Fixed mission init and msgmap init * Updated common messages to use msg timeout * Fixed variable naming in msgs * Updated senders to check ack instead of in retry function * Add support to set parameters * Added support to set parameters and started process of enabling reading parameters * Cleaned up agent and modified parameters stored to be circular buffer * Added interface to read parameters * Removed unused files * Added assertions to message construction to ensure proper msg type is provided * Added debug statements to parameter read method * Resolved bugs in message sending and message map * Wrapped up implementation of initial parameter setting and reading feature * Removed unused comments * Refactored send message implementation to create new thread on call * Refactored parameter implementation to use independent threads * Removed log option and made just debug * Cleaned up parameter read implementation * Update README to Reflect Usage Changes (#31) * Updated readme example to use latest version of pymavswarm * Updated readme example to use latest version of pymavswarm * Finalize Takeoff Command Integration (#36) * Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Update Message Commands and Handlers (#15) * Add HRL Support (#10) * Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Removed ros commands, fixed gps, renamed outgoingmsg to agentmsg, fixed ack issue * fixed setup version * Cleaned up debug messages and fixed readme example * Add Param Setting and Reading (#19) * Resolved typo in readme * Re-update send command methods to use timeout instead of infinite loop * Refactored various send message functions into single function * Implemented starter waypoint and mission support * Added mission to agent object * Updated agent to have name field * Rename timeout period in agent * Modified agentmsg to be parent class and updated send method to used full msg * Refactored send message to be more usable and added new commands * Added waypoint and takeoff messages * Added simple takeoff and takeoff command support * Add catches to prevent invalid altitude settings * Code cleanup * Added missing method type hints * Fixed mission init and msgmap init * Updated common messages to use msg timeout * Fixed variable naming in msgs * Updated senders to check ack instead of in retry function * Add support to set parameters * Added support to set parameters and started process of enabling reading parameters * Cleaned up agent and modified parameters stored to be circular buffer * Added interface to read parameters * Removed unused files * Added assertions to message construction to ensure proper msg type is provided * Added debug statements to parameter read method * Resolved bugs in message sending and message map * Wrapped up implementation of initial parameter setting and reading feature * Removed unused comments * Refactored send message implementation to create new thread on call * Refactored parameter implementation to use independent threads * Removed log option and made just debug * Cleaned up parameter read implementation * Update README to Reflect Usage Changes (#31) * Updated readme example to use latest version of pymavswarm * Updated readme example to use latest version of pymavswarm * Resolve param retry error * Fixed incorrect mavlink message sent on takeoff command (#35) * Resolve Merge Errors and Acknowledgement Bugs (#38) * Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Update Message Commands and Handlers (#15) * Add HRL Support (#10) * Fixed issue with readme * Integrate HRL Support (#8) * Added missing type hints * Refactored to cleanup message sending and added support to send msg until ack * Added support for new HRL messages * Updated devices to use tuple key and ensure msg target in network * Added requirement to clone repo in readme * Resolved grammatical error * Updated readme to reflect require_ack change * Updated python requirement in readme and updated setup version * Resolved errors in structuring named value int message * Cleaned up readme formatting * Created dependencies section in readme * Removed ros commands, fixed gps, renamed outgoingmsg to agentmsg, fixed ack issue * fixed setup version * Cleaned up debug messages and fixed readme example * Add Param Setting and Reading (#19) * Resolved typo in readme * Re-update send command methods to use timeout instead of infinite loop * Refactored various send message functions into single function * Implemented starter waypoint and mission support * Added mission to agent object * Updated agent to have name field * Rename timeout period in agent * Modified agentmsg to be parent class and updated send method to used full msg * Refactored send message to be more usable and added new commands * Added waypoint and takeoff messages * Added simple takeoff and takeoff command support * Add catches to prevent invalid altitude settings * Code cleanup * Added missing method type hints * Fixed mission init and msgmap init * Updated common messages to use msg timeout * Fixed variable naming in msgs * Updated senders to check ack instead of in retry function * Add support to set parameters * Added support to set parameters and started process of enabling reading parameters * Cleaned up agent and modified parameters stored to be circular buffer * Added interface to read parameters * Removed unused files * Added assertions to message construction to ensure proper msg type is provided * Added debug statements to parameter read method * Resolved bugs in message sending and message map * Wrapped up implementation of initial parameter setting and reading feature * Removed unused comments * Refactored send message implementation to create new thread on call * Refactored parameter implementation to use independent threads * Removed log option and made just debug * Cleaned up parameter read implementation * Update README to Reflect Usage Changes (#31) * Updated readme example to use latest version of pymavswarm * Updated readme example to use latest version of pymavswarm * Resolve param retry error * Fixed incorrect mavlink message sent on takeoff command (#35) * Resolve Takeoff and Acknowledgement Bugs (#37) * Resolved typo in readme * Re-update send command methods to use timeout instead of infinite loop * Refactored various send message functions into single function * Implemented starter waypoint and mission support * Added mission to agent object * Updated agent to have name field * Rename timeout period in agent * Modified agentmsg to be parent class and updated send method to used full msg * Refactored send message to be more usable and added new commands * Added waypoint and takeoff messages * Added simple takeoff and takeoff command support * Add catches to prevent invalid altitude settings * Code cleanup * Added missing method type hints * Fixed mission init and msgmap init * Updated common messages to use msg timeout * Fixed variable naming in msgs * Updated senders to check ack instead of in retry function * Add support to set parameters * Added support to set parameters and started process of enabling reading parameters * Cleaned up agent and modified parameters stored to be circular buffer * Added interface to read parameters * Removed unused files * Added assertions to message construction to ensure proper msg type is provided * Added debug statements to parameter read method * Resolved bugs in message sending and message map * Wrapped up implementation of initial parameter setting and reading feature * Removed unused comments * Refactored send message implementation to create new thread on call * Refactored parameter implementation to use independent threads * Removed log option and made just debug * Cleaned up parameter read implementation * Resolved bugs in message acknowledgement and takeoff * Added support for resetting the home location of an agent * Cleaned up support for resetting home position * Integrate Support for All-In-One Takeoff Command (#49) * Created skeleton handler for all in one message * Added initial implementation of full takeoff commands * Added takeoff workflow to msg map * Cleaned up support for full takeoff command * Added arming delay and cleaned up msgs to support sequence commands
1 parent ac2776c commit 36b33d4

15 files changed

+483
-112
lines changed

pymavswarm/Connection.py

Lines changed: 306 additions & 41 deletions
Large diffs are not rendered by default.

pymavswarm/MavSwarm.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def connect(self, port: str, baudrate: int, source_system: int=255, source_compo
4545
self.connection.start_connection()
4646
except Exception:
4747
# Handle the error message
48-
self.logger.debug('MavSwarm was unable to establish a connection with the specified device')
48+
self.logger.debug('MavSwarm was unable to establish a connection with the specified device', exc_info=True)
4949

5050
return False
5151

@@ -58,6 +58,7 @@ def disconnect(self) -> bool:
5858
"""
5959
if self.connection is not None:
6060
self.connection.disconnect()
61+
self.connection = None
6162

6263
return True
6364

@@ -115,9 +116,10 @@ def get_agent_by_id(self, sys_id: int, comp_id: int) -> Optional[Agent]:
115116
"""
116117
Get a specific agent by its system ID and component ID
117118
"""
118-
for agent in self.connection.devices.values():
119-
if agent.sys_id == sys_id and agent.comp_id == comp_id:
120-
return agent
119+
device_id = (sys_id, comp_id)
120+
121+
if device_id in self.connection.devices:
122+
return self.connection.devices[device_id]
121123

122124
return None
123125

pymavswarm/msg/AgentMsg.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,32 @@ class AgentMsg:
99
- msg_timeout [float] : The amount of time that pymavswarm should attempt to resend a message if
1010
acknowledgement is not received. This is only used when check_ack is set
1111
to true
12-
- ack_timeout [float] : The amount of time that pymavswarm should way to check for an acknowledgement
12+
- ack_timeout [float] : The amount of time that pymavswarm should wait to check for an acknowledgement
1313
from an agent. This is only used when check_ack is set to true. This should be kept
1414
as short as possible to keep agent state information up-to-date
15+
- state_timeout [float] : The amount of time that pymavswarm should wait for a given agent's state to change
16+
after receiving a mavlink message
17+
- state_delay [float] : The amount of time that pymavswarm should wait after sending a command prior to sending
18+
another command. This parameter is used for sequence-driven commands such as the full
19+
takeoff command sequence.
20+
1521
"""
1622
def __init__(self, msg_type: str,
1723
target_system: int,
1824
target_comp: int,
1925
retry: bool,
2026
msg_timeout: float=5.0,
21-
ack_timeout: float=1.0) -> None:
27+
ack_timeout: float=1.0,
28+
state_timeout: float=5.0,
29+
state_delay: float=3.0) -> None:
2230
self.msg_type = msg_type
2331
self.target_system = target_system
2432
self.target_comp = target_comp
2533
self.retry = retry
2634
self.msg_timeout = msg_timeout
2735
self.ack_timeout = ack_timeout
36+
self.state_timeout = state_timeout
37+
self.state_delay = state_delay
2838

2939
return
3040

pymavswarm/msg/FlightModeMsg.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@ class FlightModeMsg(AgentMsg):
77
"""
88
FlightModeMsg represents messages that should result in a flight mode change on an agent.
99
"""
10-
def __init__(self, msg_type: str, target_system: int, target_comp: int, retry: bool, msg_timeout: float=5.0) -> None:
11-
super().__init__(msg_type, target_system, target_comp, retry, msg_timeout=msg_timeout)
10+
def __init__(self, msg_type: str,
11+
target_system: int,
12+
target_comp: int,
13+
retry: bool,
14+
msg_timeout: float=5.0,
15+
ack_timeout: float=1.0,
16+
state_timeout: float=5.0,
17+
state_delay: float=3.0) -> None:
18+
super().__init__(msg_type,
19+
target_system,
20+
target_comp, retry,
21+
msg_timeout=msg_timeout,
22+
ack_timeout=ack_timeout,
23+
state_timeout=state_timeout,
24+
state_delay=state_delay)
1225

1326
return

pymavswarm/msg/FlightSpeedMsg.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,23 @@ class FlightSpeedMsg(AgentMsg):
77
FlightSpeedMsg represents messages that should change the flight speed of an agent.
88
This may be either ground speed or air speed in m/s.
99
"""
10-
def __init__(self, speed: float, msg_type: str, target_system: int, target_comp: int, retry: bool, msg_timeout: float=5.0) -> None:
11-
super().__init__(msg_type, target_system, target_comp, retry, msg_timeout=msg_timeout)
10+
def __init__(self, speed: float,
11+
msg_type: str,
12+
target_system: int,
13+
target_comp: int,
14+
retry: bool,
15+
msg_timeout: float=5.0,
16+
ack_timeout: float=1.0,
17+
state_timeout: float=5.0,
18+
state_delay: float=3.0) -> None:
19+
super().__init__(msg_type,
20+
target_system,
21+
target_comp,
22+
retry,
23+
msg_timeout=msg_timeout,
24+
ack_timeout=ack_timeout,
25+
state_timeout=state_timeout,
26+
state_delay=state_delay)
1227
self.speed = speed
1328

1429
return

pymavswarm/msg/HRLMsg.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,24 @@ class HRLMsg(AgentMsg):
99
The message types that should be used with this type include:
1010
- start_path_execution
1111
- stop_path_execution
12+
- reset_path_execution
13+
- start_live_execution
1214
"""
13-
def __init__(self, msg_type: str, target_system: int, target_comp: int, retry: bool, msg_timeout: float=5.0) -> None:
14-
super().__init__(msg_type, target_system, target_comp, retry, msg_timeout=msg_timeout)
15+
def __init__(self, msg_type: str,
16+
target_system: int,
17+
target_comp: int,
18+
retry: bool,
19+
msg_timeout: float=5.0,
20+
ack_timeout: float=1.0,
21+
state_timeout: float=5.0,
22+
state_delay: float=3.0) -> None:
23+
super().__init__(msg_type,
24+
target_system,
25+
target_comp,
26+
retry,
27+
msg_timeout=msg_timeout,
28+
ack_timeout=ack_timeout,
29+
state_timeout=state_timeout,
30+
state_delay=state_delay)
1531

1632
return

pymavswarm/msg/HomePositionMsg.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from typing import Optional
2+
from .AgentMsg import AgentMsg
3+
4+
5+
class HomePositionMsg(AgentMsg):
6+
"""
7+
HomePositionMsg signals a home position reset. The home position can be reset to the current location
8+
or set to a specific location. Note that if the home location is being reset to the current position,
9+
then the location is not required. If the home location is being set to a specific location, all
10+
components must be set.
11+
Params:
12+
lat : : Longitude
13+
long : : Longitude
14+
alt : m : Altitude
15+
"""
16+
def __init__(self, msg_type: str,
17+
target_system: int,
18+
target_comp: int,
19+
retry: bool,
20+
lat: Optional[float]=None,
21+
lon: Optional[float]=None,
22+
alt: Optional[float]=None,
23+
msg_timeout: float=5.0,
24+
ack_timeout: float=1.0,
25+
state_timeout: float=5.0,
26+
state_delay: float=3.0) -> None:
27+
super().__init__(msg_type,
28+
target_system,
29+
target_comp,
30+
retry,
31+
msg_timeout=msg_timeout,
32+
ack_timeout=ack_timeout,
33+
state_timeout=state_timeout,
34+
state_delay=state_delay)
35+
self.altitude = alt
36+
self.lat = lat
37+
self.lon = lon
38+
39+
return

pymavswarm/msg/MsgMap.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ class HRLCommands:
5353
Enum class used to enable easy retrieval of the command used to send HRL commands
5454
"""
5555
start_path_execution = 'startpath'
56+
reset_path_execution = 'resetpath'
5657
stop_path_execution = 'stoppath'
58+
start_live_execution = 'startlive'
5759

5860

5961
@dataclass
@@ -76,6 +78,10 @@ class MissionCommand:
7678
waypoint = 'waypoint'
7779
simple_takeoff = 'simpletakeoff'
7880
takeoff = 'takeoff'
81+
full_takeoff = 'fulltakeoff'
82+
full_simple_takeoff = 'simplefulltakeoff'
83+
reset_home_position_to_current = 'resethomecurrent'
84+
reset_home_position = 'resethome'
7985

8086

8187
class MsgMap:

pymavswarm/msg/PreflightCalibrationMsg.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,21 @@ class PreflightCalibrationMsg(AgentMsg):
88
PreflightCalibrationMsg represents messages that perform pre-flight calibrations on a selected
99
agent
1010
"""
11-
def __init__(self, msg_type: str, target_system: int, target_comp: int, retry: bool, msg_timeout: float=5.0) -> None:
12-
super().__init__(msg_type, target_system, target_comp, retry, msg_timeout=msg_timeout)
11+
def __init__(self, msg_type: str,
12+
target_system: int,
13+
target_comp: int,
14+
retry: bool,
15+
msg_timeout: float=5.0,
16+
ack_timeout: float=1.0,
17+
state_timeout: float=5.0,
18+
state_delay: float=3.0) -> None:
19+
super().__init__(msg_type,
20+
target_system,
21+
target_comp,
22+
retry,
23+
msg_timeout=msg_timeout,
24+
ack_timeout=ack_timeout,
25+
state_timeout=state_timeout,
26+
state_delay=state_delay)
1327

1428
return

pymavswarm/msg/SystemCommandMsg.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,21 @@ class SystemCommandMsg(AgentMsg):
88
SystemCommandMsg class represents messages that perform some system-level operation on
99
an agent such as arming or reboot.
1010
"""
11-
def __init__(self, msg_type: str, target_system: int, target_comp: int, retry: bool, msg_timeout: float=5.0) -> None:
12-
super().__init__(msg_type, target_system, target_comp, retry, msg_timeout=msg_timeout)
11+
def __init__(self, msg_type: str,
12+
target_system: int,
13+
target_comp: int,
14+
retry: bool,
15+
msg_timeout: float=5.0,
16+
ack_timeout: float=1.0,
17+
state_timeout: float=5.0,
18+
state_delay: float=3.0) -> None:
19+
super().__init__(msg_type,
20+
target_system,
21+
target_comp,
22+
retry,
23+
msg_timeout=msg_timeout,
24+
ack_timeout=ack_timeout,
25+
state_timeout=state_timeout,
26+
state_delay=state_delay)
1327

1428
return

0 commit comments

Comments
 (0)