forked from Archive/PX4-Autopilot
Switched to using c-type arrays
This commit is contained in:
parent
9bb8b12f43
commit
e53c2ab985
|
@ -40,8 +40,6 @@
|
|||
#ifndef NAVIGATOR_H
|
||||
#define NAVIGATOR_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <systemlib/perf_counter.h>
|
||||
|
||||
#include <controllib/blocks.hpp>
|
||||
|
@ -60,6 +58,8 @@
|
|||
#include "rtl.h"
|
||||
#include "geofence.h"
|
||||
|
||||
#define NAVIGATOR_MODE_ARRAY_SIZE 3
|
||||
|
||||
class Navigator : public control::SuperBlock
|
||||
{
|
||||
public:
|
||||
|
@ -155,7 +155,7 @@ private:
|
|||
Loiter _loiter; /**< class that handles loiter */
|
||||
RTL _rtl; /**< class that handles RTL */
|
||||
|
||||
std::vector<NavigatorMode*> _navigation_mode_vector;
|
||||
NavigatorMode *_navigation_mode_array[NAVIGATOR_MODE_ARRAY_SIZE]; /**< array of navigation modes */
|
||||
|
||||
bool _is_in_loiter; /**< flags if current position SP can be used to loiter */
|
||||
bool _update_triplet; /**< flags if position SP triplet needs to be published */
|
||||
|
|
|
@ -126,9 +126,9 @@ Navigator::Navigator() :
|
|||
_param_takeoff_acceptance_radius(this, "TF_ACC_RAD")
|
||||
{
|
||||
/* Create a list of our possible navigation types */
|
||||
_navigation_mode_vector.push_back(&_mission);
|
||||
_navigation_mode_vector.push_back(&_loiter);
|
||||
_navigation_mode_vector.push_back(&_rtl);
|
||||
_navigation_mode_array[0] = &_mission;
|
||||
_navigation_mode_array[1] = &_loiter;
|
||||
_navigation_mode_array[2] = &_rtl;
|
||||
|
||||
updateParams();
|
||||
}
|
||||
|
@ -369,11 +369,11 @@ Navigator::task_main()
|
|||
}
|
||||
|
||||
/* iterate through navigation modes and set active/inactive for each */
|
||||
for(unsigned int i = 0; i < _navigation_mode_vector.size(); i++) {
|
||||
if (_navigation_mode == _navigation_mode_vector[i]) {
|
||||
_update_triplet = _navigation_mode_vector[i]->on_active(&_pos_sp_triplet);
|
||||
for(unsigned int i = 0; i < NAVIGATOR_MODE_ARRAY_SIZE; i++) {
|
||||
if (_navigation_mode == _navigation_mode_array[i]) {
|
||||
_update_triplet = _navigation_mode_array[i]->on_active(&_pos_sp_triplet);
|
||||
} else {
|
||||
_navigation_mode_vector[i]->on_inactive();
|
||||
_navigation_mode_array[i]->on_inactive();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue