message: example offboard global pos control
diff: @@ -134,6 +134,59 @@ bool offb_ctrl_ned(mavsdk::Offboard& offboard)
  return true;
  }
  +//
  +// Does Offboard control using Global (Latitude, Longitude, relative altitude) co-ordinates.
  +//
  +// returns true if everything went well in Offboard control
  +//
  +bool offb_ctrl_pos_global(mavsdk::Offboard& offboard, mavsdk::Telemetry& telemetry)
  +{
  + std::cout << "Reading home position in Global coordinates\n";
  +
  + const auto res_and_gps_origin = telemetry.get_gps_global_origin();
  + if (res_and_gps_origin.first != Telemetry::Result::Success) {
  + std::cerr << "Telemetry failed: " << res_and_gps_origin.first << '\n';
  + }
  + Telemetry::GpsGlobalOrigin origin = res_and_gps_origin.second;
  + std::cerr << "Origin (lat, lon, alt amsl):\n " << origin << '\n';
  +
  + std::cout << "Starting Offboard position control in Global coordinates\n";
  +
  + // Send it once before starting offboard, otherwise it will be rejected.
  + // this is a step north about 10m, this uses altitude relative from home
  + const Offboard::PositionGlobalYaw north{origin.latitude_deg+0.0001, origin.longitude_deg, 20.0f,0.0f};
  + offboard.set_position_global(north);
  +
  + Offboard::Result offboard_result = offboard.start();
  + if (offboard_result != Offboard::Result::Success) {
  + std::cerr << "Offboard start failed: " << offboard_result << '\n';
  + return false;
  + }
  +
  + std::cout << "Offboard started\n";
  + std::cout << "Going North\n";
  + sleep_for(seconds(10));
  +
  + const Offboard::PositionGlobalYaw east{origin.latitude_deg+0.0001, origin.longitude_deg+0.0001, 15.0f,90.0f};
  + offboard.set_position_global(east);
  + std::cout << "Going East\n";
  + sleep_for(seconds(10));
  +
  + const Offboard::PositionGlobalYaw home{origin.latitude_deg, origin.longitude_deg, 10.0f,180.0f};
  + offboard.set_position_global(home);
  + std::cout << "Going Home facing south\n";
  + sleep_for(seconds(10));
  +
  + offboard_result = offboard.stop();
  + if (offboard_result != Offboard::Result::Success) {
  + std::cerr << "Offboard stop failed: " << offboard_result << '\n';
  + return false;
  + }
  + std::cout << "Offboard stopped\n";
  +
  + return true;
  +}
  +
  //
  // Does Offboard control using body co-ordinates.
  // Body coordinates really means world coordinates rotated by the yaw of the
  @@ -316,6 +369,11 @@ int main(int argc, char** argv)
  return 1;
  }
  + // using global position
  + if (!offb_ctrl_pos_global(offboard,telemetry)) {
  + return 1;
  + }
  +
  // using attitude control
  if (!offb_ctrl_attitude(offboard)) {
  return 1;
  