Commit 3972b2ae authored by Ian McInerney's avatar Ian McInerney

Added hook from stabilizer setpoints to computation algorithm

parent f85a2115
......@@ -16,6 +16,7 @@ void computation_packetReceived( CRTPPacket *pk );
void computation_processing();
void computation_algorithm_init();
void computation_algorithm_reset();
void computation_update_state( state_t *state, sensorData_t *sensor );
void computation_hook_state( state_t *state, sensorData_t *sensor );
void computation_hook_setpoints( setpoint_t *setpoints );
#endif
\ No newline at end of file
......@@ -155,12 +155,19 @@ void computation_localization_newDistance(int anchor, float newRange) {
/*
* This function is called by stabilizer once a new state has been determined.
*/
void computation_update_state( state_t *state, sensorData_t *sensor) {
void computation_hook_state( state_t *state, sensorData_t *sensor) {
localPosition.x = state->position.x;
localPosition.y = state->position.y;
localPosition.z = state->position.z;
}
/*
* This function is called by stabilizer before it does the control
*/
void computation_hook_setpoints( setpoint_t *setpoints ) {
}
void computation_configReceived( CRTPPacket *pk, CRTPPacket *p ) {
// Save the received packet.
// Note that the config starts at index 1 because index 0 is the opcode for the config
......
......@@ -141,7 +141,9 @@ static void stabilizerTask(void* param)
commanderXYZ_GetSetpoint(&setpoint, &state, &resetControllers);
computation_update_state(&state, &sensorData);
// Interface the control loop with the computation system
computation_hook_state(&state, &sensorData);
computation_hook_setpoints(&setpoint);
#ifndef BYPASS_CONTROLLERS
uint32_t controllerStart = xTaskGetTickCount();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment