AP_SmartRTL: removed create() method for objects

See discussion here:

  https://github.com/ArduPilot/ardupilot/issues/7331

we were getting some uninitialised variables. While it only showed up in
AP_SbusOut, it means we can't be sure it won't happen on other objects,
so safest to remove the approach

Thanks to assistance from Lucas, Peter and Francisco
This commit is contained in:
Andrew Tridgell 2017-12-13 12:06:14 +11:00
parent 1cdbb09466
commit 003851a5c1

View File

@ -12,26 +12,25 @@
const AP_HAL::HAL &hal = AP_HAL::get_HAL(); const AP_HAL::HAL &hal = AP_HAL::get_HAL();
// INS and Baro declaration // INS and Baro declaration
static AP_InertialSensor ins = AP_InertialSensor::create(); static AP_InertialSensor ins;
static Compass compass = Compass::create(); static Compass compass;
static AP_GPS gps = AP_GPS::create(); static AP_GPS gps;
static AP_Baro barometer = AP_Baro::create(); static AP_Baro barometer;
static AP_SerialManager serial_manager = AP_SerialManager::create(); static AP_SerialManager serial_manager;
class DummyVehicle { class DummyVehicle {
public: public:
RangeFinder rangefinder = RangeFinder::create(serial_manager, ROTATION_PITCH_270); RangeFinder rangefinder{serial_manager, ROTATION_PITCH_270};
NavEKF2 EKF2 = NavEKF2::create(&ahrs, barometer, rangefinder); NavEKF2 EKF2{&ahrs, barometer, rangefinder};
NavEKF3 EKF3 = NavEKF3::create(&ahrs, barometer, rangefinder); NavEKF3 EKF3{&ahrs, barometer, rangefinder};
AP_AHRS_NavEKF ahrs = AP_AHRS_NavEKF::create(ins, barometer, gps, EKF2, EKF3, AP_AHRS_NavEKF ahrs{ins, barometer, gps, EKF2, EKF3, AP_AHRS_NavEKF::FLAG_ALWAYS_USE_EKF};
AP_AHRS_NavEKF::FLAG_ALWAYS_USE_EKF);
}; };
static DummyVehicle vehicle; static DummyVehicle vehicle;
AP_AHRS_NavEKF &ahrs(vehicle.ahrs); AP_AHRS_NavEKF &ahrs(vehicle.ahrs);
AP_SmartRTL smart_rtl{ahrs, true}; AP_SmartRTL smart_rtl{ahrs, true};
AP_BoardConfig board_config = AP_BoardConfig::create(); AP_BoardConfig board_config;
void setup(); void setup();
void loop(); void loop();