Skip to content

Instantly share code, notes, and snippets.

@el3ment
Created November 7, 2014 02:19
Show Gist options
  • Save el3ment/a6f85e5c3fed8b1a76b8 to your computer and use it in GitHub Desktop.
Save el3ment/a6f85e5c3fed8b1a76b8 to your computer and use it in GitHub Desktop.
// Start the module
// Fake a state
// Wait for the module to publish it's response
// Check to see if that response was expected
// Fake a new state and do it again.
// End the module
State testArray = [
{sensors : {pos, barometer, gps...}, controls : {control1, control2}},
{sensors : {pos, barometer, gps...}, controls : {control1, control2}}]
attitude_estimator_module.start();
attitudeControlSubscriber = subscribe(attitudeControl);
foreach(testArray as test){
waitingForData = true;
// Fake all of the sensor states
foreach(test.sensors as sensorData){
broadcast(sensorId, sensorData);
}
// Wait for control module to publish it's response
while(waitingForData){
// It's published
if(attitudeControlSubscriber.isUpdated())
// Check to see if it matches
assert(attitudeControlSubscriber.data == test.controls.attitudeControl);
waitingForData = false;
}
}
}
attitude_estimator_module.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment