-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Wip/opendroneid #21075
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
Wip/opendroneid #21075
Conversation
8649a66
to
a47cb4c
Compare
Rebased this on master to have the proper mavlink submodule commit. I also removed the merge commits as we keep a linear commit history as we I think we will move all the processing input/output of messages from the GCS library into the OpenDroneID library. The reason I think this will be better is because Sorry, I should have warned you that is where I was thinking about going with this..... just too busy to get it done in the initial branch. However, before you make changes, lets get this passing autotests and see what the size cost really is. |
a47cb4c
to
10a4f77
Compare
Fixed some of the autotest errors and whitespace changes https://ardupilot.org/dev/docs/submitting-patches-back-to-master.html Hopefully, test_size completes now. And then we can consider getting this smaller. |
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'm not done reviewing this, but some cleanups that are needed are:
- timers be in _ms
- one-line accessors can just go into the header.
- You have lots of bounds checking on the sets, which is nice. Please use our in-house functions to turn your dozen lines into 1 line. If they're actually 1 line, move it to the header. See other libraries as examples.
- Wee need a special spot in memory to store the strings into non-volatile memory. That's something we can do in a follow-up PR, and likely by a maintainer since it's touchy playing in those parts of the code
- Change all you lat/lng to int32_t and use the built-in
Location
class. - when fiddling with strings use strncmpy() instead of memcpy().
@BluemarkInnovations I would be happy to test fly in US when the time comes and help in creating a wiki page for OpenDroneID compatible devices |
|
In general, I made a new revision of the code based on the feedback I received. It is much cleaner and less lines of code. Due to my limited git knowledge, I messed up with the MAVLink module and as a result I can't compile it anymore. I don't know how to solve or revert to a state that ArduPilot can be compiled again. I have asked @hendjoshsr71 to get this resolved. Once that is fixed I can do a final test with the MAVLink transponder. |
88ab1d7
to
74d08c7
Compare
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 did most of these changes already except the send_location() const
I didn't really review a lot as I ran out of time for the evening.
The send_location()
needs some work from me to pull in the correct info. and get it to be a const function. All sets should be external to it and done in the update function (ideally).
Eventually, most of the sets/gets will likely be removed since everything is only being accessed by the OpenDroneID library alone.
74d08c7
to
3a3d640
Compare
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.
It is really great to see the integration of Open Drone ID into Ardupilot. This is something I have been waiting for, for a very long time but didn't have the skill nor resources to do myself. I very much appreciate your effort here.
I added some comments. I think there are a few places that probably needs a bit of refinement but please take a look.
* (and a DroneBeacon MAVLink transponder connected to ttyUSB1) | ||
* | ||
* The Remote ID implementation expects a transponder that caches the received MAVLink messages from ArduPilot | ||
* and transmits them at the required intervals. So static messages are only send once to the transponder. |
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.
The last paragraph doesn't seem to fit line 157 - 159?
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.
Agreed, in the initial revision it was sent once. Based on feedback from Tom, it has changed to every 10 seconds in revision 1. This solution is better as a transponder may reboot or loose temporarily power. So I forgot to update the description. At this moment I won't update any code until Josh has finished reviewing the code.
} | ||
|
||
void set_operator_id_type(MAV_ODID_OPERATOR_ID_TYPE type) { | ||
//for now _operator_id_type can only be MAV_ODID_OPERATOR_ID_TYPE_CAA |
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.
Alignment.
3a3d640
to
b877c37
Compare
Still need lots of work on Added a basic functions for an arming check that can't be overriden. Still need to fix the |
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 marked this as a draft since it is really a working draft right. With many implementation details to be completed still.
Anyone interested feel free to comment or add pieces.
b877c37
to
d5a3d8c
Compare
It is okay for me to mark it as draft, but I prefer to have a first basic, minimum, implementation in ArduPilot, which can be improved over time. Today I checked the current PR version; it (still) works with my hardware. So the things missing in this PR are settings in the ground station (GCS) implemented where a user can set the Serial ID, Operator ID, Self ID and some other settings.like UAV type. And/or store these vars as strings non-volatile memory. On my end I aim to get 2nd generation hardware available in September. And there is the MAVLink PR for additional functionality. So, my only concern is that while on my end, I will make progress both on MAVLink messages and hardware, the draft status could cause support for Remote ID to be pending for some time. |
This is failing a lot of the CI tests because of the PreArm test you've added: |
@hendjoshsr71: I saw you have initiated a membership of the Ardupilot maintainers to the ASTM organization. Once you have access, apart from the remote ID standard, also pick up a copy of the recently published Means of Compliance document, which has some additional requirements needed to be fully compliant with the FAA rule. |
0891edb
to
dcaaa4f
Compare
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.
We should fix the time_accuracy bit I marked.
I will approve after that fix.
I do still disagree with get_undulation
method as evidenced by the gps changes. All but three (of all our GPS drivers) would then need to do WGS84_Ellipsoid - AMSL_EGR99
and then reverse that change for use.
It would be more natural to store and use WGS84. It will be hard to tell which altitude frames are available and where the undulation is referenced between. (Which geoid and ellipsoid)
We can fly with just WGS84 (as do now for many drivers.) But cannot fly alone with AMSL.
There will need to be arming check in terrain that doesn't allow arming if you are actually flying with respect to WGS84.
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.
Not a full review at this stage, just some initial comments.
I'm with @hendjoshsr71 that I would rather not have users directly manipulating undulation here as it's rapidly a tricky concept and easy to screw up. I'd rather just store the both altitudes directly, or provide a mapping function that maps an altitude between frames with a very clear name. (Maybe even like the Location altitude frames even though we'd only support 2 at the moment).
@@ -1855,6 +1865,16 @@ void AP_GPS::calc_blended_state(void) | |||
timing[GPS_BLENDED_INSTANCE].last_fix_time_ms = 0; | |||
timing[GPS_BLENDED_INSTANCE].last_message_time_ms = 0; | |||
|
|||
if (state[0].have_undulation) { | |||
state[GPS_BLENDED_INSTANCE].have_undulation = true; | |||
state[GPS_BLENDED_INSTANCE].undulation = state[0].undulation; |
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.
The vertical position is possibly blended here, but the undulation isn't? Given the differences in stored table accuracies that will result in random step changes.
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.
only used in one plane, in AP_OpenDroneID and both receivers should be giving the same undulation. It is a very slowly changing number with distance. We really only support blending between two receivers of the same type due to the way we use the accuracy numbers
|
||
// we need to notify user if we lost the transmitter | ||
if (now_ms - last_arm_status_ms > 5000) { | ||
GCS_SEND_TEXT(MAV_SEVERITY_WARNING, "ODID: lost transmitter"); |
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.
Once you've lost link doesn't this result in flooding the links with a status text?
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.
once every 5s only, and apparently required by the FAA to notify users
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.
Where's the rate limiting come from though? I only see 2 places that set it, once over CAN, and once over MAVLink. In both cases the last_arm_status_ms
is only updated if a specific message is received, but the send text here is in an always called path from update(), so why wouldn't it flood the link after 5 seconds?
MAV_ODID_HOR_ACC AP_OpenDroneID::create_enum_horizontal_accuracy(float accuracy) const | ||
{ | ||
// Out of bounds return UKNOWN flag | ||
if (accuracy < 0.0 || accuracy >= 18520.0) { |
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.
Why bother checking the maximum here? It just means we have to keep that updated with table. We need to sanity check the low side obviously, but the final return statement will cover the high side for us nicely.
// make sure value is within limits of remote ID standard | ||
uint16_t AP_OpenDroneID::create_speed_horizontal(uint16_t speed) const | ||
{ | ||
if (speed > ODID_MAX_SPEED_H) { // constraint function can't be used, because out of range value is invalid |
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.
This seems like a very odd construction, ODID_MAX_SPEED_H is a float, that we compare against a uint16_t
argument that is truncating our floating point representation. I suspect that the speed
argument is supposed to be a float, and the return also is based on the defines, and the fact that anything else truncates to meter resolution.
Why not scale in here and have this just return the correctly output scalled cm/s uint16_t?
This looks like a common problem on these helpers.
@WickedShell doing separate accessors for the two heights gets out of hand quickly as we use Location struct, which ties in with AP_Mission and a thousand other places. |
|
||
alloc_failed: | ||
dronecan_init_failed |= driver_mask; | ||
GCS_SEND_TEXT(MAV_SEVERITY_NOTICE, "OpenDroneID DroneCAN alloc failed"); |
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.
We should probably call alloc_error
here.This message could easily be lost in a rush of startup messages otherwise.
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.
Fine as is and fix ups for the other issues found (not yet resolved) can be done as cleanups.
happy to do followup PRs, but for now we need to get base support in
WIP Initial Remote ID (open drone ID) implementation and tested with a Remote ID MAVLink transponder (DroneBeacon MAVlLnk transponder, https://dronescout.co/dronebeacon-mavlink-remote-id-transponder/). This command in the ArduPlane folder is used for testing:
sim_vehicle.py --wipe-eeprom --console --map -A --serial1=uart:/dev/ttyUSB1:9600
(and a DroneBeacon MAVLink transponder connected to ttyUSB1)This implementation supports these MAVLink messages:
Issues/To Do
- System messages are not received by the transponder at all. Cause unsure, perhaps MAVLink library needs to be regenerated? Even on low level the transponder does not detect this system message packet type. Other open drone ID MAVLink messages are detected.If I look to the byte stream, system messages are transmitted by sim_vehicle. Clearly something goes wrong with parsing MAVLink messages at the transponder. This is outside ArduPilot. I will do more investigation why with the (internal) test MAVLink TX application, all message types are decoded successful by the transponder, whereas with sim_vehicle it doesn't.The issue was an outdated MAVLink library version at the transponder side. Now all messages are successful decoded including the system message.- sim vehicle simulator is too slow to test properly. If multiple MAVLink messages are sent at the same time, some are skipped. Perhaps this is due to the 20 Hz update rate.See previous point, there seem to be issues with MAVLink parsing at the transponder.As such, some MAVLink packets are not recognized.Timeline