mirror of https://github.com/ArduPilot/ardupilot
AP_Proximity: remove public get_orientation and get_yaw_correction
this are only used by backends
This commit is contained in:
parent
965cdd7e72
commit
7dbbca8d58
|
@ -230,26 +230,6 @@ AP_Proximity::Type AP_Proximity::get_type(uint8_t instance) const
|
||||||
return Type::None;
|
return Type::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return sensor orientation
|
|
||||||
uint8_t AP_Proximity::get_orientation(uint8_t instance) const
|
|
||||||
{
|
|
||||||
if (!valid_instance(instance)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return params[instance].orientation.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
// return sensor yaw correction
|
|
||||||
int16_t AP_Proximity::get_yaw_correction(uint8_t instance) const
|
|
||||||
{
|
|
||||||
if (!valid_instance(instance)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return params[instance].yaw_correction.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
// return sensor health
|
// return sensor health
|
||||||
AP_Proximity::Status AP_Proximity::get_status(uint8_t instance) const
|
AP_Proximity::Status AP_Proximity::get_status(uint8_t instance) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,9 +76,7 @@ public:
|
||||||
// return sensor type of a given instance
|
// return sensor type of a given instance
|
||||||
Type get_type(uint8_t instance) const;
|
Type get_type(uint8_t instance) const;
|
||||||
|
|
||||||
// return sensor orientation and yaw correction
|
// return distance filter frequency
|
||||||
uint8_t get_orientation(uint8_t instance) const;
|
|
||||||
int16_t get_yaw_correction(uint8_t instance) const;
|
|
||||||
float get_filter_freq() const { return _filt_freq; }
|
float get_filter_freq() const { return _filt_freq; }
|
||||||
|
|
||||||
// return sensor health
|
// return sensor health
|
||||||
|
|
|
@ -47,8 +47,8 @@ void AP_Proximity_Backend::set_status(AP_Proximity::Status status)
|
||||||
// correct an angle (in degrees) based on the orientation and yaw correction parameters
|
// correct an angle (in degrees) based on the orientation and yaw correction parameters
|
||||||
float AP_Proximity_Backend::correct_angle_for_orientation(float angle_degrees) const
|
float AP_Proximity_Backend::correct_angle_for_orientation(float angle_degrees) const
|
||||||
{
|
{
|
||||||
const float angle_sign = (frontend.get_orientation(state.instance) == 1) ? -1.0f : 1.0f;
|
const float angle_sign = (params.orientation == 1) ? -1.0f : 1.0f;
|
||||||
return wrap_360(angle_degrees * angle_sign + frontend.get_yaw_correction(state.instance));
|
return wrap_360(angle_degrees * angle_sign + params.yaw_correction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if a reading should be ignored because it falls into an ignore area (check_for_ign_area should be sent as false if this check is not needed)
|
// check if a reading should be ignored because it falls into an ignore area (check_for_ign_area should be sent as false if this check is not needed)
|
||||||
|
|
|
@ -307,8 +307,8 @@ void AP_Proximity_LightWareSF40C::process_message()
|
||||||
|
|
||||||
// process each point
|
// process each point
|
||||||
const float angle_inc_deg = (1.0f / point_total) * 360.0f;
|
const float angle_inc_deg = (1.0f / point_total) * 360.0f;
|
||||||
const float angle_sign = (frontend.get_orientation(state.instance) == 1) ? -1.0f : 1.0f;
|
const float angle_sign = (params.orientation == 1) ? -1.0f : 1.0f;
|
||||||
const float angle_correction = frontend.get_yaw_correction(state.instance);
|
const float angle_correction = params.yaw_correction;
|
||||||
const uint16_t dist_min_cm = distance_min() * 100;
|
const uint16_t dist_min_cm = distance_min() * 100;
|
||||||
const uint16_t dist_max_cm = distance_max() * 100;
|
const uint16_t dist_max_cm = distance_max() * 100;
|
||||||
|
|
||||||
|
|
|
@ -141,9 +141,9 @@ void AP_Proximity_MAV::handle_obstacle_distance_msg(const mavlink_message_t &msg
|
||||||
_last_update_ms = AP_HAL::millis();
|
_last_update_ms = AP_HAL::millis();
|
||||||
|
|
||||||
// get user configured yaw correction from front end
|
// get user configured yaw correction from front end
|
||||||
const float param_yaw_offset = constrain_float(frontend.get_yaw_correction(state.instance), -360.0f, +360.0f);
|
const float param_yaw_offset = constrain_float(params.yaw_correction, -360.0f, +360.0f);
|
||||||
const float yaw_correction = wrap_360(param_yaw_offset + packet.angle_offset);
|
const float yaw_correction = wrap_360(param_yaw_offset + packet.angle_offset);
|
||||||
if (frontend.get_orientation(state.instance) != 0) {
|
if (params.orientation != 0) {
|
||||||
increment *= -1;
|
increment *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,8 +305,8 @@ void AP_Proximity_RPLidarA2::parse_response_data()
|
||||||
Debug(2, "UART %02x %02x%02x %02x%02x", payload[0], payload[2], payload[1], payload[4], payload[3]); //show HEX values
|
Debug(2, "UART %02x %02x%02x %02x%02x", payload[0], payload[2], payload[1], payload[4], payload[3]); //show HEX values
|
||||||
// check if valid SCAN packet: a valid packet starts with startbits which are complementary plus a checkbit in byte+1
|
// check if valid SCAN packet: a valid packet starts with startbits which are complementary plus a checkbit in byte+1
|
||||||
if ((payload.sensor_scan.startbit == !payload.sensor_scan.not_startbit) && payload.sensor_scan.checkbit) {
|
if ((payload.sensor_scan.startbit == !payload.sensor_scan.not_startbit) && payload.sensor_scan.checkbit) {
|
||||||
const float angle_sign = (frontend.get_orientation(state.instance) == 1) ? -1.0f : 1.0f;
|
const float angle_sign = (params.orientation == 1) ? -1.0f : 1.0f;
|
||||||
const float angle_deg = wrap_360(payload.sensor_scan.angle_q6/64.0f * angle_sign + frontend.get_yaw_correction(state.instance));
|
const float angle_deg = wrap_360(payload.sensor_scan.angle_q6/64.0f * angle_sign + params.yaw_correction);
|
||||||
const float distance_m = (payload.sensor_scan.distance_q2/4000.0f);
|
const float distance_m = (payload.sensor_scan.distance_q2/4000.0f);
|
||||||
#if RP_DEBUG_LEVEL >= 2
|
#if RP_DEBUG_LEVEL >= 2
|
||||||
const uint8_t quality = payload.sensor_scan.quality;
|
const uint8_t quality = payload.sensor_scan.quality;
|
||||||
|
|
Loading…
Reference in New Issue