diff --git a/ArduCopter/Copter.cpp b/ArduCopter/Copter.cpp index 1d5eb92714..227cb63e56 100644 --- a/ArduCopter/Copter.cpp +++ b/ArduCopter/Copter.cpp @@ -66,9 +66,6 @@ Copter::Copter(void) mainLoop_count(0), rtl_loiter_start_time(0), auto_trim_counter(0), -#if AC_FENCE == ENABLED - fence(ahrs, inertial_nav), -#endif #if AC_AVOID_ENABLED == ENABLED avoid(ahrs, inertial_nav, fence, g2.proximity, &g2.beacon), #endif diff --git a/ArduCopter/Copter.h b/ArduCopter/Copter.h index 63195506e5..9806bf8096 100644 --- a/ArduCopter/Copter.h +++ b/ArduCopter/Copter.h @@ -554,8 +554,9 @@ private: // AC_Fence library to reduce fly-aways #if AC_FENCE == ENABLED - AC_Fence fence; + AC_Fence fence = AC_Fence::create(ahrs, inertial_nav); #endif + #if AC_AVOID_ENABLED == ENABLED AC_Avoid avoid; #endif diff --git a/ArduSub/Sub.cpp b/ArduSub/Sub.cpp index 19504a26ca..64d34725f8 100644 --- a/ArduSub/Sub.cpp +++ b/ArduSub/Sub.cpp @@ -59,9 +59,6 @@ Sub::Sub(void) pmTest1(0), fast_loopTimer(0), mainLoop_count(0), -#if AC_FENCE == ENABLED - fence(ahrs, inertial_nav), -#endif #if AC_RALLY == ENABLED rally(ahrs), #endif diff --git a/ArduSub/Sub.h b/ArduSub/Sub.h index d24cfa684b..97c142a41a 100644 --- a/ArduSub/Sub.h +++ b/ArduSub/Sub.h @@ -426,7 +426,7 @@ private: // AC_Fence library to reduce fly-aways #if AC_FENCE == ENABLED - AC_Fence fence; + AC_Fence fence = AC_Fence::create(ahrs, inertial_nav); #endif // Rally library