sponaugle wrote:
(1) Since I just need a stream of the captured data from the RaceCapture, it seems like the Telemetry port is the best option. Correct?
(2) The Telemetry port is just a TTL serial port at 115/N/8/1?
I did some investigation last night, so I'll go ahead and answer my own questions!
Yes, 115/N/8/1 on the Telemetry port. RS232 voltage (+/- about 6.5 volts).
sponaugle wrote:
(3) The data sent over the Telemetry port is a JSON structure, and has all of analog, frequency, and GPS values?
Yep. An interesting JSON structure. Every 100 message lines there is a 'data element manifest' that tells you the field names/units/rate.
A few interesting things to note for others looking to read this data:
Here is a sample of the 'data element manifest':
Code: Select all
{"s":{"t":0,"meta":[
{"nm":"Analog1","ut":"Units","sr":10},
{"nm":"Analog2","ut":"Units","sr":10},
{"nm":"Analog3","ut":"Units","sr":10},
{"nm":"Analog4","ut":"Units","sr":10},
{"nm":"Analog5","ut":"Units","sr":10},
{"nm":"Analog6","ut":"Units","sr":10},
{"nm":"Analog7","ut":"Units","sr":10},
{"nm":"Battery","ut":"Volts","sr":10},
{"nm":"GPIO1","ut":"","sr":1},
{"nm":"GPIO2","ut":"","sr":1},
{"nm":"GPIO3","ut":"","sr":1},
{"nm":"AccelX","ut":"G","sr":30},
{"nm":"AccelY","ut":"G","sr":30},
{"nm":"AccelZ","ut":"G","sr":30},
{"nm":"Yaw","ut":"Deg_Sec","sr":30},
{"nm":"Latitude","ut":"Deg","sr":10},
{"nm":"Longitude","ut":"Deg","sr":10},
{"nm":"Speed","ut":"MPH","sr":10},
{"nm":"Time","ut":"Time","sr":10},
{"nm":"LapCount","ut":"","sr":1},
{"nm":"LapTime","ut":"seconds","sr":1},
{"nm":"SplitTime","ut":"seconds","sr":1},
{"nm":"Distance","ut":"miles","sr":10}]
*NOTE* I added CRLFs to make it easier to read. You can see that each field the listed with a name, unit, and sample rate attribute. It is important to note the order. In this case Analog1 is data element #0, and Distance is data element #23. Since each data element can have different sample rates, a bit mask is used to tell which what data elements are in a particular output sample.
For example in with the stream used above you might see:
Code: Select all
{"s":{"t":2,"d":[-0.060,0.110,0.979,-2.345,30720]}}
The last element in the list is the bitmask telling you what fields were just transmitted. In this case the decimal number 30720, which in binary is 01111000 00000000. That tells you (starting right side bit 0 to represent data element #0) that this line has data elements #11,12,13,14 which happens to be
Code: Select all
{"nm":"AccelX","ut":"G","sr":30},
{"nm":"AccelY","ut":"G","sr":30},
{"nm":"AccelZ","ut":"G","sr":30},
{"nm":"Yaw","ut":"Deg_Sec","sr":30},
.
As you would expect those elements are sampling at a faster rate so they are transmitted more then the 10Hz lines.
For each line transmitted there is a mask. If everything on the device is set to the same sample rate, every transmitted line would be the same and include all fields.
There are a few quirks however:
(1) Even if you disable GPS and select only a SINGLE analog channel, "Distance" is always listed in the field manifest.
Code: Select all
{"nm":"Analog1","ut":"Units","sr":1},{"nm":"Distance","ut":"miles","sr":10}]
In this case the Distance is listed in the manifest, but it is never really transmitted since the GPS was disabled.
(2) If you have GPS enabled, the "Distance" value is always transmitted and it set to 10Hz. That setting can't be changed from the configuration app (although it is configurable in the API to the RCP). You could rebuild the firmware and change the default (#define DEFAULT_DISTANCE_CONFIG {"Distance", "miles", SAMPLE_10Hz})
This also means that if you have everything set to 1Hz but have GPS enabled, you will get all of your sensor readings in 1Hz increments but still get "Distance" readings at 10Hz.
(3) Data rates are interesting. If you put just the Accel X and Y at 10hz, you get almost exactly 10hz. If you put both at 20Hz, you get about 15hz output. If you do 30, you get close to 20. If you do 50, you get around 40. In looking at the code the telemetry logging is set based on the highest sample rate of a channel. I suspect if the channels are at 50hz and the telemetry at 50hz, there is some overlap in time where a sample isn't available or the serial port is busy, so you get a data rate a bit under that. At 100hz capture the telemetry is still limited to 50hz. I assume (but have not looked at the code to confirm) that if you set the analog capture sample rate to 50hz, you still get 50hz capture to the local log file (SD card).
(4) One unusual bug... if you set the sample rate to 100hz, it is reported as 50hz over the telemetry manifest. I have not tested to see if it is really doing 100hz to the SD card or not.
sponaugle wrote:
(4) Is there any configuration on the Race Capture I need to do to enable the telemetry output, and to select what channels to output?
It appears if you enable a channel, it is added to the telemetry output. One note, with the 'Telemetry Mode' set to 'Bluetooth adapter' on startup the RCP first sends out an 'AT' Command over the telemetry port to look for the cellular modem. After a total delay of about 20 seconds, it switched to regular telemetry output.
More to come.
Jeff