ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

Add support for Baro/Vario in CRSF

Open andyp1per opened this issue 1 year ago • 42 comments

Fixes the CRSF part of https://github.com/ArduPilot/ardupilot/issues/26699

andyp1per avatar Apr 24 '24 15:04 andyp1per

Is it possible for me to do some test?

Hardware Kakute F7 Mini and SpeedyBee F405 Wing Mini.

br Karl

Merga189 avatar Apr 25 '24 07:04 Merga189

With a SpeedyBee F405 Wing I would also like to have a look at this. I would just need the right firmware for it ...

Target0815 avatar Apr 25 '24 09:04 Target0815

If it is OK!?

I build for the SpeedyBee F405 WING

parameter list version: 4.6.0 dev

Speedy_Test.params.txt

FW

bin.zip

Karl

Merga189 avatar Apr 25 '24 10:04 Merga189

No baro values on SpeedyBee F405 WING mini with FW 4.6.0 dev.

FrSky X10S Express, EdgeTX 2.9.4, HiYounger TX module + BETAFPV 2.4GHz Nano RX ELRS 3.3.2, SppedyBee F405 Wing mini only with BT slave on Serial 6 for communication. No GPS connected.

xxx.params.txt

Merga189 avatar Apr 25 '24 12:04 Merga189

Do you get any extra sensors if you search for them? I only did ID 9, not ID 7 (Baro only)

andyp1per avatar Apr 25 '24 16:04 andyp1per

@andyp1per Can you please provide a firmware for SpeedyBee F405 Wing?

Target0815 avatar Apr 25 '24 18:04 Target0815

Deleted all sensor and searched again.

That is, what I have here on the table

Screenshot_2024-04-25_20-55-31

It is just a F405 WING Mini with RX and BT module, nothing else. The parameter list with your Version: 4.6.0 dev I posted before. No changes made.

Here the radio telemetry screen and the companion telemetry screen -fresh- 1

2

No id 9

br Karl

PS. If helpful, can post same pics with Kakute F7 mini. But there id 9 also did not show up ....

Merga189 avatar Apr 25 '24 19:04 Merga189

@andyp1per

I think, there is an error on my side.

I cloned your fork ~$ git clone --recurse-submodules https://github.com/andyp1per/ardupilot.git and just build the firmware.

But checking, if your modifications like

Screenshot_2024-04-26_08-50-52

are actually in the code I did build here I see that

Screenshot_2024-04-26_08-47-00

My apologize for the confusion

Best you provide a firmware for the SpeedyBee F405 Wing

Karl

Merga189 avatar Apr 26 '24 06:04 Merga189

ID 9 shows up! Wrong value, but it is there .....

screen-2024-04-26-093844 screen-2024-04-26-093854

Values jumping between -xxxx m and +xxx m here

Merga189 avatar Apr 26 '24 07:04 Merga189

ID 9 shows up! Wrong value, but it is there .....

screen-2024-04-26-093844 screen-2024-04-26-093854

Values jumping between -xxxx m and +xxx m here

Do you have a GPS? Worth checking this when armed and outside as it is relative alt above home position which needs to be set. I used the code from the CRSF spec, so it could be wrong - but not sure how I would tell. What about the vario data?

andyp1per avatar Apr 26 '24 08:04 andyp1per

arduplane.apj.zip

Try this one, I think I need to invert the sign since AP deals in down rather than up

andyp1per avatar Apr 26 '24 08:04 andyp1per

GPS attached. FW changed. Have the FC here on the window sill

Untitled

Merga189 avatar Apr 26 '24 08:04 Merga189

With Ethos 1.5.6

screenshot-2024-04-26-41102

I still have to test whether the values are correct ...

Target0815 avatar Apr 26 '24 09:04 Target0815

Ethos can evaluate the frame CRSF_FRAMETYPE_BARO_ALTITUDE with ID9 (Alt and VSpd). EdgeTX only evaluates CRSF_FRAMETYPE_VARIO with ID7 (VSpd).

It would be an advantage for Ardupilot if we could use both. Possibly switchable with a flag in RC_OPTIONS or similar. This would cover all transmitter systems.

As for the values themselves, the calculations used for the S.Port protocol can be found in AP_Frsky_Telem. Presumably you can see there which sign is used and adopt this in part for CRSF.

