ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
10.73k stars 17.18k forks source link

Support for native FrSky telemetry #1587

Closed lakeroe closed 7 years ago

lakeroe commented 9 years ago

Add support for native FrSky telemetry (S.Port based X-Series receiver) using only a simple external inverter (i.e. https://github.com/TauLabs/TauLabs/wiki/User-Guide:-FrSKY-S.PORT-telemetry). Somebody has already started a thread about this: http://ardupilot.com/forum/viewtopic.php?f=100&t=10013

Apart from "real" telemetry data (position, height, velocity, ...) it would be great to also show possible pre-arm check errors.

Two useful links: https://code.google.com/p/telemetry-convert/wiki/FrSkySPortProtocol https://github.com/TauLabs/TauLabs/blob/next/flight/Modules/UAVOFrSKYSPortBridge/UAVOFrSKYSPortBridge.c

epquilloy commented 9 years ago

I see, I thought both sides are connected to each other. I will move the diode to one side of the board only. :) thanks again!

erkki commented 9 years ago

I originally thought as well :)

epquilloy commented 9 years ago

still no luck on making it work..

erkki commented 9 years ago

Can you post a new photo? Do you have a multimeter or a scope to test the voltages/signals?

rmackay9 commented 9 years ago

@epquilloy, very nice. you should sell those ..

epquilloy commented 9 years ago

img_5174

here's the latest modification. All connections on one side of the board. By the way, I am connecting this directly to telem 2 port. I suppose this is powered by 5V from pixhawk. I set on Mission Planner Serial 2 protocol to 4. Is this correct? how about the baudrate for this? When I power up the pixhawk, then the taranis, i cannot see the telemetry data on the telemetry page (long press PAGE button). I already added the parameters to be shown on this page on the taranis' settings.

badzz commented 9 years ago

Connections looks ok Mime :https://plus.google.com/+MatthiasBadaire/posts/UaC1wmB11mg?pid=6144577061037466114&oid=111345306876503099445

You do not need to change the baud rate, it will be forced when sport code initiailize Indeed , SERIAL2_PROTOCOL should be 4 for X-Receiver with copter 3.3 which RX from frsky are you using ?

On Mon, Jun 29, 2015 at 1:08 PM, epquilloy notifications@github.com wrote:

[image: img_5174] https://cloud.githubusercontent.com/assets/12706729/8406732/c16307d8-1e91-11e5-8f78-922f82b02381.JPG

here's the latest modification. By the way, I am connecting this directly to telem 2 port. I suppose this is powered by 5V from pixhawk. I set on Mission Planner Serial 2 protocol to 4. Is this correct? how about the baudrate for this? When I power up the pixhawk, then the taranis, i cannot see the telemetry data on the telemetry page (long press PAGE button). I already added the parameters to be shown on this page on the taranis' settings.

— Reply to this email directly or view it on GitHub https://github.com/diydrones/ardupilot/issues/1587#issuecomment-116611182 .

epquilloy commented 9 years ago

I am using X8R receiver. I connected the module to the SPort of the x8r, but I cannot make it work.. Maybe the problem lies with the taranis settings?

epquilloy commented 9 years ago

Is there a guide for setting up the taranis for the native telemetry support for frsky?

badzz commented 9 years ago

I do not see what could be wrong on the taranis side. You have nothing on T1 or T2 on the telemetry screen while changing flight mode ? Do you receive the rssi info at least (this is not related to the pixhawk) ? Can you take a picture of the cable plugged, in case of... On 29 Jun 2015 16:12, "epquilloy" notifications@github.com wrote:

I am using X8R receiver. I connected the module to the SPort of the x8r, but I cannot make it work.. Maybe the problem lies with the taranis settings?

— Reply to this email directly or view it on GitHub https://github.com/diydrones/ardupilot/issues/1587#issuecomment-116686721 .

badzz commented 9 years ago

http://copter.ardupilot.com/wiki/common-optional-hardware/common-telemetry-landingpage/common-frsky-telemetry/ On 29 Jun 2015 16:18, "epquilloy" notifications@github.com wrote:

Is there a guide for setting up the taranis for the native telemetry support for frsky?

— Reply to this email directly or view it on GitHub https://github.com/diydrones/ardupilot/issues/1587#issuecomment-116692763 .

epquilloy commented 9 years ago

Thanks for the guide :)

epquilloy commented 9 years ago

image

Here's how I wire it up.

epquilloy commented 9 years ago

image

It seems that the telemetry is somehow working. When I switch flight modes, the T1 value changes. Other parameters seem to be not working? Or am I doing anything wrong? The cells are not shown too.

badzz commented 9 years ago

whoa . that looks ok to me. Cells,cell, AccZ is not implemented, see the doc for what is present. Try the other values from the documentation, it should work.

On Mon, Jun 29, 2015 at 4:59 PM, epquilloy notifications@github.com wrote:

