add actuators, magnetometer, barometer and imu #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Actuator (ESC/Servo) and minimal sensors set interfaces
Here I've added some interfaces to complete the minimal UAV application. Please read their short descriptions:
It is a compromise based on how ArduPilot and PX4 handle DroneCAN, what we have in the current UDRAL, the old DS015 and some comments from Andrew Tridgell.
Below you can see few additional notes.
1. Actuators (ESC and servo) feedback
For ESC both autopilots use esc.Status. They skip power_rating_pct, so we have:
For servos autopilots use actuator.Status the following fields for logging only:
Both autopilots have additional messages:
I see the following reasons why we should split this data into a few logical groups instead of packing it into a single message:
A single message approach doesn't require additional registers for the configuration and may be more easier to parse for an autopilot, but here we don't have the strict requirement to process everything at once as with GNSS.
Both the single and the separated messages have the same bandwidth utilization at the fixed publication rate.
2. Actuators setpoint
DroneCAN suggests the following messages:
The UDRAL setpoint is based on the assumption that we have a constant number of actuators in an actuator group during the flight. It is expected to use Vector4 for a quadcopter, Vector8 for a octocopter and so on. For a subscriber, the size of the Vector doesn't matter due to Implicit zero extension of missing data rule. Compared to DroneCAN:
Design issue.
It was rightly mentioned by Andrew Tridgell that The design is that if commanding 8 ESCs you use a Vector8, for 16 ESCs you use Vector16, etc, so it leads to code when we control only a specific number.
But it is actually not the UDRAL issue. We can either fix it on nunavut side, or write our own serialization. It might be rewritten to:
reg_udral_service_actuator_common_sp_GeneralVector_0_1_serialize_(&vector31_sp, buf, &buf_size, number_of_channels);
3. Magnetometer
In DroneCAN both autopilots use:
Since Cyphal is based on SI, I've extended it to float32[3].
4. Barometer
In DroneCAN we use:
No one uses variance for nor pressure or temperature. So, let's just use:
5. IMU
The DroneCAN RawImu is overloaded. I didn't see anyone use timestamp, integrated samples and covariance that makes it much more efficient. I personally would like to separate them into just raw data because I need to publish this data with rate 200+ messages/second:
These 2 messages uses 4 CAN-frames together while the current DroneCAN version uses 7 frames. We can even consider optimizing it to float16.
Example
Please check an example of a VTOL application based on this interface.
Please, provide your feedback.