Validating Device Output
In order to validate that your device is outputting data in the expected format for Simple Streaming, we have written a validation script to verify that the connection string being sent matches a configuration available in your SSF file.
The script is a simple Python script that is used to ensure the device is sending out a proper configuration and can listen for the connect/disconnect strings.
Prerequisites for Python Script
The script requires Python 3.6 or higher, and requires pyserial
and colorama
to run:
pip install pyserial colorama
Running the Script
Download the script here: simple-stream-validator.py
To run the script, it’s a simple command:
python simple_stream_validator.py -f <SSF_FILE> -p <COM_PORT>
# Replace <SSF_FILE> with the path to the SSF file used for Data Studio import
# Replace <COM_PORT> with the COM/serial port of your device (e.g. COM27 on Windows, /dev/ttyACM0 on Linux).
Sample Output
Running the script will give you a similar output if all checks pass:
INFO - {'baud_rate': 115200, 'max_live_sample_rate': 611, 'available_sensors': ['Accelerometer', 'Gyroscope'], 'acceptable_sample_rates': [1600, 800, 400, 200, 100, 50, 25, 16000, 8000, 4000, 1000, 1000, 500, 200, 100, 50, 25, 12]}
INFO - Found configuration:
INFO - {'version': 2, 'sample_rate': 100, 'samples_per_packet': 8, 'column_location': {'AccelerometerX': 0, 'AccelerometerY': 1, 'AccelerometerZ': 2, 'GyroscopeX': 3, 'GyroscopeY': 4, 'GyroscopeZ': 5}}
PASS - Sample Rate OK
PASS - AccelerometerX OK
PASS - AccelerometerY OK
PASS - AccelerometerZ OK
PASS - GyroscopeX OK
PASS - GyroscopeY OK
PASS - GyroscopeZ OK
INFO - Checking Connection...
PASS - Connect received by device
INFO - Found configuration:
INFO - {'version': 2, 'sample_rate': 100, 'samples_per_packet': 8, 'column_location': {'AccelerometerX': 0, 'AccelerometerY': 1, 'AccelerometerZ': 2, 'GyroscopeX': 3, 'GyroscopeY': 4, 'GyroscopeZ': 5}}
PASS - Disconnect received and config info being sent
PASS - All Checks Passed
If there are any errors, each step will stop until the error is corrected.
Invalid SSF File Error
ERROR - Couldn't parse SSF file. Make sure it is valid JSON
Invalid Sample Rate Error
INFO - {'baud_rate': 115200, 'max_live_sample_rate': 611, 'available_sensors': ['Accelerometer', 'Gyroscope'], 'acceptable_sample_rates': [1600, 800, 400, 200, 101, 50, 25, 16000, 8000, 4000, 1000, 1000, 500, 200, 101, 50, 25, 12]}
INFO - Found configuration:
INFO - {'version': 2, 'sample_rate': 100, 'samples_per_packet': 8, 'column_location': {'AccelerometerX': 0, 'AccelerometerY': 1, 'AccelerometerZ': 2, 'GyroscopeX': 3, 'GyroscopeY': 4, 'GyroscopeZ': 5}}
ERROR - Device config did not contain a sample rate from the SSF file!
Invalid Sensor Columns Error
INFO - {'baud_rate': 115200, 'max_live_sample_rate': 611, 'available_sensors': ['NONAccelerometer', 'Gyroscope'], 'acceptable_sample_rates': [1600, 800, 400, 200, 100, 50, 25, 16000, 8000, 4000, 1000, 1000, 500, 200, 100, 50, 25, 12]}
INFO - Found configuration:
INFO - {'version': 2, 'sample_rate': 100, 'samples_per_packet': 8, 'column_location': {'AccelerometerX': 0, 'AccelerometerY': 1, 'AccelerometerZ': 2, 'GyroscopeX': 3, 'GyroscopeY': 4, 'GyroscopeZ': 5}}
PASS - Sample Rate OK
ERROR - AccelerometerX Not Within available sensors!
ERROR - ['NONAccelerometer', 'Gyroscope']
ERROR - AccelerometerY Not Within available sensors!
ERROR - ['NONAccelerometer', 'Gyroscope']
ERROR - AccelerometerZ Not Within available sensors!
ERROR - ['NONAccelerometer', 'Gyroscope']
PASS - GyroscopeX OK
PASS - GyroscopeY OK
PASS - GyroscopeZ OK