From a7dddc4dfd3cf8920a162a78db0516c8b8633222 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 12 Sep 2013 10:14:33 +0200 Subject: [PATCH 1/4] Hotfix: Do not start MAVLink as default on telemetry port --- ROMFS/px4fmu_common/init.d/rcS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index 32fb67a454..c8590425e6 100755 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -189,8 +189,9 @@ then if [ $MODE == autostart ] then # Telemetry port is on both FMU boards ttyS1 - mavlink start -b 57600 -d /dev/ttyS1 - usleep 5000 + # but the AR.Drone motors can be get 'flashed' + # if starting MAVLink on them - so do not + # start it as default (default link: USB) # Start commander commander start From a418498f1b040ea57633d02d813112d94c8567b9 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 12 Sep 2013 12:51:21 +0200 Subject: [PATCH 2/4] 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 3/4] 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 4/4] 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 zcmeHOeQaCR6+cemCJhBAjBYSsymf?iY;B#=l(eGEp)tIU7Seod6;Qo6_Df@MY|nm% z1kEE}^HAQ5QG^IW8k%4r#?Zt9qEIRk(vKwwO)DErMT4P&y7ifLBbzdsl{9bq-Fu&7 zo6!BUeYCRJ@@74nZGSm6S*phhAN1tj)=z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SiT*LsKP~!k(H{`~5z+rv^zVrN zL(!iS{U@R)@g8kMlc2}N`D_++_j1nhZ9z|7$mv!=uQn?}|m zqT6lykbQs-IN*Q-4mjX|0}eRgfCCOV@c#$(tEBGwmZ9pJo!s_%pMp=~1HrqLVBcNJ zo>U+aqMeDlQ9d406NxyD`tYSJ|I)oD91W=n8amGF5tij*4>SphX;Kr3Sb|0=vARq# zYBm`6*87xTB$iY`G}rqS)O~>a>U~OYJQ0p+y&&a!pAwD*H73+n?^F8K{$P9%Q@c2o zRGD0Ny-$h7)hK5A>U~PQU_!j!r=Tu`nSpwr!fQxZHhP=97#eb6OiKj&;~+;sYQf$} zD%l5ml+$}uEud*^OONuAQpinJN`IfC4yeJDrYe1E04H`m+Z@hX zOC{-s{y;cNH))ALG})^rl%7FNrR}IiRnq9yXx5;)){d~ztA{Elm;30<`zuf&y-s`* z4Y=sc`zYh$Q)E`1LWv2A&MW%F81t-NiHQqbL~WOHW_(lbaq+L%QSrd{#vT{{o*6V= z%0SzHXMqPOHZSD2^F<5AlCCluf5+hBOEI{&jMmHO2g+!aI*a9hQbyyIpm_e-GWvxw z8nygleiTcKX}l~H({Gj0@0QVc{wwDHxQsqiM!Pt3;k@8XI1J^iS~!hW9Er|{pK#XV zdvBDzv0ahPb2L6c_JSQ;rM3!f1y(%MNvY5#697t(i>93NnAH&iLh2! zAS)%ot(1nfqKLdul4@8+C>i0&hYj((BQgcg5rym^@`9Za&@zxgG1-oEUG VTdrt@>#b;odo3>XXEGj#{{U1%l70XH 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; -} -