mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-25 18:18:49 -04:00
SITL: fixup offset calls
This commit is contained in:
parent
e7afa628d1
commit
d698987070
@ -192,7 +192,7 @@ void ADSB::send_report(void)
|
|||||||
ADSB_Vehicle &vehicle = vehicles[i];
|
ADSB_Vehicle &vehicle = vehicles[i];
|
||||||
Location loc = home;
|
Location loc = home;
|
||||||
|
|
||||||
loc.offset(vehicle.position.x, vehicle.position.y);
|
loc.offset_double(vehicle.position.x, vehicle.position.y);
|
||||||
|
|
||||||
// re-init when exceeding radius range
|
// re-init when exceeding radius range
|
||||||
if (home.get_distance(loc) > _sitl->adsb_radius_m) {
|
if (home.get_distance(loc) > _sitl->adsb_radius_m) {
|
||||||
|
@ -782,7 +782,7 @@ void Aircraft::smooth_sensors(void)
|
|||||||
smoothing.position += (smoothing.velocity_ef * delta_time).todouble();
|
smoothing.position += (smoothing.velocity_ef * delta_time).todouble();
|
||||||
|
|
||||||
smoothing.location = home;
|
smoothing.location = home;
|
||||||
smoothing.location.offset(smoothing.position.x, smoothing.position.y);
|
smoothing.location.offset_double(smoothing.position.x, smoothing.position.y);
|
||||||
smoothing.location.alt = static_cast<int32_t>(home.alt - smoothing.position.z * 100.0f);
|
smoothing.location.alt = static_cast<int32_t>(home.alt - smoothing.position.z * 100.0f);
|
||||||
|
|
||||||
smoothing.last_update_us = now;
|
smoothing.last_update_us = now;
|
||||||
|
@ -97,7 +97,7 @@ float SerialProximitySensor::measure_distance_at_angle_bf(const Location &locati
|
|||||||
for (int8_t x=-num_post_offset; x<num_post_offset; x++) {
|
for (int8_t x=-num_post_offset; x<num_post_offset; x++) {
|
||||||
for (int8_t y=-num_post_offset; y<num_post_offset; y++) {
|
for (int8_t y=-num_post_offset; y<num_post_offset; y++) {
|
||||||
Location post_location = post_origin;
|
Location post_location = post_origin;
|
||||||
post_location.offset(x*10+3, y*10+2);
|
post_location.offset_double(x*10+3, y*10+2);
|
||||||
if (postfile != nullptr) {
|
if (postfile != nullptr) {
|
||||||
::fprintf(postfile, "map circle %f %f %f blue\n", post_location.lat*1e-7, post_location.lng*1e-7, radius_cm/100.0);
|
::fprintf(postfile, "map circle %f %f %f blue\n", post_location.lat*1e-7, post_location.lng*1e-7, radius_cm/100.0);
|
||||||
}
|
}
|
||||||
@ -111,8 +111,8 @@ float SerialProximitySensor::measure_distance_at_angle_bf(const Location &locati
|
|||||||
float dist_cm = (intersection_point_cm-vehicle_pos_cm).length();
|
float dist_cm = (intersection_point_cm-vehicle_pos_cm).length();
|
||||||
if (intersectionsfile != nullptr) {
|
if (intersectionsfile != nullptr) {
|
||||||
Location intersection_point = location;
|
Location intersection_point = location;
|
||||||
intersection_point.offset(intersection_point_cm.x/100.0f,
|
intersection_point.offset_double(intersection_point_cm.x/100.0,
|
||||||
intersection_point_cm.y/100.0f);
|
intersection_point_cm.y/100.0);
|
||||||
::fprintf(intersectionsfile,
|
::fprintf(intersectionsfile,
|
||||||
"map icon %f %f barrell\n",
|
"map icon %f %f barrell\n",
|
||||||
intersection_point.lat*1e-7,
|
intersection_point.lat*1e-7,
|
||||||
|
@ -85,7 +85,7 @@ Vector2f ShipSim::get_ground_speed_adjustment(const Location &loc, float &yaw_ra
|
|||||||
return Vector2f(0,0);
|
return Vector2f(0,0);
|
||||||
}
|
}
|
||||||
Location shiploc = home;
|
Location shiploc = home;
|
||||||
shiploc.offset(ship.position.x, ship.position.y);
|
shiploc.offset_double(ship.position.x, ship.position.y);
|
||||||
if (loc.get_distance(shiploc) > deck_size) {
|
if (loc.get_distance(shiploc) > deck_size) {
|
||||||
yaw_rate = 0;
|
yaw_rate = 0;
|
||||||
return Vector2f(0,0);
|
return Vector2f(0,0);
|
||||||
@ -172,7 +172,7 @@ void ShipSim::send_report(void)
|
|||||||
send a GLOBAL_POSITION_INT messages
|
send a GLOBAL_POSITION_INT messages
|
||||||
*/
|
*/
|
||||||
Location loc = home;
|
Location loc = home;
|
||||||
loc.offset(ship.position.x, ship.position.y);
|
loc.offset_double(ship.position.x, ship.position.y);
|
||||||
|
|
||||||
int32_t alt;
|
int32_t alt;
|
||||||
bool have_alt = false;
|
bool have_alt = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user