Hello, I’m working on a thesis about automatic control and I’m using Eclipse, but I’m not sure if the readings I’m getting from the pixhawk are the best I can get, I think they would improve if the accelerometer is calibrated. I’m also getting drift from the yaw angle.
I have these questions.
If I calibrate the accelerometer using mission planner and then, I upload my code, the calibration will not work, right?
Is there a way to calibrate the accelerometer without using mission planner?
I mean, a simple code, using the functions from the library “AP_AccelCal”, I read it several times, but I didn’t undertand it very well, I’m not very good at programming.
This is the code I’m using to get the angles.
const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER;
static AP_InertialSensor ins;
#if AP_AHRS_NAVEKF_AVAILABLE
AP_AHRS_NavEKF ahrs(ins, barometer, gps, sonar);
#else
AP_AHRS_DCM ahrs(ins, barometer, gps, sonar);
#endif
static AP_InertialNav_NavEKF inertial_nav(ahrs);
void setup()
{
ins.init(AP_InertialSensor::COLD_START,AP_InertialSensor::RATE_400HZ);
}
void loop ()
{
ahrs.update();
roll = ToDeg(ahrs.roll);
pitch = ToDeg(ahrs.pitch);
yaw = ToDeg(ahrs.yaw);
gyro = ins.get_gyro();
phd = ToDeg(gyro.x);
thd = ToDeg(gyro.y);
psid = ToDeg(gyro.z);
}
AP_HAL_MAIN();
Thanks in advance, I’m sorry if I didn’t express myself very well.