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

Prevent crashes by retrying auto-init if the drone fails to takeoff #57

Open
wants to merge 1 commit into
base: indigo-devel
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
13 changes: 10 additions & 3 deletions src/autopilot/KI/KIAutoInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,16 @@ bool KIAutoInit::update(const tum_ardrone::filter_stateConstPtr statePtr)

case STARTED: // wait 6s to reach hight.
if(getMS() - stageStarted > reachHeightMS)
{
stageStarted = getMS();
stage = WAIT_FOR_FIRST;
{
// check that the drone is actually flying

if (statePtr->droneState >=3 && statePtr->droneState <= 7 ) {
stageStarted = getMS();
stage = WAIT_FOR_FIRST;
} else {
// something went wrong, try again
stage = NONE;
}
}
node->sendControlToDrone(node->hoverCommand);
return false;
Expand Down
6 changes: 5 additions & 1 deletion src/stateestimation/PTAMWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,11 @@ void PTAMWrapper::on_key_down(int key)
bool PTAMWrapper::handleCommand(std::string s)
{
if(s.length() == 5 && s.substr(0,5) == "space")
{
{
if (mpTracker == 0) {
ROS_INFO("Haven't received the first video frame yet, can't start the tracker");
return true;
}
mpTracker->pressSpacebar();
}

Expand Down