Target0815 avatar Apr 26 '24 10:04 Target0815

This includes ID 7 - please try it arduplane.zip

andyp1per avatar Apr 27 '24 14:04 andyp1per

EdgeTX 2.9.4 VSpd - ID7 - shows changing values between -25.x m/s to +50.x m/s without movement (incorrect) Alt - ID9 - constantly shows -586.5m (incorrect) for comparison Alt - ID2 - shows 0 (correct)

Ethos 1.5.6 VSpd - ID7 - shows changing values between -25.x m/s to +50.x m/s without movement (incorrect) Alt - ID9 - 0 m (correct) VSpd - ID9 - shows a constant 1.43 m/s (incorrect)

Target0815 avatar Apr 27 '24 15:04 Target0815

Alt and VSpd show up, but irregular values.

50' YT video showing first baro values on QGroundcontrol and then values on my radio.

https://youtu.be/iiIft0VpIOk

Merga189 avatar Apr 27 '24 16:04 Merga189

So there was a bug in the new code where it was using absolute alt instead of relative. Should be fixed now.

arduplane.zip

I think the errors in vspd are actually quantization errors since this is only an 8-bit int. We might have to special-case 0 to return 0;

andyp1per avatar Apr 27 '24 19:04 andyp1per

VSpd id 7. moving up down in between +1xx.x m/s and -9x.x m/s

ALT id 9. -1000.0 m fix, not moving at all

ELRS

Merga189 avatar Apr 27 '24 20:04 Merga189

arduplane.zip - think there was a sign conversion issue.

Can you send me a disarmed log of your vehicle? There is not a lot going on in these calculations, but there is some weird conversion.

andyp1per avatar Apr 27 '24 20:04 andyp1per

arduplane.zip - think there was a sign conversion issue.

Can you send me a disarmed log of your vehicle? There is not a lot going on in these calculations, but there is some weird conversion.

I am just a user and at the moment there is no vehicle. It is just the SpeedBee in the window sill. MP or QG? But I'll flash now and come back ....

Merga189 avatar Apr 27 '24 20:04 Merga189

VSpd - varying between -/+ xxx m/s Alt - crazy numbers -/+ xxxxx m

What is that "disarmed log"?? MP or QG

Merga189 avatar Apr 27 '24 20:04 Merga189

I think, 'data log' in MP. I am on Linux here with QG, but I have a WIN with MP in a Vbox. So I'll try ....

Merga189 avatar Apr 27 '24 20:04 Merga189

Andy_log.zip

Log 1: original 4.6.0 with ER8GV Vario RX Log 4: Andy 4.6.0 with Standard ELRS RX

You should be able to make a good comparison.

Target0815 avatar Apr 27 '24 20:04 Target0815

2024-04-27 22-56-34.tlog.zip

Hope, that is the right one.

Good night, shut down now ;-)

Merga189 avatar Apr 27 '24 21:04 Merga189

Ok, pretty sure this is correct now:

arduplane.zip

Constant 10000 is expected - that's 0m above home or 10000dm above the minimum altitude which is 1000m below home. The switching between -1/+1 etc for vpsd is also expected - this is in cm/s for ID7 and is a log scale for ID9 so represents something like +-0.05ms which is perfectly reasonable. So my guess is that the decoding on your TX side that is the problem.

andyp1per avatar Apr 28 '24 16:04 andyp1per

Set RATIO for VSpd and Alt to 0.1 on the radio here. ELRS. Alt and VSpd values now in region +/- x.x m/s and x.x m.

Put the FC in a blown up plastic shopping bag and compress the bag with my hand. Alt value static, VSpd moving, but in my eyes not making seens.

Merga189 avatar Apr 28 '24 18:04 Merga189

Alt value is relative height above home which will not change unless you arm.

andyp1per avatar Apr 28 '24 19:04 andyp1per

I see on MP, that the FC is ARMED (ARM/DISARM on toggle switch) Alt here with me rock solid -4.5m. Putting a plastic bag over the FC and putting hand pressure on the bag, in MP see - 30 ... -40m, but value is 9 rock solid. For VSpd same. a little variation, but not a measurement as expected ... ELRS

Merga189 avatar Apr 28 '24 20:04 Merga189