Please I'm working on a quadcopter, and I have to made my own flight controller based on arduino uno.
First of all please how can I get a filtred angular velocity and linear acceleration from the MPU6050, is the following code give us the angular velocity in deg/sec and the linear velocity in m/s² ?
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
and is this pid value in this following code is right ?
accel_reading = ax; accel_corrected = accel_reading - accel_offset; accel_corrected = map(accel_corrected, -16800, 16800, -90, 90); accel_corrected = constrain(accel_corrected, -90, 90); accel_angle = (float)(accel_corrected * accel_scale); err = angle_setpoint - accel_angle ; P = Kp * err ; I += (Ki * err) ; D = Kd * (err - errp); pid = P + I + D;