[image: image] https://cloud.githubusercontent.com/assets/12706729/8410611/f4081c6c-1eb1-11e5-8e3b-9d387ec6f884.jpg

It seems that the telemetry is somehow working. When I switch flight modes, the T1 value changes. Other parameters seem to be not working? Or am I doing anything wrong? The cells are not shown too.

— Reply to this email directly or view it on GitHub https://github.com/diydrones/ardupilot/issues/1587#issuecomment-116718942 .

furynick commented 9 years ago

You need to have a GPS Fix to get other values

epquilloy commented 9 years ago

I see, thanks everyone :) I got it working now.

One thing I noticed, the fuel is zero?

badzz commented 9 years ago

Did you connect a flight battery or just via usb ? Connect to MissionPlanner and check what percentage it tells you there. The value is calculated by the APM code. There might be a bug there.

On Mon, Jun 29, 2015 at 5:15 PM, epquilloy notifications@github.com wrote:

I see, thanks everyone :) I got it working now.

One thing I noticed, the fuel is zero?

— Reply to this email directly or view it on GitHub https://github.com/diydrones/ardupilot/issues/1587#issuecomment-116727397 .

epquilloy commented 9 years ago

image

You're right, it seems that the calibration for current was lost when I updated to the latest 3.3rc7.. :) oh well, at least i see this working now. Thanks my friends!

furynick commented 9 years ago

I guess it's vfas not fuel (there's no fuel sensor for ardupilot)

epquilloy commented 9 years ago

Current is also zero :) caused by the lost calibration for current, I will do the recalibration ASAP :)

badzz commented 9 years ago

Vfas shows volts Fuel should show a percentage of the remaining amps in a battery based on consumption (same as in mp) On 29 Jun 2015 17:30, "furynick" notifications@github.com wrote:

I guess it's vfas not fuel (there's no fuel sensor for ardupilot)

— Reply to this email directly or view it on GitHub https://github.com/diydrones/ardupilot/issues/1587#issuecomment-116732419 .

furynick commented 9 years ago

Thanks Mathias, I missed that :)

Johnex commented 9 years ago

Glad you got it working @epquilloy :).

epquilloy commented 9 years ago

Yeah :) not without help from you all. Thanks again!

epquilloy commented 9 years ago

hopefully we can develop scripts for this too. this is very promising as the teensy approach.

Johnex commented 9 years ago

Yes as soon as 3.3 final comes out i plan to modify Chris' lua script (its the one i use always) so it works with the native values, shouldn't be too hard. Unfortunately i think all the arming warnings will be gone which are nice to have that Chris has working with the teensy.

ptsneves commented 9 years ago

Hey It seems you have got quite a head start but at Airborne Projects we have developed a APM MavLink to FrSky SmartPort Converter that can takes the MAVLink messages and converts it to FrSkySmartPort format and can directly be connected to the Taranis Radio.

We include all the cables necessary - UART or USB Serial possible for the Navio - and it features a hardware modified version of the Arduino Nano so it can be powered directly from the Taranis receiver, from 5-10V (actually theoretically you can go to 20V but that voltage is not standard in RCs).

You only have to load the Taranis telemetry modules and configure in mission planner. No soldering required. We have produced a manual that we would enjoy feedback on.

As said, it is based on the Arduino Nano and the software is open sourced GPL on GitHub based on the work of ScotFlys' code.

It could also do the exact same thing a Serial to SmartPort does in the X configuration with no soldering or additional wiring involved if there is interest in it.

Product picture

In sum our additional feaures are:

We apreciate your feedback Paulo Neves Airborne Projects

rmackay9 commented 9 years ago

@ptsneves, nicely done, looks good. I think we should at least mention the product on the ardupilot FrSky telemetry wiki page as an alternative for people.

mr-sneezy commented 8 years ago

Just made the two transistor interface and fitted to an X4R, and it works well.

Where could I find links to copter LUA scripts for the Taranis (a Plus with FW 2.1) ? I can't seem to find a link to the OP's LUA here...

aldoir commented 8 years ago

I modified this script http://rcsettings.com/index.php/viewdownload/13-lua-scripts/205-iris-telemetry-script to be compatible with 2.1, plus I've added some graphics to show battery and RSSI

Discover your sensors then rename the Temp sensors to T1 (Sats and Fix) and T2 (Flight Mode), I didn't find a way to access them by name without renaming. On 2.1 there is no safe way to access getValue() by ID, you have to use their names.

https://drive.google.com/file/d/0B6QwWe5rj4cJTTBYdGRXcmY2cEU/view?usp=sharing

epquilloy commented 8 years ago

Hi aldoir

is there a correct way to execute your script? I am having a problem loading it. I already copied the telemetry script into folder for my model, but my taranis x9d plus fails to load it..

ptsneves commented 8 years ago

@aldoir I Airborne Projects produced a patch that will correctly disambiguate the temp sensors to tmp1 and tmp2. It is already merged and will be available in the next opentx release. At Airborne Projects to avoid that renaming we simply provided a firmware update to use another sensor and this way be already compatible with 2.1.3.

