Skip to content

Commit

Permalink
Merge pull request #551 from dbowerman/system_reboot
Browse files Browse the repository at this point in the history
Fix #502. Add Action::reboot()
  • Loading branch information
julianoes committed Sep 20, 2018
2 parents 2c858f9 + 2dfccf2 commit de61562
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugins/action/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ ActionResult Action::kill() const
return _impl->kill();
}

ActionResult Action::reboot() const
{
return _impl->reboot();
}

ActionResult Action::takeoff() const
{
return _impl->takeoff();
Expand Down
14 changes: 14 additions & 0 deletions plugins/action/action_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ ActionResult ActionImpl::kill() const
return action_result_from_command_result(_parent->send_command(command));
}

ActionResult ActionImpl::reboot() const
{
MAVLinkCommands::CommandLong command{};

command.command = MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN;
command.params.param1 = 1.0f; // reboot autopilot
command.params.param2 = 1.0f; // reboot onboard computer
command.params.param3 = 1.0f; // reboot camera
command.params.param4 = 1.0f; // reboot gimbal
command.target_component_id = _parent->get_autopilot_id();

return action_result_from_command_result(_parent->send_command(command));
}

ActionResult ActionImpl::takeoff() const
{
ActionResult ret = taking_off_allowed();
Expand Down
1 change: 1 addition & 0 deletions plugins/action/action_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ActionImpl : public PluginImplBase {
ActionResult arm() const;
ActionResult disarm() const;
ActionResult kill() const;
ActionResult reboot() const;
ActionResult takeoff() const;
ActionResult land() const;
ActionResult return_to_launch() const;
Expand Down
9 changes: 9 additions & 0 deletions plugins/action/include/plugins/action/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ class Action : public PluginBase {
*/
ActionResult kill() const;

/**
* @brief Send command to *reboot* the drone components.
*
* This will reboot the autopilot, onboard computer, camera and gimbal.
*
* @return ActionResult of request.
*/
ActionResult reboot() const;

/**
* @brief Send command to *take off and hover* (synchronous).
*
Expand Down

0 comments on commit de61562

Please sign in to comment.