Skip to content
Snippets Groups Projects
Commit 44fc7121 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Added a new configuration parameter to let the software know the actual...

Added a new configuration parameter to let the software know the actual orientation of the gyroscope sensor. Needed to properly balance the robot.
parent 83242210
No related branches found
No related tags found
No related merge requests found
......@@ -26,8 +26,8 @@
#define MANAGER_MISSING_SERVOS_ALARM_TIME_ON 10
#define MANAGER_MISSING_SERVOS_ALARM_TIME_OFF 100
#define BALANCE_GYRO_CAL_NUM_SAMPLES 10
#define BALANCE_GYRO_X_CHANNEL 4
#define BALANCE_GYRO_Y_CHANNEL 3
#define BALANCE_GYRO_X_CHANNEL 3
#define BALANCE_GYRO_Y_CHANNEL 4
#define BALANCE_GYRO_CAL_FAILED_ALARM_NOTE NOTE_SOL
#define BALANCE_GYRO_CAL_FAILED_ALARM_TIME_ON 10
#define BALANCE_GYRO_CAL_FAILED_ALARM_TIME_OFF 100
......
......@@ -31,6 +31,10 @@
#define BALANCE_GYRO_Y_CHANNEL 4
#endif
#ifndef BALANCE_GYRO_Y_FWD
#define BALANCE_GYRO_Y_BWD
#endif
#ifndef BALANCE_GYRO_CAL_FAILED_ALARM_NOTE
#define BALANCE_GYRO_CAL_FAILED_ALARM_NOTE NOTE_SOL
#endif
......
......@@ -37,6 +37,11 @@ void balance_loop(void)
gyro_x=get_adc_channel(BALANCE_GYRO_X_CHANNEL)-balance_x_gyro_center;
gyro_y=get_adc_channel(BALANCE_GYRO_Y_CHANNEL)-balance_y_gyro_center;
#ifdef BALANCE_GYRO_Y_BWD
gyro_x=-gyro_x;
gyro_y=-gyro_y;
#endif
if(gyro_x < BALANCE_BACKWARD_FALL_THD_VALUE)
{
balance_robot_fallen_state = robot_face_up;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment