From 9c4ad5f7ff2643b0395ec88ee373b75ed28088c4 Mon Sep 17 00:00:00 2001 From: Jason Short Date: Tue, 1 Nov 2011 09:22:21 -0700 Subject: [PATCH 01/14] Baro Minimized the baro filtering to use a new approach to rate control. Redid the state machine so the temp is sampled more often. --- libraries/APM_BMP085/APM_BMP085.cpp | 26 +++++++++++++++++++++++++- libraries/APM_BMP085/APM_BMP085.h | 6 +++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/libraries/APM_BMP085/APM_BMP085.cpp b/libraries/APM_BMP085/APM_BMP085.cpp index 22b6806b57..7e007ac130 100644 --- a/libraries/APM_BMP085/APM_BMP085.cpp +++ b/libraries/APM_BMP085/APM_BMP085.cpp @@ -95,7 +95,7 @@ void APM_BMP085_Class::Init(int initialiseWireLib) BMP085_State = 1; } - +/* // Read the sensor. This is a state machine // We read one time Temperature (state=1) and then 4 times Pressure (states 2-5) uint8_t APM_BMP085_Class::Read() @@ -130,6 +130,30 @@ uint8_t APM_BMP085_Class::Read() } return(result); } +*/ +// Read the sensor. This is a state machine +// We read one time Temperature (state=1) and then 4 times Pressure (states 2-5) +uint8_t APM_BMP085_Class::Read() +{ + uint8_t result = 0; + + if (BMP085_State == 1){ + if (digitalRead(BMP085_EOC)){ + BMP085_State = 2; + ReadTemp(); // On state 1 we read temp + Command_ReadPress(); + } + }else{ + if (digitalRead(BMP085_EOC)){ + BMP085_State = 1; // Start again from state = 1 + ReadPress(); + Calculate(); + Command_ReadTemp(); // Read Temp + result = 1; // New pressure reading + } + } + return(result); +} // Send command to Read Pressure diff --git a/libraries/APM_BMP085/APM_BMP085.h b/libraries/APM_BMP085/APM_BMP085.h index fb44e68a8c..66d950a3d6 100644 --- a/libraries/APM_BMP085/APM_BMP085.h +++ b/libraries/APM_BMP085/APM_BMP085.h @@ -1,8 +1,8 @@ #ifndef APM_BMP085_h #define APM_BMP085_h -#define TEMP_FILTER_SIZE 16 -#define PRESS_FILTER_SIZE 10 +#define TEMP_FILTER_SIZE 2 +#define PRESS_FILTER_SIZE 2 #include "APM_BMP085_hil.h" @@ -13,6 +13,7 @@ class APM_BMP085_Class _temp_index(0), _press_index(0){}; // Constructor int32_t RawPress; + int32_t _offset_press; int32_t RawTemp; int16_t Temp; int32_t Press; @@ -32,7 +33,6 @@ class APM_BMP085_Class int _temp_filter[TEMP_FILTER_SIZE]; int _press_filter[PRESS_FILTER_SIZE]; - long _offset_press; long _offset_temp; uint8_t _temp_index; From ab1de277dcea94f9bdce226f68381fbb2c87ca49 Mon Sep 17 00:00:00 2001 From: Jason Short Date: Tue, 1 Nov 2011 09:24:51 -0700 Subject: [PATCH 02/14] altered the interactive throttle to be more aggressive and proportional. reworked baro reading strategy. --- ArduCopter/ArduCopter.pde | 54 +++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index a1247e0810..9772008965 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -664,6 +664,7 @@ static void medium_loop() }else{ g_gps->new_data = false; } + break; // command processing @@ -729,6 +730,9 @@ static void medium_loop() // ----------------------- arm_motors(); + // Do an extra baro read + // --------------------- + barometer.Read(); slow_loop(); break; @@ -1066,7 +1070,15 @@ void update_throttle_mode(void) g.rc_3.servo_out = heli_get_angle_boost(g.throttle_cruise + nav_throttle); #else angle_boost = get_angle_boost(g.throttle_cruise); - g.rc_3.servo_out = g.throttle_cruise + nav_throttle + angle_boost + manual_boost; + if(manual_boost != 0){ + //remove alt_hold_velocity when implemented + g.rc_3.servo_out = g.throttle_cruise + angle_boost + manual_boost + alt_hold_velocity(); + // reset next_WP.alt + next_WP.alt = max(current_loc.alt, 100); + }else{ + g.rc_3.servo_out = g.throttle_cruise + nav_throttle + angle_boost + alt_hold_velocity(); + } + #endif break; } @@ -1204,7 +1216,7 @@ static void update_altitude() float scale; // read barometer - baro_alt = read_barometer(); + baro_alt = (baro_alt + read_barometer()) >> 1; if(baro_alt < 1000){ @@ -1229,25 +1241,16 @@ static void update_altitude() } // calc the accel rate limit to 2m/s - altitude_rate = (current_loc.alt - old_altitude) * 10; // 10 hz timer - - // rate limiter to reduce some of the motor pulsing - if (altitude_rate > 0){ - // going up - altitude_rate = min(altitude_rate, old_rate + 20); - }else{ - // going down - altitude_rate = max(altitude_rate, old_rate - 20); - } - - old_rate = altitude_rate; - old_altitude = current_loc.alt; + int temp_rate = (barometer._offset_press - barometer.RawPress) << 1; // invert and scale + altitude_rate = (temp_rate - old_rate) * 10; + old_rate = temp_rate; #endif } static void adjust_altitude() { + /* if(g.rc_3.control_in <= 200){ next_WP.alt -= 1; // 1 meter per second next_WP.alt = max(next_WP.alt, (current_loc.alt - 500)); // don't go less than 4 meters below current location @@ -1258,6 +1261,25 @@ adjust_altitude() next_WP.alt += 1; // 1 meter per second next_WP.alt = min(next_WP.alt, (current_loc.alt + 500)); // don't go more than 4 meters below current location //manual_boost = (g.rc_3.control_in == 800) ? 20 : 0; + }*/ + + if(g.rc_3.control_in <= 180){ + // we remove 0 to 100 PWM from hover + manual_boost = g.rc_3.control_in - 180; + manual_boost = max(-120, manual_boost); + g.throttle_cruise += g.pi_alt_hold.get_integrator(); + g.pi_alt_hold.reset_I(); + g.pi_throttle.reset_I(); + + }else if (g.rc_3.control_in >= 650){ + // we add 0 to 100 PWM to hover + manual_boost = g.rc_3.control_in - 650; + g.throttle_cruise += g.pi_alt_hold.get_integrator(); + g.pi_alt_hold.reset_I(); + g.pi_throttle.reset_I(); + + }else { + manual_boost = 0; } } @@ -1339,7 +1361,7 @@ static void tuning(){ g.pi_nav_lat.kP(tuning_value); g.pi_nav_lon.kP(tuning_value); break; - + #if FRAME_CONFIG == HELI_FRAME case CH6_HELI_EXTERNAL_GYRO: g.rc_6.set_range(1000,2000); From 48db60a4eb39173a6096fcee3eec07428156ec6c Mon Sep 17 00:00:00 2001 From: Jason Short Date: Tue, 1 Nov 2011 09:25:23 -0700 Subject: [PATCH 03/14] Tweaks to alt hold --- ArduCopter/Attitude.pde | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ArduCopter/Attitude.pde b/ArduCopter/Attitude.pde index 772828c104..4bc8c1da3a 100644 --- a/ArduCopter/Attitude.pde +++ b/ArduCopter/Attitude.pde @@ -83,7 +83,7 @@ get_stabilize_yaw(long target_angle) return (int)constrain(rate, -2500, 2500); } -#define ALT_ERROR_MAX 500 +#define ALT_ERROR_MAX 300 static int get_nav_throttle(long z_error) { @@ -94,7 +94,7 @@ get_nav_throttle(long z_error) rate_error = rate_error - altitude_rate; // limit the rate - rate_error = constrain(rate_error, -120, 140); + rate_error = constrain(rate_error, -80, 140); return (int)g.pi_throttle.get_pi(rate_error, .1); } @@ -202,6 +202,9 @@ static int alt_hold_velocity() //s: -13.1310, g:47.8700, e:1.0000, o:-158 #else + Vector3f accel_filt; + accel_filt = imu.get_accel_filtered(); + accels_rot = dcm.get_dcm_matrix() * imu.get_accel_filtered(); return 0; #endif } From fd9b16e787fdac62e42679909e5e1aee9691a104 Mon Sep 17 00:00:00 2001 From: Jason Short Date: Tue, 1 Nov 2011 09:27:49 -0700 Subject: [PATCH 04/14] resetting alt hold I --- ArduCopter/system.pde | 1 + 1 file changed, 1 insertion(+) diff --git a/ArduCopter/system.pde b/ArduCopter/system.pde index 2f7d46e5fe..c4b6573378 100644 --- a/ArduCopter/system.pde +++ b/ArduCopter/system.pde @@ -512,6 +512,7 @@ init_throttle_cruise() // are we moving from manual throttle to auto_throttle? if((old_control_mode <= STABILIZE) && (g.rc_3.control_in > MINIMUM_THROTTLE)){ g.pi_throttle.reset_I(); + g.pi_alt_hold.reset_I(); #if FRAME_CONFIG == HELI_FRAME g.throttle_cruise.set_and_save(heli_get_scaled_throttle(g.rc_3.control_in)); #else From c6ed8ed0eaee1e46981fcd549f4a259ec06dbc17 Mon Sep 17 00:00:00 2001 From: Jason Short Date: Tue, 1 Nov 2011 09:28:04 -0700 Subject: [PATCH 05/14] alt hold logging --- ArduCopter/Log.pde | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ArduCopter/Log.pde b/ArduCopter/Log.pde index 73db05a2b5..304ee2d653 100644 --- a/ArduCopter/Log.pde +++ b/ArduCopter/Log.pde @@ -660,10 +660,13 @@ static void Log_Write_Control_Tuning() DataFlash.WriteInt(nav_throttle); //7 DataFlash.WriteInt(angle_boost); //8 DataFlash.WriteInt(manual_boost); //9 + //DataFlash.WriteInt((int)(accels_rot.z * 1000)); //10 + DataFlash.WriteInt((int)(barometer.RawPress - barometer._offset_press)); //9 - DataFlash.WriteInt(g.rc_3.servo_out); //10 - DataFlash.WriteInt((int)g.pi_alt_hold.get_integrator()); //11 - DataFlash.WriteInt((int)g.pi_throttle.get_integrator()); //12 + + DataFlash.WriteInt(g.rc_3.servo_out); //11 + DataFlash.WriteInt((int)g.pi_alt_hold.get_integrator()); //12 + DataFlash.WriteInt((int)g.pi_throttle.get_integrator()); //13 DataFlash.WriteByte(END_BYTE); } @@ -672,8 +675,8 @@ static void Log_Write_Control_Tuning() // Read an control tuning packet static void Log_Read_Control_Tuning() { - // 1 2 3 4 5 6 7 8 9 10 11 12 - Serial.printf_P(PSTR( "CTUN, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n"), + // 1 2 3 4 5 6 7 8 9 10 11 12 13 + Serial.printf_P(PSTR( "CTUN, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n"), // Control //DataFlash.ReadByte(), @@ -692,10 +695,12 @@ static void Log_Read_Control_Tuning() DataFlash.ReadInt(), //7 DataFlash.ReadInt(), //8 DataFlash.ReadInt(), //9 - DataFlash.ReadInt(), //10 + //(float)DataFlash.ReadInt() / 1000, //10 + DataFlash.ReadInt(), //11 - DataFlash.ReadInt()); //12 + DataFlash.ReadInt(), //12 + DataFlash.ReadInt()); //13 } // Write a performance monitoring packet. Total length : 19 bytes From c402311077a6f43d072a6ac0b74163c15f00e759 Mon Sep 17 00:00:00 2001 From: Jason Short Date: Tue, 1 Nov 2011 09:28:23 -0700 Subject: [PATCH 06/14] removed accel.z references --- ArduCopter/Attitude.pde | 3 --- 1 file changed, 3 deletions(-) diff --git a/ArduCopter/Attitude.pde b/ArduCopter/Attitude.pde index 4bc8c1da3a..030d6c36aa 100644 --- a/ArduCopter/Attitude.pde +++ b/ArduCopter/Attitude.pde @@ -202,9 +202,6 @@ static int alt_hold_velocity() //s: -13.1310, g:47.8700, e:1.0000, o:-158 #else - Vector3f accel_filt; - accel_filt = imu.get_accel_filtered(); - accels_rot = dcm.get_dcm_matrix() * imu.get_accel_filtered(); return 0; #endif } From c32a70763254fb22a6a32d2dea62ed62854b5d7e Mon Sep 17 00:00:00 2001 From: Jason Short Date: Tue, 1 Nov 2011 09:28:36 -0700 Subject: [PATCH 07/14] cleanup --- ArduCopter/ArduCopter.pde | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index 9772008965..113dbe5a4a 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -1240,7 +1240,7 @@ static void update_altitude() current_loc.alt = baro_alt + home.alt; } - // calc the accel rate limit to 2m/s + // calc the vertical accel rate int temp_rate = (barometer._offset_press - barometer.RawPress) << 1; // invert and scale altitude_rate = (temp_rate - old_rate) * 10; old_rate = temp_rate; @@ -1251,6 +1251,7 @@ static void adjust_altitude() { /* + // old vert control if(g.rc_3.control_in <= 200){ next_WP.alt -= 1; // 1 meter per second next_WP.alt = max(next_WP.alt, (current_loc.alt - 500)); // don't go less than 4 meters below current location From 0a538baeb2f0d8885b56dce0cfcffe290be13947 Mon Sep 17 00:00:00 2001 From: Jason Short Date: Tue, 1 Nov 2011 09:29:55 -0700 Subject: [PATCH 08/14] updated baro test --- ArduCopter/test.pde | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ArduCopter/test.pde b/ArduCopter/test.pde index 7e8fed1d60..9311475fbe 100644 --- a/ArduCopter/test.pde +++ b/ArduCopter/test.pde @@ -429,7 +429,7 @@ test_imu(uint8_t argc, const Menu::arg *argv) while(1){ //delay(20); - if (millis() - fast_loopTimer >= 5) { + if (millis() - fast_loopTimer >=5) { // IMU // --- @@ -795,9 +795,16 @@ test_baro(uint8_t argc, const Menu::arg *argv) init_barometer(); while(1){ + delay(100); + barometer.Read(); delay(100); baro_alt = read_barometer(); - Serial.printf_P(PSTR("Baro: %dcm\n"), baro_alt); + + int temp_rate = (barometer._offset_press - barometer.RawPress) << 1; + altitude_rate = (temp_rate - old_rate) * 10; + old_rate = temp_rate; + // 1 2 3 4 5 1 2 3 4 5 + Serial.printf_P(PSTR("Baro: %dcm, rate:%d, %ld, %ld, %d\n"), baro_alt, altitude_rate, barometer.RawTemp, barometer.RawPress, temp_rate); //Serial.printf_P(PSTR("Baro, %d, %ld, %ld, %ld, %ld\n"), baro_alt, barometer.RawTemp, barometer.RawTemp2, barometer.RawPress, barometer.RawPress2); if(Serial.available() > 0){ return (0); From 1df9f8488d6a0a1fa660bf31c239e3b2cd06154b Mon Sep 17 00:00:00 2001 From: Jason Short Date: Tue, 1 Nov 2011 09:30:34 -0700 Subject: [PATCH 09/14] updated Alt hold PIDs --- ArduCopter/config.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ArduCopter/config.h b/ArduCopter/config.h index e05c8bb2a8..3915b53587 100644 --- a/ArduCopter/config.h +++ b/ArduCopter/config.h @@ -509,10 +509,10 @@ #endif #ifndef THR_HOLD_P -# define THR_HOLD_P 0.5 // +# define THR_HOLD_P 0.4 // #endif #ifndef THR_HOLD_I -# define THR_HOLD_I 0.01 // with 4m error, 12.5s windup +# define THR_HOLD_I 0.02 // with 4m error, 12.5s windup #endif #ifndef THR_HOLD_IMAX # define THR_HOLD_IMAX 300 @@ -520,10 +520,10 @@ // RATE control #ifndef THROTTLE_P -# define THROTTLE_P 0.8 // +# define THROTTLE_P 1.0 // #endif #ifndef THROTTLE_I -# define THROTTLE_I 0.10 // with 4m error, 12.5s windup +# define THROTTLE_I 0.0 // #endif #ifndef THROTTLE_IMAX # define THROTTLE_IMAX 50 From acc03753abfc7b7370ff99dcfdf70d6238600e2a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 2 Nov 2011 08:13:57 +1100 Subject: [PATCH 10/14] fixed HIL build --- ArduCopter/ArduCopter.pde | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index 113dbe5a4a..36c5fbbd4a 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -732,7 +732,9 @@ static void medium_loop() // Do an extra baro read // --------------------- +#if HIL_MODE != HIL_MODE_ATTITUDE barometer.Read(); +#endif slow_loop(); break; From 19d5e983ba5b80c40780ee84fc2308d6cd6d4229 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 2 Nov 2011 09:14:10 +1100 Subject: [PATCH 11/14] autotest: fixed path to SIL binary --- Tools/autotest/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/autotest/util.py b/Tools/autotest/util.py index df6fd981be..f08421044f 100644 --- a/Tools/autotest/util.py +++ b/Tools/autotest/util.py @@ -50,7 +50,7 @@ def build_SIL(atype): def start_SIL(atype): '''launch a SIL instance''' - ret = pexpect.spawn('tmp/%s.build/%s.elf' % (atype, atype), + ret = pexpect.spawn(reltopdir('tmp/%s.build/%s.elf' % (atype, atype)), logfile=sys.stdout, timeout=5) ret.expect('Waiting for connection') return ret From e7671178b3ac2f09d9d48b2eb3f797d11bd13513 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 2 Nov 2011 09:20:46 +1100 Subject: [PATCH 12/14] desktop: fixed TCP buffering issue with HIL the TCP layer was buffering the servo updates, which caused very poor HIL flight --- libraries/Desktop/support/FastSerial.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/Desktop/support/FastSerial.cpp b/libraries/Desktop/support/FastSerial.cpp index 04623fa8d0..79dbc1a78a 100644 --- a/libraries/Desktop/support/FastSerial.cpp +++ b/libraries/Desktop/support/FastSerial.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include "desktop.h" #define LISTEN_BASE_PORT 5760 @@ -131,6 +132,7 @@ static void tcp_start_connection(unsigned int serial_port, bool wait_for_connect fprintf(stderr, "accept() error - %s", strerror(errno)); exit(1); } + setsockopt(s->fd, SOL_TCP, TCP_NODELAY, &one, sizeof(one)); s->connected = true; } } @@ -170,7 +172,9 @@ static void check_connection(struct tcp_state *s) if (select_check(s->listen_fd)) { s->fd = accept(s->listen_fd, NULL, NULL); if (s->fd != -1) { + int one = 1; s->connected = true; + setsockopt(s->fd, SOL_TCP, TCP_NODELAY, &one, sizeof(one)); printf("New connection on serial port %u\n", s->serial_port); } } From b6dcfa416b8c3865d4fb2add538cf8096dfc513d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 2 Nov 2011 09:21:21 +1100 Subject: [PATCH 13/14] autotest: a complete mission now flies with the TCP buffering fixed, the mission flies quite well with standard parameters --- Tools/autotest/ArduCopter.parm | 9 --------- Tools/autotest/arducopter.py | 5 +++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Tools/autotest/ArduCopter.parm b/Tools/autotest/ArduCopter.parm index 3465fc56d2..5e9a2a45be 100644 --- a/Tools/autotest/ArduCopter.parm +++ b/Tools/autotest/ArduCopter.parm @@ -29,12 +29,3 @@ FLTMODE3 2 FLTMODE4 6 FLTMODE5 5 FLTMODE6 0 -NAV_LAT_I 0 -NAV_LON_I 0 -NAV_LAT_P 1 -NAV_LON_P 1 -STB_PIT_P 2 -STB_RLL_P 2 -XTRACK_P 1 -RATE_PIT_P 0.1 -RATE_RLL_P 0.1 diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index a98c8bf337..593ad682fe 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -229,7 +229,7 @@ def land(mavproxy, mav, timeout=60): return False -def fly_mission(mavproxy, mav, filename, timeout=120): +def fly_mission(mavproxy, mav, filename): '''fly a mission from a file''' startloc = current_location(mav) mavproxy.send('wp load %s\n' % filename) @@ -239,7 +239,7 @@ def fly_mission(mavproxy, mav, filename, timeout=120): mavproxy.send('switch 1\n') # auto mode mavproxy.expect('AUTO>') wait_distance(mav, 30, timeout=120) - wait_location(mav, startloc, timeout=300) + wait_location(mav, startloc, timeout=600) def setup_rc(mavproxy): @@ -306,6 +306,7 @@ def fly_ArduCopter(): loiter(mavproxy, mav) land(mavproxy, mav) fly_mission(mavproxy, mav, os.path.join(testdir, "mission1.txt")) + land(mavproxy, mav) disarm_motors(mavproxy) except pexpect.TIMEOUT, e: failed = True From 40c87dd295b4f5f538a204fde893104923081409 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 2 Nov 2011 10:26:24 +1100 Subject: [PATCH 14/14] fixed home location --- Tools/autotest/arducopter.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index 593ad682fe..2e0807a088 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -10,6 +10,8 @@ import mavutil HOME_LOCATION='-35.362938,149.165085,650,270' +homeloc = None + # a list of pexpect objects to read while waiting for # messages. This keeps the output to stdout flowing expect_list = [] @@ -231,7 +233,7 @@ def land(mavproxy, mav, timeout=60): def fly_mission(mavproxy, mav, filename): '''fly a mission from a file''' - startloc = current_location(mav) + global homeloc mavproxy.send('wp load %s\n' % filename) mavproxy.expect('flight plan received') mavproxy.send('wp list\n') @@ -239,7 +241,7 @@ def fly_mission(mavproxy, mav, filename): mavproxy.send('switch 1\n') # auto mode mavproxy.expect('AUTO>') wait_distance(mav, 30, timeout=120) - wait_location(mav, startloc, timeout=600) + wait_location(mav, homeloc, timeout=600) def setup_rc(mavproxy): @@ -252,7 +254,7 @@ def setup_rc(mavproxy): def fly_ArduCopter(): '''fly ArduCopter in SIL''' - global expect_list + global expect_list, homeloc util.rmfile('eeprom.bin') sil = util.start_SIL('ArduCopter') @@ -298,8 +300,9 @@ def fly_ArduCopter(): failed = False try: mav.wait_heartbeat() - mav.recv_match(type='GPS_RAW') + mav.recv_match(type='GPS_RAW', blocking=True) setup_rc(mavproxy) + homeloc = current_location(mav) arm_motors(mavproxy) takeoff(mavproxy, mav) fly_square(mavproxy, mav)