Skip to content

Commit

Permalink
gimbal: fix rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
julianoes committed Jan 22, 2019
1 parent aba68ae commit 9d14008
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions plugins/gimbal/gimbal_impl.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "gimbal_impl.h"
#include "global_include.h"
#include <functional>
#include <cmath>

namespace dronecode_sdk {

Expand Down Expand Up @@ -61,8 +62,8 @@ GimbalImpl::set_roi_location(double latitude_deg, double longitude_deg, float al
MAVLinkCommands::CommandInt command{};

command.command = MAV_CMD_DO_SET_ROI_LOCATION;
command.params.x = int32_t(latitude_deg * 1e7);
command.params.y = int32_t(longitude_deg * 1e7);
command.params.x = int32_t(std::round(latitude_deg * 1e7));
command.params.y = int32_t(std::round(longitude_deg * 1e7));
command.params.z = altitude_m;
command.target_component_id = _parent->get_autopilot_id();

Expand All @@ -77,8 +78,8 @@ void GimbalImpl::set_roi_location_async(double latitude_deg,
MAVLinkCommands::CommandInt command{};

command.command = MAV_CMD_DO_SET_ROI_LOCATION;
command.params.x = int32_t(latitude_deg * 1e7);
command.params.y = int32_t(longitude_deg * 1e7);
command.params.x = int32_t(std::round(latitude_deg * 1e7));
command.params.y = int32_t(std::round(longitude_deg * 1e7));
command.params.z = altitude_m;
command.target_component_id = _parent->get_autopilot_id();

Expand Down

0 comments on commit 9d14008

Please sign in to comment.