By the way our converters and scripts are now compatible with 2.1.3 and master branch and have a manual to help user migrate to the new version.

On Sunday, October 25, 2015, epquilloy notifications@github.com wrote:

Hi aldoir

is there a correct way to execute your script? I am having a problem loading it. I already copied the telemetry script into folder for my model, but my taranis x9d plus fails to load it..

— Reply to this email directly or view it on GitHub https://github.com/diydrones/ardupilot/issues/1587#issuecomment-150913300 .

aldoir commented 8 years ago

@epquilloy,

You have to explicitly tell OpenTX which script you want to use for each screen, there is no naming convention anymore. Open you model's telemetry page and set the screen 1 type = script, then choose the script you saved.

@ptsneves,

That's nice, I'll watch and update the script.

Do you know if is there any movement to make additional variables available? I'd like to see the FUEL variable, as I did a lot of calculations trying to guess the remaining battery percentage with no luck.

PreArm error codes would be nice as well.

ptsneves commented 8 years ago

@aldoir Our script has supports uses the battery remaining value from Ardupilot, but the getValue("fuel") exists in 2.1.3 with no changes. Hope it helps.

For now with don't have PreArm codes active but we have status text displayed

aldoir commented 8 years ago

@ptsneves. Do you know if is there any configuration required on ardupilot to make it sending the fuel variable? The sensor never appears on OpenTX's "Discover new sensors". Your script/converter is amazing, but for my needs the standard RS232/TTL adapter is enough

epquilloy commented 8 years ago

@aldoir

I have already tried setting the script, but it says no scripts on sd. But I have already placed the script under the model which I created

epquilloy commented 8 years ago

I have a teensy 2.0 setup before, it has A very comprehensive telemetry data. Even pre arm Checks were voiced out, as well as all errors. Even the flight modes were spoken out, Apparently, on opentx2.1 and AC3.3, they scrapped the support for teensy2.0. I am ordering a teensy 3.1 now ;)

At the moment, the simple rs232-ttl is also enough for me while I wait for the teensy 3.1

aldoir commented 8 years ago

@epquilloy Telemetry scripts aren't located inside the model folder anymore. See the item 7 on this post: http://openrcforums.com/forum/viewtopic.php?f=45&t=7239

ptsneves commented 8 years ago

@aldoir I do not know how the FrSky telemetry is sent on the Ardupilot. I imagine that not all sensors are sent due to the way the SmartPort works (slow update). Maybe somebody could weigh in. We can also produce a quotation for that feature, open source of course. Just that feature it should not be anything outrageous.

aldoir commented 8 years ago

@ptsneves According to the wiki this informationn should already be sent http://copter.ardupilot.com/wiki/common-frsky-telemetry/#protocol_information, but it does not work.

ptsneves commented 8 years ago

@aldoir I checked the code and it seems the code in Ardupilot still uses the old FrSky IDs. To be honest I don't even know how this works. In my code the fuel sensor is discovered by ID 0x0600 not 0x04. Notice that the ID is 16bit not 8bit even

floaledm commented 8 years ago

@ptsneves With the new FrSky IDs, the "first" FUEL sensor is on ID 0x0600 ("last" is 0x060f), whereas, as you already know, the old FrSky ID for FUEL is 0x04. This allows sensors of the same type to be connected on the same bus, yet have different IDs that OpenTX will be able to differentiate.

epquilloy commented 8 years ago

@aldoir

the script now works, but not everything. the VFAS, RSSI, altitude, current, heading are updating. but the Sats and other numbers on the script does not update. I am using the telem1.lua from the link that you gave.

update:

i think I know the problem, i have renamed the sensors which may have affected the scripting, though this is just a theory, I will try to delete all sensors later and set this up again :)

aldoir commented 8 years ago

Yes, you must rename Temp sensors to T1 and T2 (see my original post). If you rename others, you must change the name on the script as well.

epquilloy commented 8 years ago

@aldoir got it working now, except for the timer. :) what do i need to do to fix the timer? thanks again

aldoir commented 8 years ago

@epquilloy It's only displaying the Timer 2. You must set up your radio to start/stop/reset this timer

furynick commented 8 years ago

Still trying and unable to get it work. Using v3.3.1 on AUAV-X2 serial 2 (USART 3) with SERIAL2_PROTOCOL=4 connected to X4R S-Port. No more success with a FUL-1 nor with an X8R. Using this converter : cam00012

epquilloy commented 8 years ago

@aldoir

got the timer working :) thanks again! almost as good as my previous teensy setup. only warning prompts are missing :)

epquilloy commented 8 years ago

hi! i noticed, when I try the logging function, what is saved on the memory card on my taranis is not the important info such as altitude, gps coordinates, etc. but only the states of switches and sticks rather.. Is this normal? or is there any work around to let my taranis record all necessary data?