mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-26 01:33:56 -04:00
Mount_Backend: add backend class
This commit is contained in:
parent
88db50c3a7
commit
7df2892b8d
66
libraries/AP_Mount/AP_Mount_Backend.h
Normal file
66
libraries/AP_Mount/AP_Mount_Backend.h
Normal file
@ -0,0 +1,66 @@
|
||||
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
||||
/*
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
Mount driver backend class. Each supported mount type
|
||||
needs to have an object derived from this class.
|
||||
*/
|
||||
|
||||
#ifndef __AP_MOUNT_BACKEND_H__
|
||||
#define __AP_MOUNT_BACKEND_H__
|
||||
|
||||
#include <AP_Common.h>
|
||||
#include <AP_Mount.h>
|
||||
|
||||
class AP_Mount_Backend
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
AP_Mount_Backend(AP_Mount &frontend, uint8_t instance) :
|
||||
_frontend(frontend),
|
||||
_instance(instance)
|
||||
{}
|
||||
|
||||
// Virtual destructor
|
||||
virtual ~AP_Mount_Backend(void) {}
|
||||
|
||||
// init - performs any required initialisation for this instance
|
||||
virtual void init() = 0;
|
||||
|
||||
// update mount position - should be called periodically
|
||||
virtual void update() = 0;
|
||||
|
||||
// has_pan_control - returns true if this mount can control it's pan (required for multicopters)
|
||||
virtual bool has_pan_control() const = 0;
|
||||
|
||||
// set_roi_target - sets target location that mount should attempt to point towards
|
||||
virtual void set_roi_target(const struct Location &target_loc) = 0;
|
||||
|
||||
// configure_msg - process MOUNT_CONFIGURE messages received from GCS
|
||||
virtual void configure_msg(mavlink_message_t* msg) {};
|
||||
|
||||
// control_msg - process MOUNT_CONTROL messages received from GCS
|
||||
virtual void control_msg(mavlink_message_t* msg) {};
|
||||
|
||||
// status_msg - called to allow mounts to send their status to GCS via MAVLink
|
||||
virtual void status_msg(mavlink_channel_t chan) {};
|
||||
|
||||
protected:
|
||||
AP_Mount &_frontend; // reference to the front end which holds parameters
|
||||
uint8_t _instance; // this instance's number
|
||||
};
|
||||
|
||||
#endif // __AP_MOUNT_BACKEND_H__
|
Loading…
Reference in New Issue
Block a user