mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 05:13:33 +08:00
vehicle_local_position: rename yaw -> heading and add reset logic
- vehicle_global_position yaw removed (redundant)
This commit is contained in:
committed by
Mathieu Bresciani
parent
33fb9d0c62
commit
97fc1db768
@@ -196,7 +196,7 @@ void FollowTarget::on_active()
|
||||
_current_target_motion.lat,
|
||||
_current_target_motion.lon);
|
||||
|
||||
_yaw_rate = wrap_pi((_yaw_angle - _navigator->get_global_position()->yaw) / (dt_ms / 1000.0f));
|
||||
_yaw_rate = wrap_pi((_yaw_angle - _navigator->get_local_position()->heading) / (dt_ms / 1000.0f));
|
||||
|
||||
} else {
|
||||
_yaw_angle = _yaw_rate = NAN;
|
||||
@@ -229,7 +229,7 @@ void FollowTarget::on_active()
|
||||
// 3 degrees of facing target
|
||||
|
||||
if (PX4_ISFINITE(_yaw_rate)) {
|
||||
if (fabsf(fabsf(_yaw_angle) - fabsf(_navigator->get_local_position()->yaw)) < math::radians(3.0F)) {
|
||||
if (fabsf(fabsf(_yaw_angle) - fabsf(_navigator->get_local_position()->heading)) < math::radians(3.0F)) {
|
||||
_yaw_rate = NAN;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ Loiter::reposition()
|
||||
// convert mission item to current setpoint
|
||||
struct position_setpoint_triplet_s *pos_sp_triplet = _navigator->get_position_setpoint_triplet();
|
||||
pos_sp_triplet->current.velocity_valid = false;
|
||||
pos_sp_triplet->previous.yaw = _navigator->get_global_position()->yaw;
|
||||
pos_sp_triplet->previous.yaw = _navigator->get_local_position()->heading;
|
||||
pos_sp_triplet->previous.lat = _navigator->get_global_position()->lat;
|
||||
pos_sp_triplet->previous.lon = _navigator->get_global_position()->lon;
|
||||
pos_sp_triplet->previous.alt = _navigator->get_global_position()->alt;
|
||||
|
||||
@@ -711,7 +711,7 @@ Mission::set_mission_items()
|
||||
_mission_item.lat = _navigator->get_global_position()->lat;
|
||||
_mission_item.lon = _navigator->get_global_position()->lon;
|
||||
/* hold heading for takeoff items */
|
||||
_mission_item.yaw = _navigator->get_global_position()->yaw;
|
||||
_mission_item.yaw = _navigator->get_local_position()->heading;
|
||||
_mission_item.altitude = takeoff_alt;
|
||||
_mission_item.altitude_is_relative = false;
|
||||
_mission_item.autocontinue = true;
|
||||
@@ -808,7 +808,7 @@ Mission::set_mission_items()
|
||||
mission_item_to_position_setpoint(mission_item_next_position, &pos_sp_triplet->current);
|
||||
|
||||
} else {
|
||||
_mission_item.yaw = _navigator->get_global_position()->yaw;
|
||||
_mission_item.yaw = _navigator->get_local_position()->heading;
|
||||
|
||||
/* set position setpoint to target during the transition */
|
||||
generate_waypoint_from_heading(&pos_sp_triplet->current, _mission_item.yaw);
|
||||
@@ -1343,7 +1343,7 @@ Mission::heading_sp_update()
|
||||
|
||||
} else {
|
||||
if (!pos_sp_triplet->current.yaw_valid) {
|
||||
_mission_item.yaw = _navigator->get_local_position()->yaw;
|
||||
_mission_item.yaw = _navigator->get_local_position()->heading;
|
||||
pos_sp_triplet->current.yaw = _mission_item.yaw;
|
||||
pos_sp_triplet->current.yaw_valid = true;
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ MissionBlock::is_mission_item_reached()
|
||||
|
||||
/* check course if defined only for rotary wing except takeoff */
|
||||
float cog = (_navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) ?
|
||||
_navigator->get_local_position()->yaw :
|
||||
_navigator->get_local_position()->heading :
|
||||
atan2f(
|
||||
_navigator->get_local_position()->vy,
|
||||
_navigator->get_local_position()->vx
|
||||
@@ -690,7 +690,7 @@ MissionBlock::set_takeoff_item(struct mission_item_s *item, float abs_altitude,
|
||||
/* use current position */
|
||||
item->lat = _navigator->get_global_position()->lat;
|
||||
item->lon = _navigator->get_global_position()->lon;
|
||||
item->yaw = _navigator->get_local_position()->yaw;
|
||||
item->yaw = _navigator->get_local_position()->heading;
|
||||
|
||||
item->altitude = abs_altitude;
|
||||
item->altitude_is_relative = false;
|
||||
@@ -720,7 +720,7 @@ MissionBlock::set_land_item(struct mission_item_s *item, bool at_current_locatio
|
||||
if (at_current_location) {
|
||||
item->lat = (double)NAN; //descend at current position
|
||||
item->lon = (double)NAN; //descend at current position
|
||||
item->yaw = _navigator->get_local_position()->yaw;
|
||||
item->yaw = _navigator->get_local_position()->heading;
|
||||
|
||||
} else {
|
||||
/* use home position */
|
||||
@@ -759,7 +759,7 @@ MissionBlock::set_vtol_transition_item(struct mission_item_s *item, const uint8_
|
||||
{
|
||||
item->nav_cmd = NAV_CMD_DO_VTOL_TRANSITION;
|
||||
item->params[0] = (float) new_mode;
|
||||
item->yaw = _navigator->get_local_position()->yaw;
|
||||
item->yaw = _navigator->get_local_position()->heading;
|
||||
item->autocontinue = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ Navigator::run()
|
||||
position_setpoint_triplet_s *curr = get_position_setpoint_triplet();
|
||||
|
||||
// store current position as previous position and goal as next
|
||||
rep->previous.yaw = get_global_position()->yaw;
|
||||
rep->previous.yaw = get_local_position()->heading;
|
||||
rep->previous.lat = get_global_position()->lat;
|
||||
rep->previous.lon = get_global_position()->lon;
|
||||
rep->previous.alt = get_global_position()->alt;
|
||||
@@ -345,7 +345,7 @@ Navigator::run()
|
||||
position_setpoint_triplet_s *rep = get_takeoff_triplet();
|
||||
|
||||
// store current position as previous position and goal as next
|
||||
rep->previous.yaw = get_local_position()->yaw;
|
||||
rep->previous.yaw = get_local_position()->heading;
|
||||
rep->previous.lat = get_global_position()->lat;
|
||||
rep->previous.lon = get_global_position()->lon;
|
||||
rep->previous.alt = get_global_position()->alt;
|
||||
@@ -361,7 +361,7 @@ Navigator::run()
|
||||
rep->previous.timestamp = hrt_absolute_time();
|
||||
|
||||
} else {
|
||||
rep->current.yaw = get_local_position()->yaw;
|
||||
rep->current.yaw = get_local_position()->heading;
|
||||
rep->previous.valid = false;
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ Navigator::run()
|
||||
&& get_vstatus()->nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_LOITER) {
|
||||
position_setpoint_triplet_s *rep = get_reposition_triplet();
|
||||
|
||||
rep->current.yaw = get_global_position()->yaw;
|
||||
rep->current.yaw = get_local_position()->heading;
|
||||
rep->current.lat = get_global_position()->lat;
|
||||
rep->current.lon = get_global_position()->lon;
|
||||
rep->current.alt = get_global_position()->alt;
|
||||
|
||||
@@ -283,7 +283,7 @@ void RTL::set_rtl_item()
|
||||
_mission_item.lon = gpos.lon;
|
||||
_mission_item.altitude = _rtl_alt;
|
||||
_mission_item.altitude_is_relative = false;
|
||||
_mission_item.yaw = _navigator->get_local_position()->yaw;
|
||||
_mission_item.yaw = _navigator->get_local_position()->heading;
|
||||
_mission_item.acceptance_radius = _navigator->get_acceptance_radius();
|
||||
_mission_item.time_inside = 0.0f;
|
||||
_mission_item.autocontinue = true;
|
||||
|
||||
Reference in New Issue
Block a user