forked from Archive/PX4-Autopilot
navigator: rename update and reset calls to on_active and on_inactive
This commit is contained in:
parent
59ae8cc054
commit
3b39a8a789
|
@ -72,7 +72,7 @@ Mission::Mission(Navigator *navigator, const char *name) :
|
|||
/* load initial params */
|
||||
updateParams();
|
||||
/* set initial mission items */
|
||||
reset();
|
||||
on_inactive();
|
||||
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ Mission::~Mission()
|
|||
}
|
||||
|
||||
void
|
||||
Mission::reset()
|
||||
Mission::on_inactive()
|
||||
{
|
||||
_first_run = true;
|
||||
|
||||
|
@ -100,7 +100,7 @@ Mission::reset()
|
|||
}
|
||||
|
||||
bool
|
||||
Mission::update(struct position_setpoint_triplet_s *pos_sp_triplet)
|
||||
Mission::on_active(struct position_setpoint_triplet_s *pos_sp_triplet)
|
||||
{
|
||||
bool updated = false;
|
||||
|
||||
|
|
|
@ -78,12 +78,12 @@ public:
|
|||
/**
|
||||
* This function is called while the mode is inactive
|
||||
*/
|
||||
virtual void reset();
|
||||
virtual void on_inactive();
|
||||
|
||||
/**
|
||||
* This function is called while the mode is active
|
||||
*/
|
||||
virtual bool update(struct position_setpoint_triplet_s *pos_sp_triplet);
|
||||
virtual bool on_active(struct position_setpoint_triplet_s *pos_sp_triplet);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
|
@ -365,21 +365,21 @@ Navigator::task_main()
|
|||
|
||||
/* TODO: make list of modes and loop through it */
|
||||
if (_navigation_mode == &_mission) {
|
||||
_update_triplet = _mission.update(&_pos_sp_triplet);
|
||||
_update_triplet = _mission.on_active(&_pos_sp_triplet);
|
||||
} else {
|
||||
_mission.reset();
|
||||
_mission.on_inactive();
|
||||
}
|
||||
|
||||
if (_navigation_mode == &_rtl) {
|
||||
_update_triplet = _rtl.update(&_pos_sp_triplet);
|
||||
_update_triplet = _rtl.on_active(&_pos_sp_triplet);
|
||||
} else {
|
||||
_rtl.reset();
|
||||
_rtl.on_inactive();
|
||||
}
|
||||
|
||||
if (_navigation_mode == &_loiter) {
|
||||
_update_triplet = _loiter.update(&_pos_sp_triplet);
|
||||
_update_triplet = _loiter.on_active(&_pos_sp_triplet);
|
||||
} else {
|
||||
_loiter.reset();
|
||||
_loiter.on_inactive();
|
||||
}
|
||||
|
||||
/* if nothing is running, set position setpoint triplet invalid */
|
||||
|
|
|
@ -48,7 +48,7 @@ NavigatorMode::NavigatorMode(Navigator *navigator, const char *name) :
|
|||
/* load initial params */
|
||||
updateParams();
|
||||
/* set initial mission items */
|
||||
reset();
|
||||
on_inactive();
|
||||
}
|
||||
|
||||
NavigatorMode::~NavigatorMode()
|
||||
|
@ -56,13 +56,13 @@ NavigatorMode::~NavigatorMode()
|
|||
}
|
||||
|
||||
void
|
||||
NavigatorMode::reset()
|
||||
NavigatorMode::on_inactive()
|
||||
{
|
||||
_first_run = true;
|
||||
}
|
||||
|
||||
bool
|
||||
NavigatorMode::update(struct position_setpoint_triplet_s *pos_sp_triplet)
|
||||
NavigatorMode::on_active(struct position_setpoint_triplet_s *pos_sp_triplet)
|
||||
{
|
||||
pos_sp_triplet->current.valid = false;
|
||||
_first_run = false;
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
/**
|
||||
* This function is called while the mode is inactive
|
||||
*/
|
||||
virtual void reset();
|
||||
virtual void on_inactive();
|
||||
|
||||
/**
|
||||
* This function is called while the mode is active
|
||||
|
@ -76,7 +76,7 @@ public:
|
|||
* @param position setpoint triplet to set
|
||||
* @return true if position setpoint triplet has been changed
|
||||
*/
|
||||
virtual bool update(struct position_setpoint_triplet_s *pos_sp_triplet);
|
||||
virtual bool on_active(struct position_setpoint_triplet_s *pos_sp_triplet);
|
||||
|
||||
protected:
|
||||
Navigator *_navigator;
|
||||
|
|
|
@ -64,7 +64,7 @@ RTL::RTL(Navigator *navigator, const char *name) :
|
|||
/* load initial params */
|
||||
updateParams();
|
||||
/* initial reset */
|
||||
reset();
|
||||
on_inactive();
|
||||
}
|
||||
|
||||
RTL::~RTL()
|
||||
|
@ -72,14 +72,14 @@ RTL::~RTL()
|
|||
}
|
||||
|
||||
void
|
||||
RTL::reset()
|
||||
RTL::on_inactive()
|
||||
{
|
||||
_first_run = true;
|
||||
_rtl_state = RTL_STATE_NONE;
|
||||
}
|
||||
|
||||
bool
|
||||
RTL::update(struct position_setpoint_triplet_s *pos_sp_triplet)
|
||||
RTL::on_active(struct position_setpoint_triplet_s *pos_sp_triplet)
|
||||
{
|
||||
bool updated = false;
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
/**
|
||||
* This function is called while the mode is inactive
|
||||
*/
|
||||
void reset();
|
||||
void on_inactive();
|
||||
|
||||
/**
|
||||
* This function is called while the mode is active
|
||||
|
@ -78,7 +78,7 @@ public:
|
|||
* @param position setpoint triplet that needs to be set
|
||||
* @return true if updated
|
||||
*/
|
||||
bool update(position_setpoint_triplet_s *pos_sp_triplet);
|
||||
bool on_active(position_setpoint_triplet_s *pos_sp_triplet);
|
||||
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue