You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi !my english is limited 我猜你是中国人!我也是!如果可以的话请求你的帮助![email protected]
i want to turn by gyro,but i fail,the degrees of gyro is raising ,is a bug?how can i fix it?
void GyroLeftTurn(int nLTargetDegree, int nTurnLPower) {
//ev3_gyro_sensor_reset (SENSOR_G);
while (-1 * (ev3_gyro_sensor_get_angle(SENSOR_G)) <= nLTargetDegree) {
ev3_motor_set_power(R_MOTOR, nTurnLPower);
ev3_motor_set_power(L_MOTOR, 0);
}
Most likely your gyro is drifting. The angle it reads does not always stay the same even when not moving, because it's not perfect. It has nothing to do with code, you just have to wait 3-5 seconds after resetting the gyro to make sure it starts properly. Resetting the gyro resets the count, and to fix drift you can run ev3_gyro_sensor_get_rate() and ev3_gyro_sensor_get_angle() and then waiting to reset the gyro completely (turn it off and then back on again), and if you move while it is turning on it will cause it to drift. This should fix the drift issue but might not in some cases.
hi !my english is limited 我猜你是中国人!我也是!如果可以的话请求你的帮助![email protected]
i want to turn by gyro,but i fail,the degrees of gyro is raising ,is a bug?how can i fix it?
void GyroLeftTurn(int nLTargetDegree, int nTurnLPower) {
//ev3_gyro_sensor_reset (SENSOR_G);
while (-1 * (ev3_gyro_sensor_get_angle(SENSOR_G)) <= nLTargetDegree) {
ev3_motor_set_power(R_MOTOR, nTurnLPower);
ev3_motor_set_power(L_MOTOR, 0);
}
ev3_motor_stop(L_MOTOR, true);
ev3_motor_stop(R_MOTOR, true);
}
The text was updated successfully, but these errors were encountered: