From a418498f1b040ea57633d02d813112d94c8567b9 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 12 Sep 2013 12:51:21 +0200 Subject: [PATCH 1/3] Hotfix: Use sensible default gains for users not being able to read instructions. --- .../multirotor_attitude_control.c | 6 +++--- .../multirotor_att_control/multirotor_rate_control.c | 10 +++++----- .../multirotor_pos_control_params.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/modules/multirotor_att_control/multirotor_attitude_control.c b/src/modules/multirotor_att_control/multirotor_attitude_control.c index c78232f11c..8245aa5609 100644 --- a/src/modules/multirotor_att_control/multirotor_attitude_control.c +++ b/src/modules/multirotor_att_control/multirotor_attitude_control.c @@ -62,15 +62,15 @@ #include #include -PARAM_DEFINE_FLOAT(MC_YAWPOS_P, 0.3f); +PARAM_DEFINE_FLOAT(MC_YAWPOS_P, 2.0f); PARAM_DEFINE_FLOAT(MC_YAWPOS_I, 0.15f); PARAM_DEFINE_FLOAT(MC_YAWPOS_D, 0.0f); //PARAM_DEFINE_FLOAT(MC_YAWPOS_AWU, 1.0f); //PARAM_DEFINE_FLOAT(MC_YAWPOS_LIM, 3.0f); -PARAM_DEFINE_FLOAT(MC_ATT_P, 0.2f); +PARAM_DEFINE_FLOAT(MC_ATT_P, 6.8f); PARAM_DEFINE_FLOAT(MC_ATT_I, 0.0f); -PARAM_DEFINE_FLOAT(MC_ATT_D, 0.05f); +PARAM_DEFINE_FLOAT(MC_ATT_D, 0.0f); //PARAM_DEFINE_FLOAT(MC_ATT_AWU, 0.05f); //PARAM_DEFINE_FLOAT(MC_ATT_LIM, 0.4f); diff --git a/src/modules/multirotor_att_control/multirotor_rate_control.c b/src/modules/multirotor_att_control/multirotor_rate_control.c index 0a336be47d..adb63186c0 100644 --- a/src/modules/multirotor_att_control/multirotor_rate_control.c +++ b/src/modules/multirotor_att_control/multirotor_rate_control.c @@ -59,14 +59,14 @@ #include #include -PARAM_DEFINE_FLOAT(MC_YAWRATE_P, 0.0f); /* same on Flamewheel */ -PARAM_DEFINE_FLOAT(MC_YAWRATE_D, 0.0f); -PARAM_DEFINE_FLOAT(MC_YAWRATE_I, 0.0f); +PARAM_DEFINE_FLOAT(MC_YAWRATE_P, 0.3f); /* same on Flamewheel */ +PARAM_DEFINE_FLOAT(MC_YAWRATE_D, 0.005f); +PARAM_DEFINE_FLOAT(MC_YAWRATE_I, 0.2f); //PARAM_DEFINE_FLOAT(MC_YAWRATE_AWU, 0.0f); //PARAM_DEFINE_FLOAT(MC_YAWRATE_LIM, 1.0f); -PARAM_DEFINE_FLOAT(MC_ATTRATE_P, 0.0f); /* 0.15 F405 Flamewheel */ -PARAM_DEFINE_FLOAT(MC_ATTRATE_D, 0.0f); +PARAM_DEFINE_FLOAT(MC_ATTRATE_P, 0.09f); /* 0.15 F405 Flamewheel */ +PARAM_DEFINE_FLOAT(MC_ATTRATE_D, 0.002f); PARAM_DEFINE_FLOAT(MC_ATTRATE_I, 0.0f); //PARAM_DEFINE_FLOAT(MC_ATTRATE_AWU, 0.05f); //PARAM_DEFINE_FLOAT(MC_ATTRATE_LIM, 1.0f); /**< roughly < 500 deg/s limit */ diff --git a/src/modules/multirotor_pos_control/multirotor_pos_control_params.c b/src/modules/multirotor_pos_control/multirotor_pos_control_params.c index bf9578ea3d..b7041e4d57 100644 --- a/src/modules/multirotor_pos_control/multirotor_pos_control_params.c +++ b/src/modules/multirotor_pos_control/multirotor_pos_control_params.c @@ -54,7 +54,7 @@ PARAM_DEFINE_FLOAT(MPC_XY_D, 0.0f); PARAM_DEFINE_FLOAT(MPC_XY_VEL_P, 0.2f); PARAM_DEFINE_FLOAT(MPC_XY_VEL_I, 0.0f); PARAM_DEFINE_FLOAT(MPC_XY_VEL_D, 0.0f); -PARAM_DEFINE_FLOAT(MPC_XY_VEL_MAX, 10.0f); +PARAM_DEFINE_FLOAT(MPC_XY_VEL_MAX, 5.0f); PARAM_DEFINE_FLOAT(MPC_TILT_MAX, 0.5f); int parameters_init(struct multirotor_position_control_param_handles *h) From 7010674f44feb8037c05965438e6bcbdb8c8d7ee Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 12 Sep 2013 12:56:06 +0200 Subject: [PATCH 2/3] Hotfix: Setting tested defaults for AR.Drone --- ROMFS/px4fmu_common/init.d/08_ardrone | 13 ++++++++++++- ROMFS/px4fmu_common/init.d/09_ardrone_flow | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/08_ardrone b/ROMFS/px4fmu_common/init.d/08_ardrone index f6d82a5ec4..7dbbb82847 100644 --- a/ROMFS/px4fmu_common/init.d/08_ardrone +++ b/ROMFS/px4fmu_common/init.d/08_ardrone @@ -8,7 +8,18 @@ echo "[init] 08_ardrone: PX4FMU on PX4IOAR carrier board" if param compare SYS_AUTOCONFIG 1 then # Set all params here, then disable autoconfig - # TODO + param set MC_ATTRATE_D 0 + param set MC_ATTRATE_I 0 + param set MC_ATTRATE_P 0.13 + param set MC_ATT_D 0 + param set MC_ATT_I 0.3 + param set MC_ATT_P 5 + param set MC_YAWPOS_D 0.1 + param set MC_YAWPOS_I 0.15 + param set MC_YAWPOS_P 1 + param set MC_YAWRATE_D 0 + param set MC_YAWRATE_I 0 + param set MC_YAWRATE_P 0.15 param set SYS_AUTOCONFIG 0 param save diff --git a/ROMFS/px4fmu_common/init.d/09_ardrone_flow b/ROMFS/px4fmu_common/init.d/09_ardrone_flow index 794342a0b1..6333aae564 100644 --- a/ROMFS/px4fmu_common/init.d/09_ardrone_flow +++ b/ROMFS/px4fmu_common/init.d/09_ardrone_flow @@ -8,7 +8,18 @@ echo "[init] 09_ardrone_flow: PX4FMU on PX4IOAR carrier board with PX4FLOW" if param compare SYS_AUTOCONFIG 1 then # Set all params here, then disable autoconfig - # TODO + param set MC_ATTRATE_D 0 + param set MC_ATTRATE_I 0 + param set MC_ATTRATE_P 0.13 + param set MC_ATT_D 0 + param set MC_ATT_I 0.3 + param set MC_ATT_P 5 + param set MC_YAWPOS_D 0.1 + param set MC_YAWPOS_I 0.15 + param set MC_YAWPOS_P 1 + param set MC_YAWRATE_D 0 + param set MC_YAWRATE_I 0 + param set MC_YAWRATE_P 0.15 param set SYS_AUTOCONFIG 0 param save From 379623596715d0dce47192329ae9aceabb9ded11 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 12 Sep 2013 12:58:08 +0200 Subject: [PATCH 3/3] Remove accidentally comitted COM tool --- Tools/com | Bin 13632 -> 0 bytes Tools/com.c | 191 ---------------------------------------------------- 2 files changed, 191 deletions(-) delete mode 100755 Tools/com delete mode 100644 Tools/com.c diff --git a/Tools/com b/Tools/com deleted file mode 100755 index 1d80d4aa5be7643c59635245881cd263a756d9b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13632 zcmeHOdu&_P89$~8q@iFJ$_5*cyNH(d$t1! zT1E^t%EcI2h#;h)iI*5d6AOq!snn1@mLN0@HkgVAn*e32&AO3I8Dw2X_WPZ4uWP$4 z`)B`5x<@+S`CjKc-}%ntCf~h&^VnZLKSK!50wIP@6GHehSAh; zz5ix^^G)QI7EdX8Qi^t#V*tZw^>1%2RgwL*Ql34$fNuish|_JcVI<7{#Btqnd%p89 z8Hf+FBMRvXg(_GfhKfnUh$s3w;{{f^z1)S$UYD)m&`yUc+um{iXwT?2Ls2sZrE+^s z7b$ytZ3Cnk_d+?rzd$?@>k03)70T^ZU##p++j7#yrNlM_hS3+kvnL!hdcs{1Ntdq2 zG20&3oQ3ok6~i#QjjmWnuc@@k{nIZ|{_U}ikj7p+W#K*<#sV5fV?%30k(#FL$PG$1 zXj!;nQMlZ+>#Vh5ghNJrptmy;GNOstDec+arM+UmxSoqqonja}BSqWp1baSB`RCXp zU2gAO#~50}2z7jsf0}J?*zQBR*dFJLtz9UF5r~B2$2}~M->9bi%i29iJFzMlDMF5) z`z@PqyushN**UW{W$OT%rJjcrg?@P?rod9%D^dl(2bK@5v$v?R9ds2sw66vZn)~&9 z3f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dt9~Ln|dNrz(pjZMP)t1{lrkH5x%%V?>LCR#76r7EoO?XX71N^4k z>+w-8>B}XpzGtSKZ_2ztoZne&bmVsbEubN$sw{1Q#q`cH`mQoMRYpHhMl;n}Z0|>9 z^pj=ub7l04W%Qmhdc2J0n}y=>-Y%oxE2F2%=ugV%V`a2Q83$B_i^&CJI;$F$-@S7+ z&qC$92PToZI!u!@#dR(!bB|m%zH{WOk@Hbe>X`_yLj7OZ)bNW1BiIqcZ%2$S{CXtL z<7S*>TN`pC8zr0DDBaeuqz+}tRU>bN5{|ljBum{p_D!Mgh{Ek)-wV!-z*agZZvp50 etCL@H=AFY{IORZ`;|FtLXv&} diff --git a/Tools/com.c b/Tools/com.c deleted file mode 100644 index fa52dcb61e..0000000000 --- a/Tools/com.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Building: cc -o com com.c - * Usage : ./com /dev/device [speed] - * Example : ./com /dev/ttyS0 [115200] - * Keys : Ctrl-A - exit, Ctrl-X - display control lines status - * Darcs : darcs get http://tinyserial.sf.net/ - * Homepage: http://tinyserial.sourceforge.net - * Version : 2009-03-05 - * - * Ivan Tikhonov, http://www.brokestream.com, kefeer@brokestream.com - * Patches by Jim Kou, Henry Nestler, Jon Miner, Alan Horstmann - * - */ - - -/* Copyright (C) 2007 Ivan Tikhonov - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Ivan Tikhonov, kefeer@brokestream.com - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int transfer_byte(int from, int to, int is_control); - -typedef struct {char *name; int flag; } speed_spec; - - -void print_status(int fd) { - int status; - unsigned int arg; - status = ioctl(fd, TIOCMGET, &arg); - fprintf(stderr, "[STATUS]: "); - if(arg & TIOCM_RTS) fprintf(stderr, "RTS "); - if(arg & TIOCM_CTS) fprintf(stderr, "CTS "); - if(arg & TIOCM_DSR) fprintf(stderr, "DSR "); - if(arg & TIOCM_CAR) fprintf(stderr, "DCD "); - if(arg & TIOCM_DTR) fprintf(stderr, "DTR "); - if(arg & TIOCM_RNG) fprintf(stderr, "RI "); - fprintf(stderr, "\r\n"); -} - -int main(int argc, char *argv[]) -{ - int comfd; - struct termios oldtio, newtio; //place for old and new port settings for serial port - struct termios oldkey, newkey; //place tor old and new port settings for keyboard teletype - char *devicename = argv[1]; - int need_exit = 0; - speed_spec speeds[] = - { - {"1200", B1200}, - {"2400", B2400}, - {"4800", B4800}, - {"9600", B9600}, - {"19200", B19200}, - {"38400", B38400}, - {"57600", B57600}, - {"115200", B115200}, - {NULL, 0} - }; - int speed = B9600; - - if(argc < 2) { - fprintf(stderr, "example: %s /dev/ttyS0 [115200]\n", argv[0]); - exit(1); - } - - comfd = open(devicename, O_RDWR | O_NOCTTY | O_NONBLOCK); - if (comfd < 0) - { - perror(devicename); - exit(-1); - } - - if(argc > 2) { - speed_spec *s; - for(s = speeds; s->name; s++) { - if(strcmp(s->name, argv[2]) == 0) { - speed = s->flag; - fprintf(stderr, "setting speed %s\n", s->name); - break; - } - } - } - - fprintf(stderr, "C-a exit, C-x modem lines status\n"); - - tcgetattr(STDIN_FILENO,&oldkey); - newkey.c_cflag = B9600 | CRTSCTS | CS8 | CLOCAL | CREAD; - newkey.c_iflag = IGNPAR; - newkey.c_oflag = 0; - newkey.c_lflag = 0; - newkey.c_cc[VMIN]=1; - newkey.c_cc[VTIME]=0; - tcflush(STDIN_FILENO, TCIFLUSH); - tcsetattr(STDIN_FILENO,TCSANOW,&newkey); - - - tcgetattr(comfd,&oldtio); // save current port settings - newtio.c_cflag = speed | CS8 | CLOCAL | CREAD; - newtio.c_iflag = IGNPAR; - newtio.c_oflag = 0; - newtio.c_lflag = 0; - newtio.c_cc[VMIN]=1; - newtio.c_cc[VTIME]=0; - tcflush(comfd, TCIFLUSH); - tcsetattr(comfd,TCSANOW,&newtio); - - print_status(comfd); - - while(!need_exit) { - fd_set fds; - int ret; - - FD_ZERO(&fds); - FD_SET(STDIN_FILENO, &fds); - FD_SET(comfd, &fds); - - - ret = select(comfd+1, &fds, NULL, NULL, NULL); - if(ret == -1) { - perror("select"); - } else if (ret > 0) { - if(FD_ISSET(STDIN_FILENO, &fds)) { - need_exit = transfer_byte(STDIN_FILENO, comfd, 1); - } - if(FD_ISSET(comfd, &fds)) { - need_exit = transfer_byte(comfd, STDIN_FILENO, 0); - } - } - } - - tcsetattr(comfd,TCSANOW,&oldtio); - tcsetattr(STDIN_FILENO,TCSANOW,&oldkey); - close(comfd); - - return 0; -} - - -int transfer_byte(int from, int to, int is_control) { - char c; - int ret; - do { - ret = read(from, &c, 1); - } while (ret < 0 && errno == EINTR); - if(ret == 1) { - if(is_control) { - if(c == '\x01') { // C-a - return -1; - } else if(c == '\x18') { // C-x - print_status(to); - return 0; - } - } - while(write(to, &c, 1) == -1) { - if(errno!=EAGAIN && errno!=EINTR) { perror("write failed"); break; } - } - } else { - fprintf(stderr, "\nnothing to read. probably port disconnected.\n"); - return -2; - } - return 0; -} -