|
|
|
@ -13,17 +13,17 @@ void Copter::fence_check()
@@ -13,17 +13,17 @@ void Copter::fence_check()
|
|
|
|
|
uint8_t new_breaches; // the type of fence that has been breached
|
|
|
|
|
uint8_t orig_breaches = fence.get_breaches(); |
|
|
|
|
|
|
|
|
|
// return immediately if motors are not armed
|
|
|
|
|
if(!motors.armed()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// give fence library our current distance from home in meters
|
|
|
|
|
fence.set_home_distance(home_distance*0.01f); |
|
|
|
|
|
|
|
|
|
// check for a breach
|
|
|
|
|
new_breaches = fence.check_fence(current_loc.alt/100.0f); |
|
|
|
|
|
|
|
|
|
// return immediately if motors are not armed
|
|
|
|
|
if(!motors.armed()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// if there is a new breach take action
|
|
|
|
|
if( new_breaches != AC_FENCE_TYPE_NONE ) { |
|
|
|
|
|
|
|
|
|