mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 20:53:35 +08:00
FlightTasks: created an array for all tasks and a method to set the general input pointers for all of them
This commit is contained in:
@@ -57,6 +57,15 @@ public:
|
||||
*/
|
||||
int update() { return Orbit.update(); };
|
||||
|
||||
void set_input_pointers(vehicle_local_position_s *vehicle_local_position,
|
||||
manual_control_setpoint_s *manual_control_setpoint)
|
||||
{
|
||||
for (int i = 0; i < _task_count; i++) {
|
||||
_tasks[i]->set_vehicle_local_position_pointer(vehicle_local_position);
|
||||
_tasks[i]->set_manual_control_setpoint_pointer(manual_control_setpoint);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Call to get result of the task execution
|
||||
* @return pointer to
|
||||
@@ -64,7 +73,9 @@ public:
|
||||
const vehicle_local_position_setpoint_s *get_position_setpoint() const { return Orbit.get_position_setpoint(); };
|
||||
|
||||
private:
|
||||
static const int _task_count = 1;
|
||||
|
||||
FlightTaskOrbit Orbit;
|
||||
FlightTask *_tasks[_task_count] = {&Orbit};
|
||||
|
||||
};
|
||||
|
||||
@@ -41,9 +41,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <uORB/topics/manual_control_setpoint.h>
|
||||
#include <uORB/topics/vehicle_local_position_setpoint.h>
|
||||
|
||||
class FlightTask
|
||||
{
|
||||
public:
|
||||
@@ -82,12 +79,6 @@ public:
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the resulting setpoints of the task execution via pointer
|
||||
* @return pointer to setpoint struct
|
||||
*/
|
||||
const vehicle_local_position_setpoint_s *get_position_setpoint() const { return &_vehicle_position_setpoint; };
|
||||
|
||||
/**
|
||||
* Set vehicle local position data pointer
|
||||
* @param pointer to vehicle local position
|
||||
@@ -100,6 +91,12 @@ public:
|
||||
*/
|
||||
void set_manual_control_setpoint_pointer(const manual_control_setpoint_s *manual_control_setpoint) { _manual_control_setpoint = manual_control_setpoint; };
|
||||
|
||||
/**
|
||||
* Get the resulting setpoints of the task execution via pointer
|
||||
* @return pointer to setpoint struct
|
||||
*/
|
||||
const vehicle_local_position_setpoint_s *get_position_setpoint() const { return &_vehicle_position_setpoint; };
|
||||
|
||||
protected:
|
||||
|
||||
float _get_time() { return _time; }
|
||||
|
||||
Reference in New Issue
Block a user