mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-25 12:50:35 +08:00
Merge remote-tracking branch 'upstream/master' into ros_messagelayer_merge
Conflicts: src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp src/modules/uORB/topics/vehicle_attitude.h
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
|
||||
#include "systemlib/systemlib.h"
|
||||
#include "systemlib/err.h"
|
||||
#include "systemlib/param/param.h"
|
||||
|
||||
__EXPORT int config_main(int argc, char *argv[]);
|
||||
|
||||
@@ -264,8 +265,11 @@ do_mag(int argc, char *argv[])
|
||||
int srate = ioctl(fd, MAGIOCGSAMPLERATE, 0);
|
||||
int prate = ioctl(fd, SENSORIOCGPOLLRATE, 0);
|
||||
int range = ioctl(fd, MAGIOCGRANGE, 0);
|
||||
int id = ioctl(fd, DEVIOCGDEVICEID,0);
|
||||
int32_t calibration_id = 0;
|
||||
param_get(param_find("SENS_MAG_ID"), &(calibration_id));
|
||||
|
||||
warnx("mag: \n\tsample rate:\t%d Hz\n\tread rate:\t%d Hz\n\trange:\t%d Ga", srate, prate, range);
|
||||
warnx("mag: \n\tdevice id:\t%x\t(calibration is for device id %x)\n\tsample rate:\t%d Hz\n\tread rate:\t%d Hz\n\trange:\t%d Ga", id, calibration_id, srate, prate, range);
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ int preflight_check_main(int argc, char *argv[])
|
||||
/* open text message output path */
|
||||
int mavlink_fd = open(MAVLINK_LOG_DEVICE, 0);
|
||||
int ret;
|
||||
int32_t mag_devid,mag_calibration_devid;
|
||||
|
||||
/* give the system some time to sample the sensors in the background */
|
||||
usleep(150000);
|
||||
@@ -96,6 +97,16 @@ int preflight_check_main(int argc, char *argv[])
|
||||
system_ok = false;
|
||||
goto system_eval;
|
||||
}
|
||||
|
||||
mag_devid = ioctl(fd, DEVIOCGDEVICEID,0);
|
||||
param_get(param_find("SENS_MAG_ID"), &(mag_calibration_devid));
|
||||
if (mag_devid != mag_calibration_devid){
|
||||
warnx("magnetometer calibration is for a different device - calibrate magnetometer first");
|
||||
mavlink_log_critical(mavlink_fd, "SENSOR FAIL: MAG CAL ID");
|
||||
system_ok = false;
|
||||
goto system_eval;
|
||||
}
|
||||
|
||||
ret = ioctl(fd, MAGIOCSELFTEST, 0);
|
||||
|
||||
if (ret != OK) {
|
||||
|
||||
Reference in New Issue
Block a user