Browse Source

Sub: Update land mode to move up instead of down.

master
jaxxzer 9 years ago committed by Andrew Tridgell
parent
commit
b08e1e6919
  1. 6
      ArduSub/control_land.cpp
  2. 2
      ArduSub/land_detector.cpp

6
ArduSub/control_land.cpp

@ -215,10 +215,10 @@ float Sub::get_land_descent_speed() @@ -215,10 +215,10 @@ float Sub::get_land_descent_speed()
bool sonar_ok = false;
#endif
// if we are above 10m and the sonar does not sense anything perform regular alt hold descent
if (pos_control.get_pos_target().z >= pv_alt_above_origin(LAND_START_ALT) && !(sonar_ok && sonar_alt_health >= SONAR_ALT_HEALTH_MAX)) {
return pos_control.get_speed_down();
if (pos_control.get_pos_target().z <= pv_alt_above_origin(LAND_START_ALT) && !(sonar_ok && sonar_alt_health >= SONAR_ALT_HEALTH_MAX)) {
return pos_control.get_speed_up();
}else{
return -abs(g.land_speed);
return abs(g.land_speed);
}
}

2
ArduSub/land_detector.cpp

@ -24,7 +24,7 @@ void Sub::update_land_and_crash_detectors() @@ -24,7 +24,7 @@ void Sub::update_land_and_crash_detectors()
// called at MAIN_LOOP_RATE
void Sub::update_land_detector()
{
if(barometer.get_altitude() > SURFACE_END_DEPTH && ap.throttle_zero) {
if(barometer.num_instances() > 1 && barometer.get_altitude() > SURFACE_END_DEPTH && ap.throttle_zero) {
set_land_complete(true);
} else {
set_land_complete(false);

Loading…
Cancel
Save