Adding MAVLINK support

erskyTx runs on many radios and upgrade boards
ersky9x was a port of er9x for use on the sky9x board.
Geofrancis
Posts: 27
Joined: Sat Jul 02, 2016 10:44 am
Country: -

Re: Adding MAVLINK support

Post by Geofrancis »

il post you an apm if you want to give it a go?

i tried compiling for a 32u but there are errors that i lack the skills to fix.

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

Re: Adding MAVLINK support

Post by MikeB »

I'm not sure I could find enough time to do that at present.
You could post some of the errors and I'll see if I can fix them.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
jmeireles
Posts: 2
Joined: Wed Aug 16, 2017 11:59 pm
Country: -

Re: Adding MAVLINK support

Post by jmeireles »

Hi,
First of all thanks for all great work with ersk9x.

I have a 9xrpro with a frsky XJT module and I was looking for a telemetry solution to use with it and with my quadcopter. After found this thread, I build right way the Arduino Pro Mini.

I tested it and it is working but with two issues. I think. First, and I don't know if it is supposed, every 5 or 6 seconds, all display data start to blink for about a second and then recover again. The other issue is related with hdop info that also blink every time and the bar is always dropping to zero. But in mission planner the hdop info is stable.

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

Re: Adding MAVLINK support

Post by MikeB »

The data blinking indicates telemetry data hasn't arrived for a while.
What revision of ersky9x are you running?
On recent test versions I've added individual timeouts on telemetry data, together with an option to extend the timeout.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
jmeireles
Posts: 2
Joined: Wed Aug 16, 2017 11:59 pm
Country: -

Re: Adding MAVLINK support

Post by jmeireles »

Hi,
I am using version ersky9x-pe2r221. Where can I tweak the timeouts?

Thanks,
Jorge

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

Re: Adding MAVLINK support

Post by MikeB »

TELEMETRY - LOGGING, the 4th item is "DATA TIMEOUT(S)", which starts at 2.5(seconds).

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
bnwgraaf
Posts: 18
Joined: Sun Sep 03, 2017 7:18 am
Country: -

Re: Adding MAVLINK support

Post by bnwgraaf »

Okay, I finally bought my quadcopter and now I would like to get some telemetry data on the screen of my transmitter.

I have:
- APM 2.7 flightcontroller with Mavlink output
- FrSky D8R-XP receiver with D-port telemetry
- Taranis X9D Plus transmitter with OpenTX 2.2 firmware

I have ordered an Arduino Pro Mini (clone)

Am I right that I have to do the next things:
- get the files from Mikes github on the Arduino (does somebody has some info or weblink with explanation how to do this?)
- connect the Arduino to the APM and to the D8R-XP
- Do some settings in Mission Planner
- Configure the Taranis for these telemetry data. I have already made some working Lua scripts for displaying several data on the screen. I only have to link the APM/telemetry data in this script.

Can someone please help me with some hints? I have experience with RC planes, programming my transmitter and some basic programming scales.
I am new to Arduino boards and Mavlink.


EDIT: Okay, a bit of self study: Am I doing it right in this way:
- install Arduino IDE
- Download the files from Mikes Github
- Open the APM_Mavlink_to_FrSky.ino file in the Arduino IDE
- Verify/compile sketch
- I get this message:

Code: Select all


Sketch uses 13,446 bytes (41%) of program storage space. Maximum is 32,256 bytes.
Global variables use 673 bytes (32%) of dynamic memory, leaving 1,375 bytes for local variables. Maximum is 2,048 bytes.
So no errors?
- Now I do Upload to get the code to the Arduino board

Is this right?
Does it matter if I use the Arduino IDE 1.5.8 or the latest (1.8.4)?


If I have understood well, there are different versions of the Arduino Pro Mini (and his clones).
Does it matter which to take?
- 3.3V or 5V (I am planning in buying the 5V)
- with Atmega328 or Atmega328P
- with flash memory of 16 or 32kb
- with RAM of 1 or 2kb
User avatar
MikeB
9x Developer
Posts: 17979
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

5V mega328 32kB flash, 2k RAM.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
bnwgraaf
Posts: 18
Joined: Sun Sep 03, 2017 7:18 am
Country: -

Re: Adding MAVLINK support

Post by bnwgraaf »

Okay, I have received my 3 Dollar Arduino Pro Mini clone and succeeded to flash the firmware.

I have connected this with connection 5 and 6 to the ports of my FrSky D8R-XP receiver. I succeeded in addin new sensors: 18 new sensors.

