Skip to content

Commit

Permalink
Make offboard example doc include correct source
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishwillee committed Feb 8, 2018
1 parent ce298ac commit 42cd96a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions en/examples/offboard_velocity.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<dronecore::Offboard> offboard)
{
std::shared_ptr<Offboard> offboard = std::make_shared<Offboard>(&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});
Expand Down Expand Up @@ -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<dronecore::Offboard> offboard)
{
std::shared_ptr<Offboard> offboard = std::make_shared<Offboard>(&device);

const std::string offb_mode = "BODY";

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 42cd96a

Please sign in to comment.