Adding MAVLINK support

erskyTx runs on many radios and upgrade boards
ersky9x was a port of er9x for use on the sky9x board.
User avatar
RCHH
Posts: 465
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH » Sat Apr 16, 2016 2:57 pm

Oooooo! That is something I never even thought about when testing this back along! I only ever connected with a 3S pack. Will try with a 4S (And a 6S as I have an APM power module that can deal with that voltage). Will get back to you with the results later on.
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!


User avatar
MikeB
9x Developer
Posts: 16626
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB » Sat Apr 16, 2016 3:58 pm

The code looks to put a limit of 5 cells in, I have no idea why.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
RCHH
Posts: 465
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH » Sun Apr 17, 2016 7:09 pm

Mike,

Confirmed that the limit is 5S, nevertheless voltages when I connect up a 6S battery @25V are divided 'correctly' to the five 'Vx=' places on the telemetry screen with close as damnit to 5V, with V6= remaining blank.

Likewise, with 4S and 5S packs the readings and voltages are divided accurately to the 4 and 5 'Vx=' places respectively.

I understand the voltages in the Vx= are not 'actual' cell voltages, but is there a way to populate the V6= at all when a 6S pack is used?
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!

User avatar
MikeB
9x Developer
Posts: 16626
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB » Sun Apr 17, 2016 7:26 pm

I can probably remove the 5 cell limit, I don't know why it is there, unless a discharged 6-cell pack is low enough to appear as a fully charged 5-cell pack. A 6-cell, at 3.5V per cell, is the same voltage as a 5-cell at 4.2V per cell.
Perhaps I need to add an option link or two to the pro mini to specify the number of cells.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
RCHH
Posts: 465
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH » Sun Apr 17, 2016 8:28 pm

That would be great.

And I suspect you are right about the 5S limit, although it might have been done before the power modules that could run 6S were in the wild ...
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!


tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 » Mon Apr 25, 2016 9:18 pm

Hi,

just got worried about new issue that occured today.
FasV fluctutates +/- 0.2V wildly around correct voltage on 9xr pro display. In mission planner it does not fluctuate more than few 0.01V.
FasV worked Ok and stable 10 days ago (no fluctuation at all!). All I have changed was configuring APM channels, calibrating compass and failsafes and changing some logical switches on 9xr pro, but that should not be the reason. As i stated: in mission planner FasV is correct with minimal fluctuation so wokring correctly as before.

tomi

User avatar
MikeB
9x Developer
Posts: 16626
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB » Mon Apr 25, 2016 9:43 pm

I have seen such a fluctuation. I assumed mission planner has some smoothing of the value before it is displayed.
Are you using hub or SPort?

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 » Mon Apr 25, 2016 9:50 pm

It seems to be power issue with APM, but i am not sure why.
10 day ago, when FasV was working OK, APM was not connected to rx, but was used just to show flight data. It was powered by powermodule.
Now I connected APM inputs to rx and outputs to servos, one of servo output is connected to motor esc bec. JP1 on APM is open.
It seems that powermodule does not provide enough juice for rx and arduino mini pro together with APM. for test i disconnected rx to apm inputs and connected rx to esc bec. the value on FasV was not fluctuating. Then I connected back APM inputs to rx, but bec was not connected to outputs. FasV flucutated wildly again.
What can i do?

tomi

tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 » Wed Apr 27, 2016 8:03 am

Ok here is the story:

it is the power module. CLONE. The second one...Which i paid 20 euros, just to be sure to get good quality stuff...
It just has enough power to drive apm+mini pro+gps + airspeed sensor+optionally x8r.
I say optionally because if i switch 9xr pro transmitter off, FasV is stable, however, when telemetry link is active between 9xr pro and x8r it is too much for the PM. Also other data seem to fluctuate (airspeed is wrong), if PM is pushed over the limit.

I am sending 4 mission planner logs as attachments:
see CURR: Vcc (voltage on APM positive rail in mV) and Volt (voltage in mV sensed by PM on battery, that is then multiplied with around 10 to get FasV).
file names are self explanatory as are wild fluctuations of Volt and Vcc in case of x8r powered by PM.

I was lucky to see this FasV fluctuation on ground when setting and calibrating APM, I don't know what would happen if I fly that way...

The solution: removing 5V wire from powermodule to the APM and adding another UBEC 5V.
I found two cheap china UBECs:

http://www.ebay.co.uk/itm/5V-4A-RC-Mode ... Sw5dNWr1BP

http://www.ebay.co.uk/itm/3A-UBEC-5V-6V ... Sw37tWC58l

Should I go for 4A or 3A? Is shielding important if UBEC is used to power rx and APM?
voltage fluctuation PM and BEC x8r logs.rar
data flash mission planner logs
(20.91 KiB) Downloaded 44 times
tomi

User avatar
RCHH
Posts: 465
Joined: Sun Jun 24, 2012 2:48 pm
Country: -
Location: Plymouth

