Thread Tools
May 13, 2015, 09:14 PM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Thread OP
Discussion

Software Library For Spektrum Telemetry


This thread will be where I'm going to track the development of a Java library for reading Spektrum TLM data.

GitHub repository: https://github.com/mikejr83/TLMReaderLib

Current status: Scaffolding and working on basic architecture. Latest commit seems to be getting the altitude correctly...

----------------------------------------
A brief history:
----------------------------------------

After reading a couple of threads :

https://www.rcgroups.com/forums/show....php?t=1726960
and
https://www.rcgroups.com/forums/show....php?t=1725173

and trying to find some sort of way to read telemetry while at the field without an iPhone or iPad I've decided to tackle creating a Java library to decode the Spektrum TLM files which are stored by some of Spektrum's radios.

I'm aware that there are several Windows applications out there, but I want to create a FOSS library which can be tested by any party to validate that the telemetry they're seeing in any application is correct and true as possible. I also want the "how-to" crowd to be able to build off the library to make cool applications that show interesting stuff with the data.

At the moment I've started the basic building blocks of the library. I'm trying to compile all the information that I've found from various forums and discussions into a set of complete information about the binary layout of the files. The library takes some telemetry recorded during one of my contests and runs it through to get some output.

I'm sure some of you have seen my posts in other discussions regarding this topic. Please know I'm not trying to spam the forum. Instead of posting in several topics I plan on updating here on my progress.

This is a call to all other software engineers, developers, or tinkerers, if you're interested in helping please don't hesitate to ask a question or provide some input. This library and the resulting (hopefully) Android application are for the community. Any help and input will make this project better for all end users.

Thanks!

Mike G.
Last edited by mikejr83; May 13, 2015 at 09:30 PM.
Sign up now
to remove ads between posts
May 13, 2015, 09:14 PM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Thread OP
UPDATES:

09/06/2015:
Be on the look out for an update this evening with a fix to the UI thread crashing! Read my last post for full info!

05/06/2015:
Released an alpha build of the app that doesn't completely suck! Read about it on my blog.

01/06/2015:
Updated the formatting document: https://github.com/mikejr83/TLMReade.../byteFormat.md

31/05/2015 - PM:
Doing testing of my own I have found an issue with moderate sized files. The data set the ui works with is too big and crashes the app. Working on a solution.

31/05/2015:
Ready for Play Store listing! I have Altitude, Current, PowerBox, RX, and standard telemetry sensors being displayed. I need some graphic arts help to get the play store listing ready. Contact me if you care to help!

20/05/2015:
Pre-alpha build released! See This Post!

18/05/2015:
GitHub repositories
* Library - https://github.com/mikejr83/TLMReaderLib
* Android App - https://github.com/mikejr83/TelemetryReaderForAndroid
Last edited by mikejr83; Jun 09, 2015 at 09:18 AM.
May 13, 2015, 09:15 PM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Thread OP
One more reserved post.
May 13, 2015, 09:22 PM
AndyKunz's Avatar
Java, huh?!?! You're ambitious, and will probably have fun playing around with this. Bitmasks and bytes, signed and unsigned, little-endian and big-endian mixed together, as well as BCD and binary!

Hoo boy, Java is one language I wouldn't choose for it!

Lisp is another.

Andy
May 13, 2015, 09:29 PM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Thread OP
Not my first choice, but I want to have a library consumable in Android so... I've only worked on a couple of Android apps and this just seemed like the logical route to travel.

I'm a dot Net dev by trade so a lot of this is going to be using stuff that I haven't had to do since college. Luckily I have a good amount of time under my belt building middle tier security so messing with bits isn't a totally lost art to me.
May 14, 2015, 01:57 PM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Thread OP
UPDATE:

I've started working on condensing and cleaning up the data that has been posted in previous threads. It's nice to have it in an easier to read format! https://github.com/mikejr83/TLMReade.../byteFormat.md

I've also posted some unit test cases. It seems like I can reliably parse altitude data. I'm still working on what exactly is the format for the timestamp. My bit twiddling there seems to be producing weird results...
May 15, 2015, 08:01 AM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Thread OP

Hybrid App Scaffolding Created!


UPDATES:

Lots of stuff today!

I think I figured out the timestamp issue I was having. Using the last block for each "flight" I can multiply it by 10 to get the milliseconds which then I can use. The values I get seem to jive well with what I'm seeing in the TelemetryReader app. The flight time may be in the header data but I don't fully understand what is included in those blocks.

