Skip to content

Commit

Permalink
converted elapsed time to milliseconds. some minor change in example.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shakthi Prashanth M committed Oct 27, 2017
1 parent a71893a commit df5f81e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions example/follow_me/follow_target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ int main(int, char **)
// Start FollowMe mode (by passing optional position)
FollowMe::Result followme_result = device.followme().start();
followme_error_exit(followme_result, "Failed to start FollowMe mode");
std::cout << "[FollowMe] Waiting for 20 secs :-) ..." << std::endl;
std::cout << "[FollowMe] Started. Waiting for 20 secs :-) ..." << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(20));

// Stop FollowMe mode
followme_result = device.followme().stop();
followme_error_exit(followme_result, "Failed to stop FollowMe mode");
std::cout << "Exiting." << std::endl;
std::cout << "[FollowMe] Stopped. Exiting now." << std::endl;

return 0;
}
4 changes: 2 additions & 2 deletions plugins/follow_me/follow_me_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,17 @@ void FollowMeImpl::send_gcs_motion_report()
auto end = system_clock::now();
auto elapsed_seconds = system_clock::to_time_t(end) - system_clock::to_time_t(_start);

mavlink_message_t msg {};
float vel[3] = { _motion_report.vx, _motion_report.vy, 0.f };
float accel_unknown[3] = { 0.f, 0.f, 0.f };
float attitude_q_unknown[4] = { 1.f, 0.f, 0.f, 0.f };
float rates_unknown[3] = { 0.f, 0.f, 0.f };
uint64_t custom_state = 0;

mavlink_message_t msg {};
mavlink_msg_follow_target_pack(_parent->get_own_system_id(),
_parent->get_own_component_id(),
&msg,
elapsed_seconds * 1e-6,
elapsed_seconds * 1000, /* in milliseconds */
_estimatation_capabilities,
_motion_report.lat_int,
_motion_report.lon_int,
Expand Down

0 comments on commit df5f81e

Please sign in to comment.