diff --git a/en/examples/offboard_velocity.md b/en/examples/offboard_velocity.md index f83dbb2..d59392b 100644 --- a/en/examples/offboard_velocity.md +++ b/en/examples/offboard_velocity.md @@ -159,10 +159,8 @@ inline void offboard_log(const std::string &offb_mode, const std::string msg) * * returns true if everything went well in Offboard control, exits with a log otherwise. */ -bool offb_ctrl_ned(Device &device) +bool offb_ctrl_ned(std::shared_ptr offboard) { - std::shared_ptr offboard = std::make_shared(&device); - const std::string offb_mode = "NED"; // Send it once before starting offboard, otherwise it will be rejected. offboard->set_velocity_ned({0.0f, 0.0f, 0.0f, 0.0f}); @@ -214,9 +212,8 @@ bool offb_ctrl_ned(Device &device) * * returns true if everything went well in Offboard control, exits with a log otherwise. */ -bool offb_ctrl_body(Device &device) +bool offb_ctrl_body(std::shared_ptr offboard) { - std::shared_ptr offboard = std::make_shared(&device); const std::string offb_mode = "BODY"; @@ -296,14 +293,15 @@ int main(int, char **) std::cout << "In Air..." << std::endl; sleep_for(seconds(5)); + // using local NED co-ordinates - bool ret = offb_ctrl_ned(device); + bool ret = offb_ctrl_ned(offboard); if (ret == false) { return EXIT_FAILURE; } // using body co-ordinates - ret = offb_ctrl_body(device); + ret = offb_ctrl_body(offboard); if (ret == false) { return EXIT_FAILURE; }