Copter: Small changes to convert to meters

This commit is contained in:
Leonard Hall
2025-08-15 14:06:52 +09:00
committed by Randy Mackay
parent dacf539f56
commit ff86a544c7
6 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ void Copter::update_throttle_hover()
}
// do not update while climbing or descending
if (!is_zero(pos_control->get_vel_desired_NEU_cms().z)) {
if (!is_zero(pos_control->get_vel_desired_NEU_ms().z)) {
return;
}
+1 -1
View File
@@ -68,7 +68,7 @@ void Copter::Log_Write_Control_Tuning()
#endif
terr_alt : terr_alt,
target_climb_rate : int16_t(target_climb_rate_ms * 100.0),
climb_rate : int16_t(pos_control->get_vel_estimate_NEU_cms().z) // float -> int16_t
climb_rate : int16_t(pos_control->get_vel_estimate_NEU_ms().z * 100.0) // float -> int16_t
};
logger.WriteBlock(&pkt, sizeof(pkt));
}
+2 -2
View File
@@ -86,7 +86,7 @@ void Copter::update_land_detector()
#if MODE_AUTOROTATE_ENABLED
|| (flightmode->mode_number() == Mode::Number::AUTOROTATE && motors->get_below_land_min_coll())
#endif
|| ((!get_force_flying() || landing) && motors->limit.throttle_lower && pos_control->get_vel_desired_NEU_cms().z < 0.0f);
|| ((!get_force_flying() || landing) && motors->limit.throttle_lower && pos_control->get_vel_desired_NEU_ms().z < 0.0f);
bool throttle_mix_at_min = true;
#else
// check that the average throttle output is near minimum (less than 12.5% hover throttle)
@@ -309,7 +309,7 @@ void Copter::update_throttle_mix()
const bool accel_moving = (land_accel_ef_filter.get().length() > LAND_CHECK_ACCEL_MOVING);
// check for requested descent
bool descent_not_demanded = pos_control->get_vel_desired_NEU_cms().z >= 0.0f;
bool descent_not_demanded = pos_control->get_vel_desired_NEU_ms().z >= 0.0f;
// check if landing
const bool landing = flightmode->is_landing();
+4 -4
View File
@@ -1454,7 +1454,7 @@ void PayloadPlace::run()
case State::Ascent_Start:
copter.flightmode->land_run_horizontal_control();
// update altitude target and call position controller
pos_control->land_at_climb_rate_cms(0.0, false);
pos_control->land_at_climb_rate_ms(0.0, false);
break;
case State::Ascent:
case State::Done:
@@ -1533,9 +1533,9 @@ Location ModeAuto::loc_from_cmd(const AP_Mission::Mission_Command& cmd, const Lo
if (ret.alt == 0) {
// set to default_loc's altitude but in command's alt frame
// note that this may use the terrain database
int32_t default_alt_cm;
if (default_loc.get_alt_cm(ret.get_alt_frame(), default_alt_cm)) {
ret.set_alt_cm(default_alt_cm, ret.get_alt_frame());
float default_alt_m;
if (default_loc.get_alt_m(ret.get_alt_frame(), default_alt_m)) {
ret.set_alt_m(default_alt_m, ret.get_alt_frame());
} else {
// default to default_loc's altitude and frame
ret.copy_alt_from(default_loc);
+1 -1
View File
@@ -30,7 +30,7 @@ bool ModeCircle::init(bool ignore_checks)
return false;
}
// point at the ground:
circle_center.set_alt_cm(0, Location::AltFrame::ABOVE_TERRAIN);
circle_center.set_alt_m(0, Location::AltFrame::ABOVE_TERRAIN);
AP_Mount *s = AP_Mount::get_singleton();
s->set_roi_target(circle_center);
}
+1 -1
View File
@@ -47,7 +47,7 @@ bool ModeLoiter::do_precision_loiter()
return false; // don't move on the ground
}
// if the pilot *really* wants to move the vehicle, let them....
if (loiter_nav->get_pilot_desired_acceleration_NE_cmss().length() > 50.0f) {
if (loiter_nav->get_pilot_desired_acceleration_NE_mss().length() > 0.5) {
return false;
}
if (!copter.precland.target_acquired()) {