I did not do any settings to my Taranis receiver or the APM (through mission planner). Some sensors are easy to recognise, but I see also some sensors with different names, which I cannot find...Also several sensors seems to stay on value zero.
Nova sensors.png
I have read several threads and posts, but maybe I have missed something....Can somebody help me how I get the right sensor names? Do I have to make some settings within mission planner?

My setup:
Quanum Nova Pro
APM 2.7 Flight Controller
FrSky D8R-XP receiver
FrSky Taranis X9D with OpenTX 2.2 software
Arduino Pro Mini clone with THIS firmware
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Adding MAVLINK support

Post by jhsa »

You might get better help if you post on a OpenTX forum.. This one is about Ersky9x. Even if Ersky9x also runs on the Taranis radio, the telemetry settings are completely different.

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
bnwgraaf
Posts: 18
Joined: Sun Sep 03, 2017 7:18 am
Country: -

Re: RE: Re: Adding MAVLINK support

Post by bnwgraaf »

jhsa wrote:You might get better help if you post on a OpenTX forum.. This one is about Ersky9x. Even if Ersky9x also runs on the Taranis radio, the telemetry settings are completely different.

João
Thank you for your reply, I didn't realize it. But I wonder if the problem lies in the Taranis or maybe in the flight controller or the Arduino....

Verstuurd vanaf mijn A0001 met Tapatalk

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

Re: Adding MAVLINK support

Post by MikeB »

Mavlink includes extra items that don't "map" to FrSky sensors, so these use IDs that are not used by FrSky sensors.
I assume that openTx doesn't know about these values. From ersky9x code, these are:
FR_VCC, // 0x07 Extra data for Mavlink via FrSky
FR_HOME_DIR, // 0x0A
FR_HOME_DIST, // 0x0B
FR_CPU_LOAD, // 0x0C
FR_GPS_HDOP, // 0x0D
FR_WP_NUM, // 0x0E
FR_WP_BEARING, // 0x0F
FR_BASEMODE, // 0x1D
FR_WP_DIST, // 0x1E
FR_HEALTH, // 0x1F
FR_MSG, // 0x20
FR_AIRSPEED // 0x38

The Temp1 value is the flight mode.
The Temp2 value is GPS fix data, Fix_type * 10 + number of sats
0 No GPS
1 No Fix
2 2D Fix
3 3D Fix

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
bnwgraaf
Posts: 18
Joined: Sun Sep 03, 2017 7:18 am
Country: -

Re: Adding MAVLINK support

Post by bnwgraaf »

Hello Mike,

Tnx for your reply.

So these "nameless" values like 000F, 001D and 001F are not usable within my configuration, or can these mapped in some way?
User avatar
MikeB
9x Developer
Posts: 17979
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

You should be able to edit the "name" in Companion, so, for example, change "000A" to "Home", then you should be able to display and log the value of "Home" like any other sensor.
With temp2, you may need to create a couple of calculated sensors to extract the two values.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
bnwgraaf
Posts: 18
Joined: Sun Sep 03, 2017 7:18 am
Country: -

Re: Adding MAVLINK support

Post by bnwgraaf »

Okay, that's clear to me!
I know how to rename the sensors and I know how to do some things with its values to get them displayed in the screen.
So now I have to find out which to use!
I will try and report here if I succeed!

Tnx again!
bnwgraaf
Posts: 18
Joined: Sun Sep 03, 2017 7:18 am
Country: -

Re: Adding MAVLINK support

Post by bnwgraaf »

Well, I have looked at the values, but most of them seems just random numbers.
See also picture below. The first 4 sensors are not from the APM, but from the receiver itself (it has an extra volrage sensor).

A few of them seems to work correctly or at least seems to read pretty good values and seems also to change when moving the quad around:
- Alt does give some hight and seems to change when lifting the quad
- Hdg seems to react wen rotating the quad. Sometimes the numbers are jumping a bit
- GPS coordinates seems accurate but incomplete
- Curr seems also to react on throttle
- VFas does ive some voltage, but changes again...

In general the numbers seem to fluctuate quit a lot.

Do I have correct things within the (OpenTX) software of the Taranis, or within the Arduino code?
Sensors.png
DSC_0279.JPG
DSC_0280.JPG
User avatar
MikeB
9x Developer
Posts: 17979
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

Possibly working OK. I just looked and temp1 is:
256 * type + flight mode
where type is Copter or Plane or whatever other type are possible, so 512 is type 2, flight mode 0.
The sensors with WP in the names I posted are WayPoint data.

