Skip to content

Commit

Permalink
Removed support for specifying agent ID tuple in commands (#120)
Browse files Browse the repository at this point in the history
* Removed support for specifying agent ID tuple for commands

* Fix merge conflict error

* Fix bug in response access

* Removed remaining check for non-list response

* Removed remaining instances of non-list responses

* Fixed italics

* Updated changelog and bumped version

* Fixes to pass CI
  • Loading branch information
evan-palmer committed Sep 11, 2022
1 parent ecc0cf9 commit 9022d10
Show file tree
Hide file tree
Showing 17 changed files with 218 additions and 373 deletions.
25 changes: 12 additions & 13 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,39 @@ about: Create a bug report
title: "[BUG]: "
labels: "bug"
assignees: ""

---

## Describe the bug

*A clear and concise description of what the bug is.*
_A clear and concise description of what the bug is._

## To Reproduce

Steps to reproduce the behavior:

1. *Go to '...'*
2. *Click on '....'*
3. *Scroll down to '....'*
4. *See error*
1. _Go to '...'_
2. _Click on '....'_
3. _Scroll down to '....'_
4. _See error_

## Expected behavior

*A clear and concise description of what you expected to happen.*
_A clear and concise description of what you expected to happen._

## Stack Traceback

*If applicable, provide the stack traceback for the error. Ensure that this
trace is provided using code formatting.*
_If applicable, provide the stack traceback for the error. Ensure that this
trace is provided using code formatting._

## Project Version

*Provide the version that the issue occurred on (e.g. 0.1.0)*
_Provide the version that the issue occurred on (e.g. 0.1.0)_

## Desktop

*Please provide information regarding hardware platform that this error
occurred on (e.g., Raspberry Pi 4 running Ubuntu 22.04)*
_Please provide information regarding hardware platform that this error
occurred on (e.g., Raspberry Pi 4 running Ubuntu 22.04)_

## Additional context

*Add any other context about the problem here.*
_Add any other context about the problem here._
17 changes: 8 additions & 9 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@ about: Suggest a new idea for the project
title: "[FEATURE]: "
labels: "enhancement"
assignees: ""

---

## Is your feature request related to a problem? Please describe

*A clear and concise description of what the problem is. Ex. I'm always
frustrated when [...]*
_A clear and concise description of what the problem is. Ex. I'm always
frustrated when [...]_

## Describe the solution you'd like

*A clear and concise description of what you want to happen.*
_A clear and concise description of what you want to happen._

## Describe alternatives you've considered

*A clear and concise description of any alternative solutions or features you've
considered.*
_A clear and concise description of any alternative solutions or features you've
considered._

## Implementation Ideas

*A description of potential implementation solutions that could be integrated to
accomplish the feature.*
_A description of potential implementation solutions that could be integrated to
accomplish the feature._

## Additional context

*Add any other context or screenshots about the feature request here.*
_Add any other context or screenshots about the feature request here._
16 changes: 8 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@

## Changes Made

*A clear and concise description of all changes made in this PR. This should
include a high-level discussion regarding the implementation of the PR.*
_A clear and concise description of all changes made in this PR. This should
include a high-level discussion regarding the implementation of the PR._

## Associated Issues

*A list of all open issues that this PR will close or contribute toward closing.*
_A list of all open issues that this PR will close or contribute toward closing._

Fixes # (issue)

## Files Changed

*A list of all files changed and a summary of the changes made to the respective
files.*
_A list of all files changed and a summary of the changes made to the respective
files._

## Testing

*A clear and concise description of the testing performed. Instructions should
be included discussing how to replicate the testing results.*
_A clear and concise description of the testing performed. Instructions should
be included discussing how to replicate the testing results._

## Issues Introduced

*A list of the issues that have been introduced through this PR.*
_A list of the issues that have been introduced through this PR._
14 changes: 13 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,25 @@ utilizes `Semantic Versioning`_ for project versioning.

.. _Semantic Versioning: https://semver.org/

[v1.2.0] - 2022-09-11
---------------------

Removed
^^^^^^^

- Ability to specify a single target agent ID using a tuple when sending commands, and
now always require a list argument: `PR #120`_

.. _PR #120: https://github.com/unl-nimbus-lab/pymavswarm/pull/120


[v1.1.1] - 2022-09-09
---------------------

Fixed
^^^^^

- Acknowledgement failure when sending navigation commands (e.g., waypoints) `PR #124`_
- Acknowledgement failure when sending navigation commands (e.g., waypoints): `PR #124`_

.. _PR #124: https://github.com/unl-nimbus-lab/pymavswarm/pull/124

Expand Down
15 changes: 3 additions & 12 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -288,19 +288,10 @@ An example demonstrating how this can be used is as follows:
# Get the message responses
responses = future.result()
# The responses can be either a list of Response objects
# or a single Response object, depending on the number of agents
# that the command was sent to
if isinstance(responses, list):
for response in responses:
print(
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)
else:
for response in responses:
print(
f"Result of {responses.message_type} message sent to "
f"({responses.target_agent_id}): {responses.code}"
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)
return
Expand Down
12 changes: 3 additions & 9 deletions examples/arming.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,10 @@ def print_message_response_cb(future: Future) -> None:
"""
responses = future.result()

if isinstance(responses, list):
for response in responses:
print(
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)
else:
for response in responses:
print(
f"Result of {responses.message_type} message sent to "
f"({responses.target_agent_id}): {responses.code}"
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)

return
Expand Down
42 changes: 11 additions & 31 deletions examples/collision_prevention.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,10 @@ def print_message_response_cb(future: Future) -> None:
"""
responses = future.result()

if isinstance(responses, list):
for response in responses:
print(
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)
else:
for response in responses:
print(
f"Result of {responses.message_type} message sent to "
f"({responses.target_agent_id}): {responses.code}"
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)

return
Expand Down Expand Up @@ -110,20 +104,12 @@ def main() -> None:
responses = future.result()

# Exit if all agents didn't successfully switch into GUIDED mode
if isinstance(responses, list):
for response in responses:
if not response.result:
print(
"Failed to set the flight mode of agent "
f"{response.target_agent_id} to GUIDED prior to the takeoff "
"sequence. Exiting."
)
return
else:
if not responses.result:
for response in responses:
if not response.result:
print(
"Failed to set the flight mode of agent {responses.target_agent_id} to "
"GUIDED prior to the takeoff sequence. Exiting."
"Failed to set the flight mode of agent "
f"{response.target_agent_id} to GUIDED prior to the takeoff "
"sequence. Exiting."
)
return

Expand All @@ -132,16 +118,10 @@ def main() -> None:
args.takeoff_alt, agent_ids=target_agents, verify_state=True, retry=True
)

