From dd48b950efdc3a701ea71df48c1d05e296a62e2e Mon Sep 17 00:00:00 2001 From: Mark Whitehorn Date: Mon, 20 Jul 2015 07:55:46 -0600 Subject: [PATCH 1/4] fix units metadata for SENS_BOARD_?_OFF parameters --- src/modules/sensors/sensor_params.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/sensors/sensor_params.c b/src/modules/sensors/sensor_params.c index 8940f0b271..08c38de525 100644 --- a/src/modules/sensors/sensor_params.c +++ b/src/modules/sensors/sensor_params.c @@ -680,7 +680,7 @@ PARAM_DEFINE_INT32(SENS_FLOW_ROT, 0); * This parameter defines a rotational offset in degrees around the Y (Pitch) axis. It allows the user * to fine tune the board offset in the event of misalignment. * - * @unit radians + * @unit degrees * @group Sensor Calibration */ PARAM_DEFINE_FLOAT(SENS_BOARD_Y_OFF, 0.0f); @@ -691,7 +691,7 @@ PARAM_DEFINE_FLOAT(SENS_BOARD_Y_OFF, 0.0f); * This parameter defines a rotational offset in degrees around the X (Roll) axis It allows the user * to fine tune the board offset in the event of misalignment. * - * @unit radians + * @unit degrees * @group Sensor Calibration */ PARAM_DEFINE_FLOAT(SENS_BOARD_X_OFF, 0.0f); @@ -702,7 +702,7 @@ PARAM_DEFINE_FLOAT(SENS_BOARD_X_OFF, 0.0f); * This parameter defines a rotational offset in degrees around the Z (Yaw) axis. It allows the user * to fine tune the board offset in the event of misalignment. * - * @unit radians + * @unit degrees * @group Sensor Calibration */ PARAM_DEFINE_FLOAT(SENS_BOARD_Z_OFF, 0.0f); From 1834cf1cb9fbcd88366434ffcbc6d48d2d552251 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 22 Jul 2015 09:39:12 +0200 Subject: [PATCH 2/4] VTOL: Use the right attitude estimator --- ROMFS/px4fmu_common/init.d/rc.vtol_apps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ROMFS/px4fmu_common/init.d/rc.vtol_apps b/ROMFS/px4fmu_common/init.d/rc.vtol_apps index 23ade6d78b..265364fac8 100644 --- a/ROMFS/px4fmu_common/init.d/rc.vtol_apps +++ b/ROMFS/px4fmu_common/init.d/rc.vtol_apps @@ -4,7 +4,7 @@ # att & pos estimator, att & pos control. # -attitude_estimator_ekf start +attitude_estimator_q start #ekf_att_pos_estimator start position_estimator_inav start From a1fd088e8f29d6803404ab6b1e12c525cdb95c79 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 22 Jul 2015 10:03:45 +0200 Subject: [PATCH 3/4] MAVLink app: Rely on booted state, not on timeout for parameters. This fixes any param timing issues for good. --- src/modules/mavlink/mavlink_main.cpp | 6 ++++++ src/modules/mavlink/mavlink_main.h | 11 +++++++++++ src/modules/mavlink/mavlink_parameters.cpp | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 3a2acd07c3..a23b3f8736 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -115,6 +115,8 @@ extern mavlink_system_t mavlink_system; static void usage(void); +bool Mavlink::_boot_complete = false; + Mavlink::Mavlink() : _device_name(DEFAULT_DEVICE_NAME), _task_should_exit(false), @@ -1909,6 +1911,10 @@ int mavlink_main(int argc, char *argv[]) } else if (!strcmp(argv[1], "stream")) { return Mavlink::stream_command(argc, argv); + } else if (!strcmp(argv[1], "boot_complete")) { + Mavlink::set_boot_complete(); + return 0; + } else { usage(); exit(1); diff --git a/src/modules/mavlink/mavlink_main.h b/src/modules/mavlink/mavlink_main.h index 777836f688..5ecf8e6956 100644 --- a/src/modules/mavlink/mavlink_main.h +++ b/src/modules/mavlink/mavlink_main.h @@ -145,6 +145,14 @@ public: bool get_forwarding_on() { return _forwarding_on; } + /** + * Set the boot complete flag on all instances + * + * Setting the flag unblocks parameter transmissions, which are gated + * beforehand to ensure that the system is fully initialized. + */ + static void set_boot_complete() { _boot_complete = true; } + /** * Get the free space in the transmit buffer * @@ -294,6 +302,8 @@ public: unsigned get_system_type() { return _system_type; } + static bool boot_complete() { return _boot_complete; } + protected: Mavlink *next; @@ -302,6 +312,7 @@ private: int _mavlink_fd; bool _task_running; + static bool _boot_complete; /* states */ bool _hil_enabled; /**< Hardware In the Loop mode */ diff --git a/src/modules/mavlink/mavlink_parameters.cpp b/src/modules/mavlink/mavlink_parameters.cpp index 73d7580d21..66c6a87176 100644 --- a/src/modules/mavlink/mavlink_parameters.cpp +++ b/src/modules/mavlink/mavlink_parameters.cpp @@ -193,7 +193,7 @@ void MavlinkParametersManager::send(const hrt_abstime t) { /* send all parameters if requested, but only after the system has booted */ - if (_send_all_index >= 0 && t > 4 * 1000 * 1000) { + if (_send_all_index >= 0 && _mavlink->boot_complete()) { /* skip if no space is available */ if (_mavlink->get_free_tx_buf() < get_size()) { From e7833fe06f43025097437a3afb94604c2be19832 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 22 Jul 2015 10:04:13 +0200 Subject: [PATCH 4/4] Tell MAVLink app once we are fully booted and ready to communicate. --- ROMFS/px4fmu_common/init.d/rcS | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index 0a4887a639..81b301fe18 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -697,7 +697,7 @@ then fi unset EXIT_ON_END - # Run no SD alarm last + # Run no SD alarm if [ $LOG_FILE == /dev/null ] then echo "[i] No microSD card found" @@ -705,6 +705,9 @@ then tone_alarm error fi + # Boot is complete, inform MAVLink app(s) that the system is now fully up and running + mavlink boot_complete + # End of autostart fi