Until temp2 has a value at least 20, then you don't have a GPS fix as I understand it.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Fardenco
Posts: 4
Joined: Fri Apr 13, 2018 10:56 am
Country: -

Re: Adding MAVLINK support

Post by Fardenco »

Hi,
first, I'd like to thank you for all the work you've done.

I'm trying to get telemetry on my 9x running er9x-pr22, from an APM.
In the past I used to use a DJT for this, I had an Arduino Pro Mini on my copter, doing the translation from MAVLink to FrSky, and it worked great.
But today, I'm not using FrSky transmitter anymore. I'm using Ultimate LRS, which acts as a transparent serial link. It's great, I'm now able to use Mission Planner through this radio link, and I want to keep this possibility (so I need to stick with the MAVLink protocol).
So I thought I would only have to put the MAVLink to FrSky translator between my radio transmitter and the 9x microcontroller instead of putting it between the APM and the RX.
I took the incoming MAVLink telemetry datas, passed them through the translator, and tied the output to the telemetry rx pin of the 9x (RF pin).
You can see what I did on this picture.
Image
Black is gnd, red is Vbat (comming to raw input of the pro mini), green is incoming datas (MAVLink), and yellow is the output of the translator (FrSky)

But it seems that er9x is not able to understand those telemetry data, because my telemetry screen shows 0 for all values.

I've looked with my oscilloscope to see if there was anything obvious between the data comming from my DJT and those coming from the translator, and indeed the signal is high at rest with the DJT and low at rest with the translator. The signal seems to be inverted.
I was thinking about building a simple signal inverter, but now I'm thinking, if it's not the good signal, then it's not meant to be used like this, and the protocol might be different.

Here is a full frame comming out of the translator :
Image

Here you can see more clearly the start of the frame :
Image

I'm using your translator : https://github.com/MikeBland/APM_Mavlink_to_FrSky

I've found this post
http://openrcforums.com/forum/viewtopic ... rs#p120497
where you say "Note that the FrSky 'D' telemetry does not pass the serial data completely transparantly. It packs the serial data into FrSky packets and needs to be 'unpacked' in the Tx." So as I understand, the data comming out of the translator is unpacked FrSky datas, and er9x is waiting for packed datas ?

Here http://openrcforums.com/forum/viewtopic ... rs#p120468
and here http://openrcforums.com/forum/viewtopic ... 72#p116336
you told about a MAVLink version of er9x, but I can't find it. And I also use FrSky telemetry for other planes, so having both would really be the best, I don't mind needing a translator th go from MAVLink to FrSky, as long as everything is working =)

I would really apreciate your thought about this.
Thank you
User avatar
MikeB
9x Developer
Posts: 17979
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

1. Does your 9X have a Mega128 processor or a Mega64 processor?

As you note, the serial data from the Arduino is inverted, but then, so is the serial data from the DJT.

2. So, how did you have the serial data from the DJT handled bu the radio? Did you include an inverter in the signal, or did you modify the DJT so that you did not need the inverter?

If you have a '128 processor, then there is an option in the Telemetry menu for the "Usr Proto" where you may select "HbRaw" (Hub Raw). This would handle the Arduino output (after inversion) directly. In theory, you could modify the Arduino code to output non-inverted serial data since that signal is generated in software.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Fardenco
Posts: 4
Joined: Fri Apr 13, 2018 10:56 am
Country: -

Re: Adding MAVLINK support

Post by Fardenco »

I have to say, I did a mod to my DJT module a while back, and I did not know what I was really doing, to the board, because the post I followed just said "cut here, put a wire and resistor here" etc.
But it seems that what I did did indeed lead to an inversion of the signal.
What I can tell you for sure is that right now, the signal going through the "rf" pin of my DJT module is inverted compared to the one you can see on the picture I sent you in my previous post.

I have an ATmega128 processor, but I can't find "HbRaw" in the protocols. I only have FrHub and WSHhi.
I might have the wrong firmware, I remember that I flashed it because I wanted the lastest multi protocol texts, so I used the test version er9xProv822a.
In the folder, there is a file named "er9x-128", and a file named "er9x-frsky". I remember using the latter, because I wanted FrSky telemetry and I did not find a file with "FrSky" and "128" in its name.
I have to say I'm not quite sure what the difference is between all those files, beside the language and the target processor.
If I flash er9x-128.hex, will I still have the telemetry ?
While I'm at it, maybe should I flash the lastest test version you released a few days ago ? (er9xProv822f)

Thank you for your quick answer.

PS : Is there a way I can support your work (Donation or anything else) ? I could not find any
User avatar
MikeB
9x Developer
Posts: 17979
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