Re: Adding MAVLINK support

Post by RCHH » Wed Apr 27, 2016 8:34 am

Symptoms you describe are pretty much as expected. The power modules are shall we say, barely up to it for running 'extras'. I always use an additional BEC for receivers and other accessories.

Weight for weight, always go for the highest Amp rated BEC you can, and run all you can from it and leave the power module running the flight controller only.

It will involve a bit of extra spaghetti ... erm ... wiring, but is well worth it for peace of mind.
The simpleton asked "Hows about ErSky9X for Horus???". And the Genius from Dorset replied "Why not indeed? I shall get right onto it!" And then there was light on Horus! And it was good!

tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 » Wed Apr 27, 2016 11:32 am

Tnx. I am still afraid of what could happen if APM did reset in the air. It can be seen from the log that Vcc went down to 4.6V range quite often.

The solution i see now is following: PM for measuring voltage and current of the main battery, but PM not powering APM (so removing 5V leads from 6 pin PM, APM cable).

Additional UBEC 5V for powering APM, rx, mini pro, miniOSD (its 5V part).
JP1 removed on APM.

The two UBECs that I posted ebay links have either 3A and some sort of interfenece damping... or 4A without it. Please see both items and tell me if there is any difference between two for my application. I guess 3A is plenty for rx, apm, gps and mini pro. Or should I go for 4A version and forget interference shielding/damping?

tnx

tomi

User avatar
bob195558
Posts: 2139
Joined: Sun Dec 16, 2012 7:24 pm
Country: United States
Location: New England, Vermont
Contact:

Re: Adding MAVLINK support

Post by bob195558 » Wed Apr 27, 2016 11:46 am

