From 396db730a6e6fdd72fc7a1a3dae1d8591b0d568f Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 9 Jul 2015 23:58:11 +0200 Subject: [PATCH 1/6] FMUv1: Enable PX4 FLOW driver --- makefiles/config_px4fmu-v1_default.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/makefiles/config_px4fmu-v1_default.mk b/makefiles/config_px4fmu-v1_default.mk index 2e4829958e..26ee983ced 100644 --- a/makefiles/config_px4fmu-v1_default.mk +++ b/makefiles/config_px4fmu-v1_default.mk @@ -37,6 +37,7 @@ MODULES += drivers/ets_airspeed MODULES += drivers/meas_airspeed MODULES += drivers/frsky_telemetry MODULES += modules/sensors +MODULES += drivers/px4flow # # System commands From 4465c029f54e1c412848a54bdfacc6431c6b3680 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 10 Jul 2015 09:50:36 +0200 Subject: [PATCH 2/6] commander: Add new params for home initialization. --- src/modules/commander/commander_params.c | 76 ++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 6 deletions(-) diff --git a/src/modules/commander/commander_params.c b/src/modules/commander/commander_params.c index 6e8e22b5cd..10284ab250 100644 --- a/src/modules/commander/commander_params.c +++ b/src/modules/commander/commander_params.c @@ -1,7 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2013 PX4 Development Team. All rights reserved. - * Author: Lorenz Meier + * Copyright (c) 2013-2015 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,16 +36,54 @@ * * Parameters defined by the sensors task. * - * @author Lorenz Meier - * @author Thomas Gubler - * @author Julian Oes + * @author Lorenz Meier + * @author Thomas Gubler + * @author Julian Oes */ #include #include +/** + * Roll trim + * + * The trim value is the actuator control value the system needs + * for straight and level flight. It can be calibrated by + * flying manually straight and level using the RC trims and + * copying them using the GCS. + * + * @group Radio Calibration + * @min -0.25 + * @max 0.25 + */ PARAM_DEFINE_FLOAT(TRIM_ROLL, 0.0f); + +/** + * Pitch trim + * + * The trim value is the actuator control value the system needs + * for straight and level flight. It can be calibrated by + * flying manually straight and level using the RC trims and + * copying them using the GCS. + * + * @group Radio Calibration + * @min -0.25 + * @max 0.25 + */ PARAM_DEFINE_FLOAT(TRIM_PITCH, 0.0f); + +/** + * Yaw trim + * + * The trim value is the actuator control value the system needs + * for straight and level flight. It can be calibrated by + * flying manually straight and level using the RC trims and + * copying them using the GCS. + * + * @group Radio Calibration + * @min -0.25 + * @max 0.25 + */ PARAM_DEFINE_FLOAT(TRIM_YAW, 0.0f); /** @@ -77,6 +114,7 @@ PARAM_DEFINE_FLOAT(BAT_V_CHARGED, 4.2f); * * @group Battery Calibration * @unit V + * @min 0.0f */ PARAM_DEFINE_FLOAT(BAT_V_LOAD_DROP, 0.07f); @@ -87,6 +125,8 @@ PARAM_DEFINE_FLOAT(BAT_V_LOAD_DROP, 0.07f); * * @group Battery Calibration * @unit S + * @min 1 + * @max 10 */ PARAM_DEFINE_INT32(BAT_N_CELLS, 3); @@ -182,7 +222,31 @@ PARAM_DEFINE_FLOAT(COM_EF_TIME, 10.0f); * @min 0 * @max 35 */ -PARAM_DEFINE_FLOAT(COM_RC_LOSS_T, 0.5); +PARAM_DEFINE_FLOAT(COM_RC_LOSS_T, 0.5f); + +/** + * Home set horizontal threshold + * + * The home position will be set if the estimated positioning accuracy is below the threshold. + * + * @group Commander + * @unit meter + * @min 2 + * @max 15 + */ +PARAM_DEFINE_FLOAT(COM_HOME_H_T, 5.0f); + +/** + * Home set vertical threshold + * + * The home position will be set if the estimated positioning accuracy is below the threshold. + * + * @group Commander + * @unit meter + * @min 5 + * @max 25 + */ +PARAM_DEFINE_FLOAT(COM_HOME_V_T, 10.0f); /** * Autosaving of params From fc5b8ee12d28016a50947cdb67e93e340ead37b1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 10 Jul 2015 09:50:56 +0200 Subject: [PATCH 3/6] Commander: Use new params for home set thresholds --- src/modules/commander/commander.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index f6fa5e6813..f7ef1ec8e2 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -870,6 +870,8 @@ int commander_thread_main(int argc, char *argv[]) param_t _param_autostart_id = param_find("SYS_AUTOSTART"); param_t _param_autosave_params = param_find("COM_AUTOS_PAR"); param_t _param_rc_in_off = param_find("COM_RC_IN_MODE"); + param_t _param_eph = param_find("COM_HOME_H_T"); + param_t _param_epv = param_find("COM_HOME_V_T"); const char *main_states_str[vehicle_status_s::MAIN_STATE_MAX]; main_states_str[vehicle_status_s::MAIN_STATE_MANUAL] = "MANUAL"; @@ -1293,6 +1295,10 @@ int commander_thread_main(int argc, char *argv[]) /* Parameter autosave setting */ param_get(_param_autosave_params, &autosave_params); + + /* EPH / EPV */ + param_get(_param_eph, &eph_threshold); + param_get(_param_epv, &epv_threshold); } /* Set flag to autosave parameters if necessary */ From 614c397762eddb986242c81f2baabaf412c8a379 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sat, 11 Jul 2015 22:08:36 +0200 Subject: [PATCH 4/6] MPU6K self-test: Be more forgiving on offset values --- src/drivers/mpu6000/mpu6000.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/drivers/mpu6000/mpu6000.cpp b/src/drivers/mpu6000/mpu6000.cpp index 9880544ecb..86fe334345 100644 --- a/src/drivers/mpu6000/mpu6000.cpp +++ b/src/drivers/mpu6000/mpu6000.cpp @@ -913,10 +913,14 @@ MPU6000::gyro_self_test() /* * Maximum deviation of 20 degrees, according to - * http://www.invensense.com/mems/gyro/documents/PS-MPU-6000A-00v3.4.pdf + * http://www.farnell.com/datasheets/1788002.pdf * Section 6.1, initial ZRO tolerance + * + * 20 dps (0.34 rad/s) initial offset + * and 20 dps temperature drift, so 0.34 rad/s * 2 */ - const float max_offset = 0.34f; + const float max_offset = 2.0f * 0.34f; + /* 30% scale error is chosen to catch completely faulty units but * to let some slight scale error pass. Requires a rate table or correlation * with mag rotations + data fit to From 9b6259c64f102287ec301b15a281f5fbcb0e7b10 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 12 Jul 2015 15:51:20 +0200 Subject: [PATCH 5/6] Header generator: Only get active for no output files or when output older than input --- Tools/px_generate_uorb_topic_headers.py | 34 ++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/Tools/px_generate_uorb_topic_headers.py b/Tools/px_generate_uorb_topic_headers.py index 4f821b0608..6be0e19163 100755 --- a/Tools/px_generate_uorb_topic_headers.py +++ b/Tools/px_generate_uorb_topic_headers.py @@ -93,6 +93,29 @@ def convert_dir(inputdir, outputdir, templatedir): """ Converts all .msg files in inputdir to uORB header files """ + + # Find the most recent modification time in input dir + maxinputtime = 0 + for f in os.listdir(inputdir): + fni = os.path.join(inputdir, f) + if os.path.isfile(fni): + it = os.path.getmtime(fni) + if it > maxinputtime: + maxinputtime = it; + + # Find the most recent modification time in output dir + maxouttime = 0 + for f in os.listdir(outputdir): + fni = os.path.join(outputdir, f) + if os.path.isfile(fni): + it = os.path.getmtime(fni) + if it > maxouttime: + maxouttime = it; + + # Do not generate if nothing changed on the input + if (maxinputtime != 0 and maxouttime != 0 and maxinputtime < maxouttime): + return False + includepath = incl_default + [':'.join([package, inputdir])] for f in os.listdir(inputdir): fn = os.path.join(inputdir, f) @@ -103,6 +126,8 @@ def convert_dir(inputdir, outputdir, templatedir): templatedir, includepath) + return True + def copy_changed(inputdir, outputdir, prefix=''): """ @@ -139,10 +164,11 @@ def convert_dir_save(inputdir, outputdir, templatedir, temporarydir, prefix): Unchanged existing files are not overwritten. """ # Create new headers in temporary output directory - convert_dir(inputdir, temporarydir, templatedir) - - # Copy changed headers from temporary dir to output dir - copy_changed(temporarydir, outputdir, prefix) + if (convert_dir(inputdir, temporarydir, templatedir)): + # Copy changed headers from temporary dir to output dir + copy_changed(temporarydir, outputdir, prefix) + else: + print('No changes.') if __name__ == "__main__": parser = argparse.ArgumentParser( From cdc17f1fdd8dfa3c315bd907dab8ca14f3f0cf8e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 12 Jul 2015 15:51:43 +0200 Subject: [PATCH 6/6] Keep temporary topic files to avoid constant re-generation, but delete them on clean --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index aedf595aef..804e1c3c3c 100644 --- a/Makefile +++ b/Makefile @@ -275,6 +275,7 @@ TOPICS_DIR = $(PX4_BASE)src/modules/uORB/topics MULTIPLATFORM_HEADER_DIR = $(PX4_BASE)src/platforms/nuttx/px4_messages MULTIPLATFORM_PREFIX = px4_ TOPICHEADER_TEMP_DIR = $(BUILD_DIR)topics_temporary +MULTI_TOPICHEADER_TEMP_DIR = $(BUILD_DIR)multi_topics_temporary GENMSG_PYTHONPATH = $(PX4_BASE)Tools/genmsg/src GENCPP_PYTHONPATH = $(PX4_BASE)Tools/gencpp/src @@ -287,9 +288,7 @@ generateuorbtopicheaders: checksubmodules @$(ECHO) "Generating multiplatform uORB topic wrapper headers" $(Q) (PYTHONPATH=$(GENMSG_PYTHONPATH):$(GENCPP_PYTHONPATH):$(PYTHONPATH) $(PYTHON) \ $(PX4_BASE)Tools/px_generate_uorb_topic_headers.py \ - -d $(MSG_DIR) -o $(MULTIPLATFORM_HEADER_DIR) -e $(MULTIPLATFORM_TEMPLATE_DIR) -t $(TOPICHEADER_TEMP_DIR) -p $(MULTIPLATFORM_PREFIX)) -# clean up temporary files - $(Q) (rm -r $(TOPICHEADER_TEMP_DIR)) + -d $(MSG_DIR) -o $(MULTIPLATFORM_HEADER_DIR) -e $(MULTIPLATFORM_TEMPLATE_DIR) -t $(MULTI_TOPICHEADER_TEMP_DIR) -p $(MULTIPLATFORM_PREFIX)) # # Testing targets @@ -320,6 +319,8 @@ clean: $(Q) $(RMDIR) $(BUILD_DIR)*.build $(Q) $(RMDIR) $(PX4_VERSIONING_DIR) $(Q) $(REMOVE) $(IMAGE_DIR)*.px4 + $(Q) $(RMDIR) $(TOPICHEADER_TEMP_DIR) + $(Q) $(RMDIR) $(MULTI_TOPICHEADER_TEMP_DIR) .PHONY: distclean distclean: clean