Yes, flash "er9x-128.hex". You then need to go to the hardware menu and set "FrSky Mod Done" to enable the telemetry. With the extra flash space, features are selectable, rather than needing to flash a specific firmware version.
Enable the hardware menu by holding the left horizontal trim to the left as you power on.

Regarding the inverted state of the signal from the Arduino, you will find, in the file Aserial.h, the following line:
//#define NON_INVERTED_HUB_SERIAL 1
Simply remove the "//" to uncomment the line, then use the Arduino IDE to re-flash the Arduino and the signal should be correct!

You may check any post by "jhsa" and see a "donate" link at the bottom.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Adding MAVLINK support

Post by jhsa »

Under all my posts :)

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
Fardenco
Posts: 4
Joined: Fri Apr 13, 2018 10:56 am
Country: -

Re: Adding MAVLINK support

Post by Fardenco »

Now that I've the right firmware, I can now find the "HbRaw" protocol, and it works as expected after inverting the signal =)

I did see "ArduP" in the protocol choices, does it stands for "ArduPilot" ? If so, does it allow to receive MAVLink directly, without using the translator ?

Anyway, thank you for your help !
You both are GREAT.
User avatar
MikeB
9x Developer
Posts: 17979
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Adding MAVLINK support

Post by MikeB »

There is an er9x build that should support MAVLink directly (er9x-ardupilot.hex), but only MAVLink, not FrSky.
I've never really looked at that code, I just continue to build a release version.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Fardenco
Posts: 4
Joined: Fri Apr 13, 2018 10:56 am
Country: -

Re: Adding MAVLINK support

Post by Fardenco »

Ok so I'll stick with the first solution you provided (because I need FrSky). Thank you again.
User avatar
LTMNO
Posts: 1049
Joined: Fri Nov 30, 2012 9:31 pm
Country: Canada
Location: Toronto, Canada

Re: Adding MAVLINK support

Post by LTMNO »

Man its been a while since my last post.
I am still tinkering, literally... I have sold all my radios but I still manage to have 2 quads left of my 8.
That being said at one point I had 4-5 9x radios. With all the mods I have enough spare parts to build one... So i did.
Now, I was trying to figure out the path of least resistance... that was just the standard Telemetry Mod.

Image

With that I was able to get data to show up on my radio.
I have managed to utilize URLS Tx/Rx - Passthrough Mode, along with OpenTx and Er9x in ArduPilot Flavours.
The key was to make sure you have your Telemetry Mod complete and the BAUD rate set properly. I am running my Telemetry at 19200. It works really well and super fast... no need for more. That is pretty simple to setup on the APM and OpenTx/Er9x.

The cool thing too is that you can directly connect your APM Telem Port to your Radio on Pin 2(Rx)/Pin 3(Tx) and watch the data stream come in. Then you know your solution is working even before you try to send it over the Air. ;-)

Hope that helps, if you need pictures... happy to post them.
Custom 9x with M64/Telemetry Mod
samys13
Posts: 58
Joined: Mon Feb 29, 2016 5:55 pm
Country: -

Re: Adding MAVLINK support

Post by samys13 »

Hi Mike maybe you can help me. i'm trying to have mavlink telemetry on my 9xrpro. I use a arduino pro mini to convert mavlink to frsky between my apm and orangerx uhf RX. My problem is that when I connect ppm and gnd wires to apm, telemetry disappear on my handset, and if I unplug only gnd, it reappear and have no ppm signal on apm. I don't know how to make it work together. Here is my wiring:

Handset: 9xr pro with last ersky9x firmware, ArduP user proto on com1 reversed, auto baudrate.

TX module: Orangerx uhf 1w with last openlrsng firmware, set to frsky telemetry with 9600 baudrate.

RX module: Orangerx 100mw with same firmware. Vcc from lypo 2s. PPM from port 6 to apm port 1, gnd to apm gnd.

Apm 2.8: serial1 set to 9600 with mavlink proto. Port 2 and 3 together to set ppm input.
Tx to pro mini Rx
Rx to pro mini Tx
5v to vcc pro mini
Gnd to gnd pro mini

D5 and D6 from pro mini to Tx and Rx orangerx receiver.

With this wiring I can't see telemetry on my handset but apm is receiving ppm signal. If I only unplug gnd between receiver and apm, telemetry works on my handset but apm can't receive ppm signal.

Envoyé de mon SM-A320FL en utilisant Tapatalk


Post Reply

Return to “erskyTx (was ersky9x)”