-
Notifications
You must be signed in to change notification settings - Fork 0
Change airdrop to use Ardupilot RELAY2_FUNCTION #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR replaces the legacy UDP-based airdrop mechanism with ArduPilot’s RELAY2 relay control via Mavlink passthrough, updates tests, and wires the new helper into both the tick logic and GCS routes.
- Introduces
triggerRelay()
inMavlinkClient
and uses it inAirdropApproachTick
- Adds a new integration test (
drop_it_like_its_hot
) and CMake entries for airdrop testing - Updates GCS POST
/dodropnow
handler to calltriggerAirdrop
instead of UDP
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
tests/unit/cv/utilities_test.cpp | Removed stray semicolon in test closing brace |
tests/integration/mavlink_client.cpp | Changed argument parsing to use OBCConfig and expect config |
tests/integration/drop_it_like_its_hot.cpp | Added new airdrop integration test with triggerAirdrop |
tests/integration/CMakeLists.txt | Registered drop_it_like_its_hot executable and deps |
src/ticks/airdrop_approach.cpp | Added triggerAirdrop helper; updated tick to call relay |
src/network/mavlink.cpp | Implemented MavlinkClient::triggerRelay() and reordered includes |
src/network/gcs_routes.cpp | Updated /dodropnow to use triggerAirdrop with hardcoded index |
include/ticks/airdrop_approach.hpp | Declared triggerAirdrop |
include/network/mavlink.hpp | Declared triggerRelay |
deps/onnxruntime/onnxruntime.cmake | Disabled DOWNLOAD_EXTRACT_TIMESTAMP |
Comments suppressed due to low confidence (4)
tests/integration/mavlink_client.cpp:29
- The error message still says "Expected use: bin/mavsdk [config]" but you now require 5 arguments; update the message to reflect the actual expected args or show usage syntax.
if (argc != 5) {
tests/integration/drop_it_like_its_hot.cpp:8
- [nitpick] Typo in comment: "electro-pelectro-permanent" has a duplicated "pelectro"; consider "electro-permanent".
* For the 2025
src/ticks/airdrop_approach.cpp:218
- The ternary is inverted: when
state
is true it setsparam2
to 0.0f (off) but comment says 1=on; flip tostate ? 1.0f : 0.0f
.
command.param2 = state ? 0.0f : 1.0f; // 1=on, 0=off
src/network/gcs_routes.cpp:289
- The handler uses a hardcoded airdrop index instead of parsing
request.body
; restore parsing logic or map the incoming JSON index.
std::optional<airdrop_t> next_airdrop_to_drop;
src/network/gcs_routes.cpp
Outdated
if (triggerAirdrop(state->getMav() , next_airdrop_to_drop.value())) { | ||
LOG_RESPONSE(INFO, "Dropped Bottle Successfully", OK); | ||
} else { | ||
LOG_RESPONSE(INFO, "Failed to drop bottle", OK); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using OK
status code for failure is misleading; use an error status (e.g., INTERNAL_ERROR
) when the relay command fails.
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…pp into feat/cv-everything-airdrop
omg why did the goat @atar13 return 💀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this a couple times with the actual magnet and seems to actually work perfectly. One weird sorta related bug is that the relay is on by default, but once we send the HTTP request once, the default state is switched to off. Otherwise, looks good to merge.
I'm locked in. I'll keep the commits coming 🫡 |
drop_it_like_its_hot
tests the airdrop mechanism by callingtriggerAirdrop()
, which is defined inairdrop_approach