Skip to content
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

mavlink_main: stream attitude as quaternion if HIL #24099

Open
wants to merge 40 commits into
base: main
Choose a base branch
from

Conversation

mbjd
Copy link

@mbjd mbjd commented Dec 12, 2024

Solved Problem

Previously with SIH, for some VTOL airframes (e.g. SIH Tailsitter Duo, 1102) the attitude display on the ground station was wrong due to the body frame in forward flight differing from the usual convention.

Solution

The rotation of the body frame is already accounted for when sending the attitude as quaternion [1] over mavlink, but not when sending it as euler angles [2]. Therefore, if in SIH/HIL we always send it as a quaternion as well.

1: src/modules/mavlink/streams/ATTITUDE_QUATERNION.hpp
2: src/modules/mavlink/streams/ALTITUDE.hpp

Alternatives

  • add similar logic as in [1] to [2] so display attitude is correct regardless of numerical representation
  • enable sending quaternions only for the relevant VTOL airframes

Test coverage

  • SIH test with SIH Tailsitter Duo (1102)

mbjd added 2 commits December 12, 2024 16:05
Previously with SIH, for some VTOL airframes (e.g. SIH Tailsitter Duo,
1102) the attitude display on the ground station was wrong due to the
body frame in forward flight differing from the usual convention.

This is accounted for when sending the attitude as quaternion [1] over
mavlink, but not when sending it as euler angles [2]. Therefore, in
SIH/HIL we always send it as a quaternion.

1: src/modules/mavlink/streams/ATTITUDE_QUATERNION.hpp
2: src/modules/mavlink/streams/ALTITUDE.hpp
@KonradRudin KonradRudin requested a review from sfuhrer December 17, 2024 08:31
Copy link
Contributor

@sfuhrer sfuhrer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you also need to add it in the disable HIL section below.

And I wonder if it's then not still broken for real tailsitters and we thus need to find a more generic solution.

@KonradRudin
Copy link
Contributor

I think you also need to add it in the disable HIL section below.

The problem is that it might be already enabled, so you don't want to disable in every case. Also a change of the parameter requires a reboot, so the else case does not make much sense, no?

And I wonder if it's then not still broken for real tailsitters and we thus need to find a more generic solution.

Would need to test this then and report if it is still a problem.

@mbjd mbjd assigned mbjd and mcsauder and unassigned mbjd and mcsauder Dec 18, 2024
sfuhrer and others added 19 commits December 18, 2024 16:58
Filtered innovations and test ratios can be large before the reset and
would trigger pre-flight warnings
Do this even when GNSS altitude fusion is disabled.
    - mavlink in PX4/Firmware (661ae0c): mavlink/mavlink@0e42010
    - mavlink current upstream: mavlink/mavlink@5e3a42b
    - Changes: mavlink/mavlink@0e42010...5e3a42b

    5e3a42b8 2024-12-12 Hamish Willee - development: Remove parameter transaction proposal (PX4#2169)
25f4e9f0 2024-12-11 Hamish Willee - STANDARD_MODE_SAFE_RECOVERY + RTL merge (PX4#2191)
d5a8cb4 2024-12-11 Hamish Willee - Docs generate fix (PX4#2194)
35f70c4a 2024-12-05 Hamish Willee - Create index.md, dialects.md and make notes/warning work with vitepress (PX4#2193)
57c02856 2024-12-05 Hamish Willee - CAMERA_THERMAL_RANGE - no longer WIP (PX4#2189)
1ee2ebe1 2024-12-04 Hamish Willee - fetch_dialect_ardupilotmega.yml: Not fail if nothing to commit (PX4#2181)
1aa8c2d0 2024-12-04 Hamish Willee - ardupilotmega - remove_mav_cmd_external_estimate (PX4#2187)
49fa509a 2024-11-30 github-actions[bot] - ardupilotmega dialects from ArduPilot/mavlink: Fri Nov 29 23:49:36 UTC 2024 (PX4#2185)
75ebfc8f 2024-11-30 Hamish Willee - Update fetch_dialect_ardupilotmega.yml - fix copy error (PX4#2184)
8e97709d 2024-11-30 Hamish Willee - fetch_dialect_ardupilotmega.yml - add loweheiser (PX4#2183)
82b81aa8 2024-11-27 github-actions[bot] - ardupilotmega.xml from ArduPilot/mavlink: Wed Nov 27 04:13:16 UTC 2024 (PX4#2178)
5c421a33 2024-11-27 Hamish Willee - Speed uncertainty units /s (PX4#2180)
33f8a327 2024-11-24 David Sastre - Some modifications to multi-GCS protocol (PX4#2179)
9938f940 2024-11-21 Hamish Willee - fetch_dialect_ardupilotmega - create (PX4#2177)
a55d0ec5 2024-11-21 Hamish Willee - MAV_CMD_GROUP_START and _GROUP_END delete wip (PX4#2176)
1cf3c721 2024-11-21 Hamish Willee - dev: move FUEL_STATUS to common (PX4#2170)
7ecb8e33 2024-11-21 Hamish Willee - WIFI_NETWORK_SECURITY - wip removal (PX4#2164)
… to a publishing per sector design.

other minor improvements
alexcekay and others added 19 commits December 18, 2024 16:58
…ansition (PX4#23893)

* split methods to control backtransition depening on availablity of position

Signed-off-by: RomanBapst <[email protected]>

* fixed sign error and replace hardcoded number with constant

Signed-off-by: RomanBapst <[email protected]>

* make changes such that controller holds initial heading during transition

Signed-off-by: RomanBapst <[email protected]>

* use reference instead of copy

Signed-off-by: RomanBapst <[email protected]>

* added comment

Signed-off-by: RomanBapst <[email protected]>

* flash reduction

Signed-off-by: RomanBapst <[email protected]>

---------

Signed-off-by: RomanBapst <[email protected]>
 - accel cal use Accelerometer calibration class to fully respect
   rotation (both internal and external sensors)
The generated code is not much faster than the simple matrix-vector
multiplication
See https://mavlink.io/en/messages/development.html#MAV_STANDARD_MODE.
The only standard mode that is not set is MAV_STANDARD_MODE_SAFE_RECOVERY,
as PX4 uses RTL for that (with configuration parameters).
MAV_STANDARD_MODE_SAFE_RECOVERY and MAV_STANDARD_MODE_RETURN_HOME got
merged.
When we use a gimbal connected via "RC", so PWM via the Aux channels, we
need to set the gimbal_device_id to 1 as per the protocol.

This was missing for GIMBAL_DEVICE_ATTITUDE_STATUS, so I added that, and
fixed the name of that variable while at it.
This saves flash and makes code simpler
Then the update function can set the dt at every iteration if needed
The calculation of "alpha" in the accel_horiz and height_rate lowpass
filters is slightly different than before.
* Adding gimbal rate in gz simulation

* add submodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.