Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safety feature: Landing automatically when the driver node exits #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ardrone_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,8 @@ int main(int argc, char** argv)
{
res = ardrone_tool_update();
}
landOnExit();
ardrone_tool_update();
res = ardrone_tool_shutdown();
}
return SUCCEED(res) ? 0 : -1;
Expand Down
7 changes: 7 additions & 0 deletions src/teleop_twist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ void takeoffCallback(const std_msgs::Empty &msg)
vp_os_mutex_unlock(&twist_lock);
}

void landOnExit(void)
{
vp_os_mutex_lock(&twist_lock);
needs_land = true;
vp_os_mutex_unlock(&twist_lock);
}

C_RESULT open_teleop(void)
{
return C_OK;
Expand Down
2 changes: 2 additions & 0 deletions src/teleop_twist.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ bool setLedAnimationCallback(ardrone_autonomy::LedAnim::Request& request, ardron
bool flatTrimCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response);
bool setFlightAnimationCallback(ardrone_autonomy::FlightAnim::Request& request, ardrone_autonomy::FlightAnim::Response& response);

void landOnExit(void);

//All global drone configs that should be sent on init

#define DEFAULT_CAM_STATE 0
Expand Down