if isinstance(responses, list):
for response in responses:
print(
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)
else:
for response in responses:
print(
f"Result of {responses.message_type} message sent to "
f"({response.target_agent_id}): {responses.code}"
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)

# Wait for the user to indicate that the agents should fly to their waypoints
Expand Down
12 changes: 3 additions & 9 deletions examples/collision_prevention_no_flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,10 @@ def print_message_response_cb(future: Future) -> None:
"""
responses = future.result()

if isinstance(responses, list):
for response in responses:
print(
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)
else:
for response in responses:
print(
f"Result of {responses.message_type} message sent to "
f"({responses.target_agent_id}): {responses.code}"
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)

return
Expand Down
42 changes: 11 additions & 31 deletions examples/goto.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,10 @@ def print_message_response_cb(future: Future) -> None:
"""
responses = future.result()

if isinstance(responses, list):
for response in responses:
print(
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)
else:
for response in responses:
print(
f"Result of {responses.message_type} message sent to "
f"({responses.target_agent_id}): {responses.code}"
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)

return
Expand Down Expand Up @@ -106,20 +100,12 @@ def main() -> None:
responses = future.result()

# Exit if all agents didn't successfully switch into GUIDED mode
if isinstance(responses, list):
for response in responses:
if not response.result:
print(
"Failed to set the flight mode of agent "
f"{response.target_agent_id} to GUIDED prior to the takeoff "
"sequence. Exiting."
)
return
else:
if not responses.result:
for response in responses:
if not response.result:
print(
"Failed to set the flight mode of agent {responses.target_agent_id} to "
"GUIDED prior to the takeoff sequence. Exiting."
"Failed to set the flight mode of agent "
f"{response.target_agent_id} to GUIDED prior to the takeoff "
"sequence. Exiting."
)
return

Expand All @@ -128,16 +114,10 @@ def main() -> None:
args.takeoff_alt, agent_ids=target_agents, verify_state=True, retry=True
)

if isinstance(responses, list):
for response in responses:
print(
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)
else:
for response in responses:
print(
f"Result of {responses.message_type} message sent to "
f"({response.target_agent_id}): {responses.code}"
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)

# Wait for the user to indicate that the agents should fly to their waypoints
Expand Down
12 changes: 3 additions & 9 deletions examples/send_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,10 @@ def print_message_response_cb(future: Future) -> None:
"""
responses = future.result()

if isinstance(responses, list):
for response in responses:
print(
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)
else:
for response in responses:
print(
f"Result of {responses.message_type} message sent to "
f"({responses.target_agent_id}): {responses.code}"
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)

return
Expand Down
12 changes: 3 additions & 9 deletions examples/set_flight_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,10 @@ def print_message_response_cb(future: Future) -> None:
"""
responses = future.result()

if isinstance(responses, list):
for response in responses:
print(
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)
else:
for response in responses:
print(
f"Result of {responses.message_type} message sent to "
f"({responses.target_agent_id}): {responses.code}"
f"Result of {response.message_type} message sent to "
f"({response.target_agent_id}): {response.code}"
)

return
Expand Down

0 comments on commit 9022d10

Please sign in to comment.