diff --git a/libraries/AP_L1_Control/AP_L1_Control.h b/libraries/AP_L1_Control/AP_L1_Control.h index ad2f3e25a3..61f75776a8 100644 --- a/libraries/AP_L1_Control/AP_L1_Control.h +++ b/libraries/AP_L1_Control/AP_L1_Control.h @@ -21,13 +21,16 @@ class AP_L1_Control : public AP_Navigation { public: - AP_L1_Control(AP_AHRS &ahrs, const AP_SpdHgtControl * spdHgtControl) - : _ahrs(ahrs), - _spdHgtControl(spdHgtControl) - { - AP_Param::setup_object_defaults(this, var_info); + static AP_L1_Control create(AP_AHRS &ahrs, const AP_SpdHgtControl *spdHgtControl) { + return AP_L1_Control{ahrs, spdHgtControl}; } + constexpr AP_L1_Control(AP_L1_Control &&other) = default; + + /* Do not allow copies */ + AP_L1_Control(const AP_L1_Control &other) = delete; + AP_L1_Control &operator=(const AP_L1_Control&) = delete; + /* see AP_Navigation.h for the definitions and units of these * functions */ int32_t nav_roll_cd(void) const; @@ -72,6 +75,13 @@ public: } private: + AP_L1_Control(AP_AHRS &ahrs, const AP_SpdHgtControl *spdHgtControl) + : _ahrs(ahrs) + , _spdHgtControl(spdHgtControl) + { + AP_Param::setup_object_defaults(this, var_info); + } + // reference to the AHRS object AP_AHRS &_ahrs;