mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
navigator precland initialize all fields
- fixes coverity CID 264259
This commit is contained in:
@@ -61,18 +61,7 @@
|
|||||||
|
|
||||||
PrecLand::PrecLand(Navigator *navigator) :
|
PrecLand::PrecLand(Navigator *navigator) :
|
||||||
MissionBlock(navigator),
|
MissionBlock(navigator),
|
||||||
ModuleParams(navigator),
|
ModuleParams(navigator)
|
||||||
_targetPoseSub(0),
|
|
||||||
_target_pose_valid(false),
|
|
||||||
_state_start_time(0),
|
|
||||||
_search_cnt(0),
|
|
||||||
_approach_alt(0)
|
|
||||||
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
PrecLand::on_inactive()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +116,7 @@ PrecLand::on_active()
|
|||||||
_target_pose_valid = true;
|
_target_pose_valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hrt_absolute_time() - _target_pose.timestamp > (uint64_t)(_param_timeout.get()*SEC2USEC)) {
|
if ((hrt_elapsed_time(&_target_pose.timestamp) / 1e-6f) > _param_timeout.get()) {
|
||||||
_target_pose_valid = false;
|
_target_pose_valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,7 +267,6 @@ PrecLand::run_state_horizontal_approach()
|
|||||||
pos_sp_triplet->current.type = position_setpoint_s::SETPOINT_TYPE_POSITION;
|
pos_sp_triplet->current.type = position_setpoint_s::SETPOINT_TYPE_POSITION;
|
||||||
|
|
||||||
_navigator->set_position_setpoint_triplet_updated();
|
_navigator->set_position_setpoint_triplet_updated();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -316,7 +304,6 @@ PrecLand::run_state_descend_above_target()
|
|||||||
pos_sp_triplet->current.type = position_setpoint_s::SETPOINT_TYPE_LAND;
|
pos_sp_triplet->current.type = position_setpoint_s::SETPOINT_TYPE_LAND;
|
||||||
|
|
||||||
_navigator->set_position_setpoint_triplet_updated();
|
_navigator->set_position_setpoint_triplet_updated();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -67,14 +67,10 @@ class PrecLand : public MissionBlock, public ModuleParams
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PrecLand(Navigator *navigator);
|
PrecLand(Navigator *navigator);
|
||||||
|
~PrecLand() override = default;
|
||||||
|
|
||||||
~PrecLand() = default;
|
void on_activation() override;
|
||||||
|
void on_active() override;
|
||||||
virtual void on_inactive();
|
|
||||||
|
|
||||||
virtual void on_activation();
|
|
||||||
|
|
||||||
virtual void on_active();
|
|
||||||
|
|
||||||
void set_mode(PrecLandMode mode) { _mode = mode; };
|
void set_mode(PrecLandMode mode) { _mode = mode; };
|
||||||
|
|
||||||
@@ -103,22 +99,26 @@ private:
|
|||||||
void slewrate(float &sp_x, float &sp_y);
|
void slewrate(float &sp_x, float &sp_y);
|
||||||
|
|
||||||
landing_target_pose_s _target_pose{}; /**< precision landing target position */
|
landing_target_pose_s _target_pose{}; /**< precision landing target position */
|
||||||
int _targetPoseSub;
|
|
||||||
bool _target_pose_valid; /**< wether we have received a landing target position message */
|
int _targetPoseSub{-1};
|
||||||
|
bool _target_pose_valid{false}; /**< wether we have received a landing target position message */
|
||||||
|
|
||||||
struct map_projection_reference_s _map_ref {}; /**< reference for local/global projections */
|
struct map_projection_reference_s _map_ref {}; /**< reference for local/global projections */
|
||||||
uint64_t _state_start_time; /**< time when we entered current state */
|
|
||||||
uint64_t _last_slewrate_time; /**< time when we last limited setpoint changes */
|
uint64_t _state_start_time{0}; /**< time when we entered current state */
|
||||||
uint64_t _target_acquired_time; /**< time when we first saw the landing target during search */
|
uint64_t _last_slewrate_time{0}; /**< time when we last limited setpoint changes */
|
||||||
uint64_t _point_reached_time; /**< time when we reached a setpoint */
|
uint64_t _target_acquired_time{0}; /**< time when we first saw the landing target during search */
|
||||||
int _search_cnt; /**< counter of how many times we had to search for the landing target */
|
uint64_t _point_reached_time{0}; /**< time when we reached a setpoint */
|
||||||
float _approach_alt; /**< altitude at which to stay during horizontal approach */
|
|
||||||
|
int _search_cnt{0}; /**< counter of how many times we had to search for the landing target */
|
||||||
|
float _approach_alt{0.0f}; /**< altitude at which to stay during horizontal approach */
|
||||||
|
|
||||||
matrix::Vector2f _sp_pev;
|
matrix::Vector2f _sp_pev;
|
||||||
matrix::Vector2f _sp_pev_prev;
|
matrix::Vector2f _sp_pev_prev;
|
||||||
|
|
||||||
PrecLandState _state;
|
PrecLandState _state{PrecLandState::Start};
|
||||||
|
|
||||||
PrecLandMode _mode;
|
PrecLandMode _mode{PrecLandMode::Opportunistic};
|
||||||
|
|
||||||
DEFINE_PARAMETERS(
|
DEFINE_PARAMETERS(
|
||||||
(ParamFloat<px4::params::PLD_BTOUT>) _param_timeout,
|
(ParamFloat<px4::params::PLD_BTOUT>) _param_timeout,
|
||||||
|
|||||||
Reference in New Issue
Block a user