Modifications

Sauter à la navigation Sauter à la recherche
Ligne 157 : Ligne 157 :     
{{ambox|text=The '''ACK'''nowledgement feature is disabled to avoids unnecessary latency when waiting back for ACK response (which may never comes back in the case of a CanSat in high altitude). }}
 
{{ambox|text=The '''ACK'''nowledgement feature is disabled to avoids unnecessary latency when waiting back for ACK response (which may never comes back in the case of a CanSat in high altitude). }}
 +
 +
== Structuring the data ==
 +
The radio module only sends buffer of binary data to the receiver. This is a bit rough but efficient.
 +
 +
So to transport the data to the receiver, we need to transform the values (float, integer) into their string representation.
 +
 +
When having multiple data in their string representation is not enough, they must also been organized.
 +
 +
'''The final format must be easy to parse and very compact''' (smaller is the radio message and higher is the chance for him to get to the ground without error).
 +
 +
We propose the following format:
 +
<nowiki>:data1|data2|data3|data4;/r/n</nowiki>
 +
 +
where:
 +
* ''':''' is the begin of data stream
 +
* ''';''' is the end of data stream
 +
* '''/r/n''' are optional carriage return + line feed characters.<br />This will would make the messages user friendly when the the messages are viewed in a console or terminal.
 +
* '''|''' is the separator between data items.
 +
* '''datax''' are the string representation of the various data. The characters ;:| are forbidden in this area.
 +
 +
we would also recommend to use:
 +
* '''packetnum''' as data1. packetnum is a simple variable increment of one unit after each transmission. This would allow the receiver to detect lost message (since it would exist holes in the numbering of received messages).
 +
* '''timing_info''' as data2. This would help to create timing chart or time base data analysis. We suggest to use the Arduino's {{fname|millis()}} function which count the number of milliseconds since the last microcontroler reset.
 +
 +
As explained later in the code the {{fname|packet_str}} variable contains the message to be transmitted to the ground. The Arduino's {{fname|String}} class would ease the transformation of data to their string representation.
 +
<syntaxhighlight lang="c">
 +
String packet_str = String( ":"+String(packetnum,DEC)+"|" );
 +
packet_str.concat( String( ms,DEC)+"|" );
 +
packet_str.concat( String( temperature, 2 )+"|" );
 +
packet_str.concat( String( bme_hpa, 2 )+"|" );
 +
packet_str.concat( String( bme_temp, 2 )+";\r\n" );
 +
</syntaxhighlight>
    
{{ENG-CANSAT-PICO-TRAILER}}
 
{{ENG-CANSAT-PICO-TRAILER}}
29 917

modifications

Menu de navigation