mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 15:13:34 +08:00
geo: refactoring on comments and usage
This commit is contained in:
@@ -135,8 +135,8 @@ void FollowTarget::on_active()
|
||||
// get distance to target
|
||||
|
||||
target_ref.initReference(_navigator->get_global_position()->lat, _navigator->get_global_position()->lon);
|
||||
target_ref.project(_current_target_motion.lat, _current_target_motion.lon, _target_distance(0),
|
||||
_target_distance(1));
|
||||
target_ref.project(_current_target_motion.lat, _current_target_motion.lon,
|
||||
_target_distance(0), _target_distance(1));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ private:
|
||||
PolygonInfo *_polygons{nullptr};
|
||||
int _num_polygons{0};
|
||||
|
||||
MapProjection _projection_reference = {}; ///< reference to convert (lon, lat) to local [m]
|
||||
MapProjection _projection_reference{}; ///< class to convert (lon, lat) to local [m]
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
(ParamInt<px4::params::GF_ACTION>) _param_gf_action,
|
||||
|
||||
@@ -278,11 +278,8 @@ PrecLand::run_state_horizontal_approach()
|
||||
slewrate(x, y);
|
||||
|
||||
// XXX need to transform to GPS coords because mc_pos_control only looks at that
|
||||
double lat, lon;
|
||||
_map_ref.reproject(x, y, lat, lon);
|
||||
_map_ref.reproject(x, y, pos_sp_triplet->current.lat, pos_sp_triplet->current.lon);
|
||||
|
||||
pos_sp_triplet->current.lat = lat;
|
||||
pos_sp_triplet->current.lon = lon;
|
||||
pos_sp_triplet->current.alt = _approach_alt;
|
||||
pos_sp_triplet->current.type = position_setpoint_s::SETPOINT_TYPE_POSITION;
|
||||
|
||||
@@ -315,11 +312,7 @@ PrecLand::run_state_descend_above_target()
|
||||
}
|
||||
|
||||
// XXX need to transform to GPS coords because mc_pos_control only looks at that
|
||||
double lat, lon;
|
||||
_map_ref.reproject(_target_pose.x_abs, _target_pose.y_abs, lat, lon);
|
||||
|
||||
pos_sp_triplet->current.lat = lat;
|
||||
pos_sp_triplet->current.lon = lon;
|
||||
_map_ref.reproject(_target_pose.x_abs, _target_pose.y_abs, pos_sp_triplet->current.lat, pos_sp_triplet->current.lon);
|
||||
|
||||
pos_sp_triplet->current.type = position_setpoint_s::SETPOINT_TYPE_LAND;
|
||||
|
||||
@@ -555,8 +548,8 @@ void PrecLand::slewrate(float &sp_x, float &sp_y)
|
||||
dt = 50000 / SEC2USEC;
|
||||
|
||||
// set a best guess for previous setpoints for smooth transition
|
||||
_map_ref.project(_navigator->get_position_setpoint_triplet()->current.lat,
|
||||
_navigator->get_position_setpoint_triplet()->current.lon, _sp_pev(0), _sp_pev(1));
|
||||
_sp_pev = _map_ref.project(_navigator->get_position_setpoint_triplet()->current.lat,
|
||||
_navigator->get_position_setpoint_triplet()->current.lon);
|
||||
_sp_pev_prev(0) = _sp_pev(0) - _navigator->get_local_position()->vx * dt;
|
||||
_sp_pev_prev(1) = _sp_pev(1) - _navigator->get_local_position()->vy * dt;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ private:
|
||||
bool _target_pose_valid{false}; /**< whether we have received a landing target position message */
|
||||
bool _target_pose_updated{false}; /**< wether the landing target position message is updated */
|
||||
|
||||
MapProjection _map_ref {}; /**< reference for local/global projections */
|
||||
MapProjection _map_ref{}; /**< class for local/global projections */
|
||||
|
||||
uint64_t _state_start_time{0}; /**< time when we entered current state */
|
||||
uint64_t _last_slewrate_time{0}; /**< time when we last limited setpoint changes */
|
||||
|
||||
Reference in New Issue
Block a user