I've also moved from using Apache commons-io to Google's guava libraries. I remember there being an issue with commons when moving to Android development.

Using the combinations of the DIY thread for creating sensor data and the other which attempts to decode it I think I have successfully written decoders for all data blocks except one type. I left GPS last because it seems like most of the discussions in the thread were around how to decode (or encode) these values. I haven't fully read through those conversations so I decided that I can table those for the time being.

Now to the exciting part! I've created a repository and the initial commits for the Android application.
Repository: https://github.com/mikejr83/TelemetryReaderForAndroid

The need for me to visually see what my library is spitting out is now apparent. I thought about dumping to a CSV and then charting it, but since the end goal is for an Android app I decided to go ahead and get the repository setup.

I've decided to tackle this with a hybrid app using the Ionic Framework. I've used this before at work for rapid building of an application. My thoughts for the app are simple. I just want to see graphs so using the D3 library to draw some graphs on a page should be very simple. Plus, any web dev should be able to pick up development fairly easily!

The short term goal is to get the cordova plugin using the exported JAR file from the library to decode a file on the device. From there I want to display a simple graph of altitude data over time.

Weekend is here and I have to watch the kids so that means little to no flying but a bunch of time to sit at the laptop and code!
May 15, 2015, 11:38 AM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Thread OP
Just ran a quick "real world" test on the library. The attached screenshot is of a spreadsheet that I made in Excel from a CSV file that was output with a console app using the library.
May 18, 2015, 07:49 AM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Thread OP
UPDATE:

I think I'm almost happy with the library to release it as a beta build. Obviously you can still head over to the GitHub link, pull, and compile yourself, but I haven't tagged it as a release because I still haven't implemented GPS decoding. Once I have the basics of that sensor decoding I'll tag an beta release!

Android App:

Big news here. I've created a PhoneGap/Cordova/Ionic plugin that should trigger the UI to ask the user to pick a file. The file is then read and decoded using the library. Once the library has given back the objects I then have them run through a set of logic to output a JSON object!

I've verified that the JSON output looks nice. I may have to work on some async processing because this data for 8 6-8 minute flights produces over 7MB of JSON data. Working through the dataset by the library is fairly quick, but the actual conversion of the data to JSON produces a bit of overhead. Still working on some ideas here.
May 19, 2015, 08:56 AM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Thread OP
UPDATE:

Another good bit of code added. Those familiar with PhoneGap/Cordova will understand this. The web view app portion is now able to call via JavaScript the decoder plugin which asks the user for a file and then uses the library to decode it! The JSON is sent back to the web app.

Next up filtering the output on the client and drawing graphs!

Oh, I updated the README over on the github site for the app to have a feature list and timeline.

Feels like I'm talking to the ether here
May 19, 2015, 11:05 AM
AndyKunz's Avatar
I have nothing to add, but I have been following along the whole time.

Andy
May 19, 2015, 01:57 PM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Thread OP
UPDATE:

Attached is a screenshot of an altitude chart rendered in app! Very basic right now, but the app allows the user to select a file and then see the altitude plot for the first flight.
May 19, 2015, 01:58 PM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Thread OP
Quote:
Originally Posted by AndyKunz View Post
I have nothing to add, but I have been following along the whole time.

Andy
Thanks Andy! It just felt like I was talking to myself there for a bit.
May 19, 2015, 02:11 PM
Surface, Air & Water Rc Toys..
It might if looked that way with 11 posts you and 2 Andy (prior to me posting) up but your thread had over 160 views....
May 19, 2015, 02:54 PM
Scale Aircraft = Scale Crators
mikejr83's Avatar
Thread OP
Quote:
Originally Posted by freechip View Post
It might if looked that way with 11 posts you and 2 Andy (prior to me posting) up but your thread had over 160 views....
I normally post my Android dev efforts over at XDA. The community responds to the conversation there a bit different. I wasn't sure if it was just that I was just talking to the clouds or if people were actually interested!

It's a bit like mixing your college drinking buddies with the co-workers you hang out with after work, can be a bit off until everyone gets the lingo.

I also checked the traffic on the GitHub site and saw that I really only had a few hits and I didn't know how many were from me.


Quick Reply
Message:

Thread Tools