2023-02-15 03:12:26 -04:00
|
|
|
#pragma once
|
|
|
|
|
2023-06-23 22:09:28 -03:00
|
|
|
#include "AP_RangeFinder_config.h"
|
|
|
|
|
|
|
|
#if AP_RANGEFINDER_LUA_ENABLED
|
2023-02-15 03:12:26 -04:00
|
|
|
|
2023-06-23 22:09:28 -03:00
|
|
|
#include "AP_RangeFinder_Backend.h"
|
2023-02-15 03:12:26 -04:00
|
|
|
|
|
|
|
// Data timeout
|
|
|
|
#define AP_RANGEFINDER_LUA_TIMEOUT_MS 500
|
|
|
|
|
|
|
|
class AP_RangeFinder_Lua : public AP_RangeFinder_Backend
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
// constructor
|
|
|
|
AP_RangeFinder_Lua(RangeFinder::RangeFinder_State &_state, AP_RangeFinder_Params &_params);
|
|
|
|
|
|
|
|
// update state
|
|
|
|
void update(void) override;
|
|
|
|
|
|
|
|
// Get update from Lua script
|
|
|
|
bool handle_script_msg(float dist_m) override;
|
2023-11-26 01:03:55 -04:00
|
|
|
bool handle_script_msg(const RangeFinder::RangeFinder_State &state_arg) override;
|
2023-02-15 03:12:26 -04:00
|
|
|
|
|
|
|
MAV_DISTANCE_SENSOR _get_mav_distance_sensor_type() const override {
|
|
|
|
return MAV_DISTANCE_SENSOR_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2023-11-26 01:03:55 -04:00
|
|
|
RangeFinder::RangeFinder_State _state_pending = {};
|
2023-02-15 03:12:26 -04:00
|
|
|
};
|
|
|
|
|
2023-06-23 22:09:28 -03:00
|
|
|
#endif // AP_RANGEFINDER_LUA_ENABLED
|