mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 04:41:35 +08:00
L1 position controller: use double precision floating point for all lat/lon
This commit is contained in:
committed by
Lorenz Meier
parent
31a6edff07
commit
1981519aad
@@ -149,7 +149,7 @@ RoverPositionControl::vehicle_attitude_poll()
|
||||
}
|
||||
|
||||
bool
|
||||
RoverPositionControl::control_position(const matrix::Vector2f ¤t_position,
|
||||
RoverPositionControl::control_position(const matrix::Vector2d ¤t_position,
|
||||
const matrix::Vector3f &ground_speed, const position_setpoint_triplet_s &pos_sp_triplet)
|
||||
{
|
||||
float dt = 0.01; // Using non zero value to a avoid division by zero
|
||||
@@ -172,14 +172,14 @@ RoverPositionControl::control_position(const matrix::Vector2f ¤t_position,
|
||||
//bool was_circle_mode = _gnd_control.circle_mode();
|
||||
|
||||
/* current waypoint (the one currently heading for) */
|
||||
matrix::Vector2f curr_wp((float)pos_sp_triplet.current.lat, (float)pos_sp_triplet.current.lon);
|
||||
matrix::Vector2d curr_wp(pos_sp_triplet.current.lat, pos_sp_triplet.current.lon);
|
||||
|
||||
/* previous waypoint */
|
||||
matrix::Vector2f prev_wp = curr_wp;
|
||||
matrix::Vector2d prev_wp = curr_wp;
|
||||
|
||||
if (pos_sp_triplet.previous.valid) {
|
||||
prev_wp(0) = (float)pos_sp_triplet.previous.lat;
|
||||
prev_wp(1) = (float)pos_sp_triplet.previous.lon;
|
||||
prev_wp(0) = pos_sp_triplet.previous.lat;
|
||||
prev_wp(1) = pos_sp_triplet.previous.lon;
|
||||
}
|
||||
|
||||
matrix::Vector2f ground_speed_2d(ground_speed);
|
||||
@@ -433,7 +433,7 @@ RoverPositionControl::run()
|
||||
_pos_reset_counter = _global_pos.lat_lon_reset_counter;
|
||||
|
||||
matrix::Vector3f ground_speed(_local_pos.vx, _local_pos.vy, _local_pos.vz);
|
||||
matrix::Vector2f current_position((float)_global_pos.lat, (float)_global_pos.lon);
|
||||
matrix::Vector2d current_position(_global_pos.lat, _global_pos.lon);
|
||||
matrix::Vector3f current_velocity(_local_pos.vx, _local_pos.vy, _local_pos.vz);
|
||||
|
||||
if (!manual_mode && _control_mode.flag_control_position_enabled) {
|
||||
|
||||
@@ -150,7 +150,7 @@ private:
|
||||
} _pos_ctrl_state {STOPPING}; /// Position control state machine
|
||||
|
||||
/* previous waypoint */
|
||||
matrix::Vector2f _prev_wp{0.0f, 0.0f};
|
||||
matrix::Vector2d _prev_wp{0, 0};
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
(ParamFloat<px4::params::GND_L1_PERIOD>) _param_l1_period,
|
||||
@@ -190,7 +190,7 @@ private:
|
||||
/**
|
||||
* Control position.
|
||||
*/
|
||||
bool control_position(const matrix::Vector2f &global_pos, const matrix::Vector3f &ground_speed,
|
||||
bool control_position(const matrix::Vector2d &global_pos, const matrix::Vector3f &ground_speed,
|
||||
const position_setpoint_triplet_s &_pos_sp_triplet);
|
||||
void control_velocity(const matrix::Vector3f ¤t_velocity, const position_setpoint_triplet_s &pos_sp_triplet);
|
||||
void control_attitude(const vehicle_attitude_s &att, const vehicle_attitude_setpoint_s &att_sp);
|
||||
|
||||
Reference in New Issue
Block a user