Skip to content
Snippets Groups Projects
Commit e1472818 authored by Julian Oes's avatar Julian Oes Committed by Daniel Agar
Browse files

mavlink_mission: round lat/lon

This avoids casting errors. An alternative to `std::round` would be to
add 0.5 before casting for positive values and subtract 0.5 before
casting for negative values.
parent d4c87132
No related branches found
No related tags found
No related merge requests found
......@@ -1560,8 +1560,8 @@ MavlinkMissionManager::format_mavlink_mission_item(const struct mission_item_s *
mavlink_mission_item_int_t *item_int =
reinterpret_cast<mavlink_mission_item_int_t *>(mavlink_mission_item);
item_int->x = (int32_t)(mission_item->lat * 1e7);
item_int->y = (int32_t)(mission_item->lon * 1e7);
item_int->x = std::round(mission_item->lat * 1e7);
item_int->y = std::round(mission_item->lon * 1e7);
} else {
mavlink_mission_item->x = (float)mission_item->lat;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment