int mainControlInit(void) { ROTATION_DIAMETER = sqrt(pow(WHEELS_DISTANCE, 2) + pow(WHEELS_SPACING, 2)); motorsInit(); encodersInit(); mulimeterInit(); telemetersInit(); speedControlInit(); positionControlInit(); wallFollowControlInit(); lineFollowControlInit(); transfertFunctionInit(); wallSensorInit(); adxrs620Init(); speed_params.initial_speed = 0; control_params.wall_follow_state = 0; control_params.position_state = 0; control_params.speed_state = 0; control_params.line_follow_state = 0; return MAIN_CONTROL_E_SUCCESS; }
int mainControlInit(void) { pid_loop.start_state = FALSE; ROTATION_DIAMETER = sqrt(pow(WHEELS_DISTANCE, 2) + pow(WHEELS_SPACING, 2)); motorsInit(); encodersInit(); telemetersInit(); adxrs620Init(); speedControlInit(); positionControlInit(); wallFollowControlInit(); lineFollowControlInit(); transfertFunctionInit(); positionControlSetPositionType(ENCODERS); mainControlSetFollowType(NO_FOLLOW); mainControlSetMoveType(STRAIGHT); control_params.wall_follow_state = 0; control_params.line_follow_state = 0; return MAIN_CONTROL_E_SUCCESS; }
void testPostSensors() { telemetersInit(); telemetersStart(); while (expanderJoyFiltered() != JOY_LEFT) { ssd1306ClearScreen(MAIN_AREA); if (fabs(getTelemeterSpeed(TELEMETER_DL)) > 500) { ssd1306FillRect(0, 58, 5, 5); } // else // { // ssd1306DrawRect(0,49,5,5); // } // ssd1306FillRect(0,0,5,5); // ssd1306DrawRect(0,0,5,5); if (fabs(getTelemeterSpeed(TELEMETER_DR)) > 500) { ssd1306FillRect(49, 58, 5, 5); } // else // { // ssd1306DrawRect(49,49,5,5); // } // ssd1306FillRect(49,49,5,5); // // ssd1306DrawRect(49,49,5,5); // // ssd1306FillRect(49,0,5,5); // // ssd1306DrawRect(49,0,5,5); ssd1306PrintIntAtLine(55, 1, "FL", (int32_t) getTelemeterSpeed(TELEMETER_FL), &Font_5x8); ssd1306PrintIntAtLine(55, 2, "FR", (int32_t) getTelemeterSpeed(TELEMETER_DL), &Font_5x8); ssd1306PrintIntAtLine(55, 3, "DL", (int32_t) getTelemeterSpeed(TELEMETER_DR), &Font_5x8); ssd1306PrintIntAtLine(55, 4, "DR", (int32_t) getTelemeterSpeed(TELEMETER_FR), &Font_5x8); ssd1306Refresh(); } telemetersStop(); }
void testWallsSensors() { telemetersInit(); telemetersStart(); while (expanderJoyFiltered() != JOY_LEFT) { ssd1306ClearScreen(MAIN_AREA); if (getWallPresence(FRONT_WALL) == TRUE) { ssd1306FillRect(0, 59, 54, 5); } else { ssd1306DrawRect(0, 59, 54, 5); } if (getWallPresence(LEFT_WALL) == TRUE) { ssd1306FillRect(0, 10, 5, 54); } else { ssd1306DrawRect(0, 10, 5, 54); } if (getWallPresence(RIGHT_WALL) == TRUE) { ssd1306FillRect(49, 10, 5, 54); } else { ssd1306DrawRect(49, 10, 5, 54); } ssd1306PrintIntAtLine(60, 1, "FL ", (uint32_t) (getTelemeterDist(TELEMETER_FL) * 10.00), &Font_5x8); ssd1306PrintIntAtLine(60, 2, "DL ", (uint32_t) (getTelemeterDist(TELEMETER_DL) * 10.00), &Font_5x8); ssd1306PrintIntAtLine(60, 3, "DR ", (uint32_t) (getTelemeterDist(TELEMETER_DR) * 10.00), &Font_5x8); ssd1306PrintIntAtLine(60, 4, "FR ", (uint32_t) (getTelemeterDist(TELEMETER_FR) * 10.00), &Font_5x8); ssd1306Refresh(); } telemetersStop(); }