Data model that stores the current and past telemetry states of the aircraft. Inherits off of the node EventEmitter, so it can emit data events to other modules
- Copyright:
-
- Waterloo Aerial Robotics Group 2016
- Source:
- See:
Extends
- EventEmitter
Requires
- module:util
- module:events
- module:config/advanced-config
Members
-
<inner> current_state :Hash
-
Current flight state. In the format of a hash, where the keys are the packet names, and the value is an array of header=>value data
Type:
- Hash
- Source:
- See:
-
- models/PacketTypes
Example
console.log(TelemetryData.current_state) { aircraft_position: { lat: 45.45455, lon: 324234, time: 234324324, ... }, aircraft_orientation: { ... } } -
<inner> headers :Array
-
An array of headers in the order that the groundstation will be receiving them, as specified from the data relay
Type:
- Array
- Source:
Example
console.log(TelemetryData.headers) ['lat', 'lon', 'time', ...]
Methods
-
<inner> emitPackets(packets)
-
Takes in a packet object and emits each one with its own payload. Packet object should be in the same format as the PacketTypes model, only the value being the value of the actual header.
Parameters:
Name Type Description packetsObject A key value pair of the packet name and its data payload
- Source:
Example
Usage example
var packets = { packet_name: { packet_data1: 'packet_value1', packet_data2: 'packet_value2' } packet_name2: { ... } } //this will emit a 'packet_name' and 'packet_name2' events each with their respective data TelemetryData.emitPackets(packets); -
<inner> setHeadersFromString(headers_string)
-
Converts a springfield version of headers (separated by commas) into an array and sets it as its headers. Will also perform a trim() on each of the header values.
Parameters:
Name Type Description headers_stringString - Source:
Example
TelemetryData.setHeadersFromString('header1,header2, header3, header4'); console.log(TelemetryData.headers); //Outputs: ['header1', 'header2', 'header3', 'header4']
Events
-
TelemetryData:aircraft_channels
-
When a new data packet has been received on the data relay connection
- Source:
Properties:
Name Type Description dataObject Information about the channel inputs and outputs of the picpilot
-
TelemetryData:aircraft_gains
-
When a new data packet has been received on the data relay connection
- Source:
Properties:
Name Type Description dataObject Current aircraft gains information
-
TelemetryData:aircraft_orientation
-
When a new data packet has been received on the data relay connection
- Source:
Properties:
Name Type Description dataObject Information on the orientation of the aircraft
-
TelemetryData:aircraft_position
-
When a new data packet has been received on the data relay connection
- Source:
Properties:
Name Type Description dataObject Information on the position of the aircraft
-
TelemetryData:aircraft_status
-
When a new data packet has been received on the data relay connection
- Source:
Properties:
Name Type Description dataObject Current aircraft status information