Line data Source code
1 : /* 2 : Base class for simulated mount (gimbal) serial peripherals 3 : */ 4 : 5 : #pragma once 6 : 7 : #include "SIM_config.h" 8 : 9 : #if AP_SIM_MOUNT_ENABLED 10 : 11 : #include "SIM_SerialDevice.h" 12 : 13 : namespace SITL { 14 : 15 : /* 16 : common base for all simulated mount backends. Inherits SerialDevice 17 : so subclasses can be registered with create_serial_sim() and driven 18 : via a serial port. 19 : */ 20 : class Mount : public SerialDevice { 21 : public: 22 : 23 : // called each simulation step 24 : virtual void update(const class Aircraft &aircraft) = 0; 25 : 26 : // called before add_gimbal_sim() so subclasses know their 27 : // 0-based instance index (used, e.g., to select a MAVLink component ID) 28 5 : virtual void set_instance(uint8_t instance) { _instance = instance; } 29 : 30 : protected: 31 : uint8_t _instance; 32 : }; 33 : 34 : } // namespace SITL 35 : 36 : #endif // AP_SIM_MOUNT_ENABLED