6 Amp UBEC (https://alofthobbies.com/6amp-ubec.html).
:oops: oops out of stock, good UBEC though.
Er9x on 9x radio, with Smartieparts Programmer and TelemetrEZ Board.
ErSky9x on Taranis, Sky9x, 9Xtreme radios.

3D Printing upgrades with (CR10 3D Printer): (http://openrcforums.com/forum/viewforum.php?f=85).

stewwy
Posts: 36
Joined: Fri Oct 02, 2015 11:44 pm
Country: United Kingdom

Re: Adding MAVLINK support

Post by stewwy » Sun May 08, 2016 9:22 pm

I've just been given a Taranis to play with :D , I had this working with my 9x and extreme board.

On the taranis I've populated the sensors and I get the following:

SENSORS VALUE INSTANCE
1 SWR CORRECT 25
2 RSSI CORRECT 25
3 RxBT CORRECT 25
4 VFAS 0.00V 27
5 001D 81 0
6 Tmp2 103C 0
7 CuRR 0.0A 27
8 RPM 0 27
9 0007 48-50 0 varies
10 000C 25 0
11 000A 90 0
12 000F 270 0
13 GPS CORRECT 27
14 FUEL -1.00% 0 Probably correct
15 Galt -.3m 27 Probably correct
16 000D 75 0
17 000E 0 0
18 Aspd 0.1knts 27 Probably correct
19 Tmp1 -513 0 changes with flight mode in degrees as populated
20 Alt 1m 27 Probably correct
21 Hdg 284 27 Correct (checked in degrees)
22 Gppd .4knts 27 Correct (margin of error)
23 000B 0.00V 0
24 0020 99 0 ?
25 001F 0 0
26 001E 0 0



The obvious ones will be no trouble to use on a telemetry screen.
What is the 'Instance', the location of the sensor?
Now where do I go to understand all this
Would the lua script from the teensy board work without too much altering, I know nothing about lua scripting, but I understand scripting languages from other work I've done.
I'm willing to learn if I'm not wasting my time, it seems the sensor numbers are different from those used with the teensy I can probably work out a conversion if its that simple

any help or guidance would be much appreciated

PS I don't want to put ersye on the taranis just yet

User avatar
MikeB
9x Developer
Posts: 16626
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB » Sun May 08, 2016 10:40 pm

Since you are using openTx, and this is an ersky9x thread, you may not get many replies!

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

stewwy
Posts: 36
Joined: Fri Oct 02, 2015 11:44 pm
Country: United Kingdom

Re: Adding MAVLINK support

Post by stewwy » Mon May 09, 2016 12:43 am

I guess so :-) sorry! It's late and I've drunk too much coffee

but am I right in assuming I'm getting all the data on the taranis and all I've got to do now is figure out how to show it ?

User avatar
MikeB
9x Developer
Posts: 16626
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB » Mon May 09, 2016 8:20 am

I think so. For information, the sensors showing just as numbers are as follows:

HOME_DIR 0xA
HOME_DIST 0xB
CPU_LOAD 0xC
GPS_HDOP 0xD
WP_NUM 0xE
WP_BEARING 0xF

BASEMODE 0x1D
WP_DIST 0x1E
HEALTH 0x1F
STATUS_MSG 0x20

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 » Thu May 19, 2016 8:16 am

Hi,

Mike, is Vspd already being sent through telemetry or do you have to enable it in arduino code?
My brother and I need Vspd to get vario working on 9xr pro.

tomi

User avatar
MikeB
9x Developer
Posts: 16626
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB » Thu May 19, 2016 8:32 am

Vspd is nopt currently being sent. The code I have, in the Arduino, that processes the MAVLINK messages doesn't pick out a vertical speed value, so I didn't know it could be returned. I'll need to find out where it is in the messages to be able to return it.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
MikeB
9x Developer
Posts: 16626
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB » Thu May 19, 2016 9:52 am

I've (hopefully) added Vspd to the Arduino code. I've committed the changes to Github here: https://github.com/MikeBland/APM_Mavlink_to_FrSky.

I haven't tested these as I don't currently have anything set up to do the tests.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 » Thu May 19, 2016 12:39 pm

Hi,

tested it. It does not appear to work. Vspd stays 0.0. I did not fly but lifted the plane by hand.
Mission planner shows vertical speed data up to 1m/s when lifting quickly. I tried to use scaler to amplify Vspd by 100 but no change.

tomi

User avatar
MikeB
9x Developer
Posts: 16626
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB » Thu May 19, 2016 1:07 pm

Are you using "hub" or "SPort" protocol?
I just noticed that the SPort wasn't sending the extra value, I just committed a fix for that.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 » Thu May 19, 2016 1:58 pm

s.port

tomi

User avatar
MikeB
9x Developer
Posts: 16626
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB » Thu May 19, 2016 2:46 pm

OK, try the commit I did after seeing I hadn't got the SPort sending the Vspd value.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 » Thu May 19, 2016 2:54 pm

It works now!
Great.

Out of curiosity Mike: how much bandwith on frsky telemetry is left for further variables?

tomi

User avatar
MikeB
9x Developer
Posts: 16626
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB » Thu May 19, 2016 3:36 pm

I'm not sure with the hub. On SPort, as you add more, then the rate at which each item gets sent is reduced.
We could 'tune' the rates. Currently I'm sending 21 values in sequence, but two of these send items in their own sequence so their rate of transmission is reduced.
e.g. One item is: WP_DIST, WP_NUM, WP_BEARING, HOME_DIST, STATUS_MSG, and HEALTH, so these are sent a sixth as often as other items.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

ladicek1
Posts: 2
Joined: Thu Feb 11, 2016 10:06 pm
Country: -

Re: Adding MAVLINK support

Post by ladicek1 » Sun May 22, 2016 9:57 am

Hi I was wondering if now that Vspd works you could make vario do continous tone on descend and beeps on ascend. And maybe send vario more often, because if you are gliding you must know exactly when you're going up and when down.

User avatar
jhsa
Posts: 19047
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Adding MAVLINK support

Post by jhsa » Sun May 22, 2016 10:14 am

The vario itself has normally some delay. About a second or so. And that happens in real aircraft as well, at least the vertical speed indicators I've used did :)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 » Mon May 30, 2016 8:48 pm

Hi,

Mike could you add Ctot variable to the telemetry stream, please?

I managed to calibrate power module to show current readings and total consumed charge (mAh) on APM dead on (less than 1% difference) by correcting voltage/amps factor in APM settings to match Ctot (total charge consumed) of the APM to the charge reading by battery charger.
The problem is that on 9xr pro mAh is calculated from current, but values of Ctot on APM and mAh shown by 9xr pro differ by 20%. I know I could use scaler to compensate, but sending Ctot from the APM to the telemetry stream would give more reliable results. I guess.

And another request from my brother Ladi (ladicek1): could you please improve sink tones for vario. I am not really into this, but I guess, that the tone should be continous when altitude is dropping, and intermittent when altitude is rising. Now the tones are intermittent for both directions. The frequency of the tone varies with rate of climb or sink, of course.

tnx.

tomi

User avatar
MikeB
9x Developer
Posts: 16626
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB » Mon May 30, 2016 11:21 pm

Ctot is Cell TOTal on the radio, calculated by adding up the individual cell voltages sent by MavLink, nothing to do with current.
Is the current (Amps) value shown on the radio the same as on the APM?

I have a note to do something with the vario tones, I just don't know when I'll have time to look into it, I have several other requests for changes as well.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

tomismrkolj1
Posts: 58
Joined: Sun Jan 24, 2016 10:32 am
Country: -

Re: Adding MAVLINK support

Post by tomismrkolj1 » Tue May 31, 2016 7:31 am

Ok it is not Ctot but CurrTot on APM.
CurrTot is total charge calculated from current measurement by powermodule since APM boot and is one of the variables in Mavlink stream.
I am not sure how to compare current seen by APM to the value on 9xr, since telemetry link drops, when USB is connected to the APM.


tomi


Post Reply

Return to “erskyTx (was ersky9x)”