Line data Source code
1 : #pragma once 2 : 3 : #include "AP_RangeFinder_config.h" 4 : 5 : #if AP_RANGEFINDER_LUA_ENABLED 6 : 7 : #include "AP_RangeFinder_Backend.h" 8 : 9 : // Data timeout 10 : #define AP_RANGEFINDER_LUA_TIMEOUT_MS 500 11 : 12 : class AP_RangeFinder_Lua : public AP_RangeFinder_Backend 13 : { 14 : public: 15 : 16 : // constructor 17 : AP_RangeFinder_Lua(RangeFinder::RangeFinder_State &_state, AP_RangeFinder_Params &_params); 18 : 19 : // update state 20 : void update(void) override; 21 : 22 : // Get update from Lua script 23 : bool handle_script_msg(float dist_m) override; 24 : bool handle_script_msg(const RangeFinder::RangeFinder_State &state_arg) override; 25 : 26 8354 : MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override { 27 8354 : return MAV_DISTANCE_SENSOR_UNKNOWN; 28 : } 29 : 30 : private: 31 : 32 : RangeFinder::RangeFinder_State _state_pending = {}; 33 : }; 34 : 35 : #endif // AP_RANGEFINDER_LUA_ENABLED