Changeset 214 in flair-src for trunk/lib/FlairMeta/src/UavStateMachine.cpp
- Timestamp:
- Feb 7, 2018, 5:49:27 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairMeta/src/UavStateMachine.cpp
r206 r214 39 39 #include <Vector3D.h> 40 40 #include <Vector2D.h> 41 #include < cvmatrix.h>41 #include <Matrix.h> 42 42 #include <stdio.h> 43 43 #include <TrajectoryGenerator1D.h> … … 109 109 new TrajectoryGenerator1D(uavTab->NewRow(), "alt cons", "m"); 110 110 uav->GetMetaUsRangeFinder()->GetZPlot()->AddCurve( 111 altitudeTrajectory-> Matrix()->Element(0), DataPlot::Green);111 altitudeTrajectory->GetMatrix()->Element(0), DataPlot::Green); 112 112 uav->GetMetaUsRangeFinder()->GetVzPlot()->AddCurve( 113 altitudeTrajectory-> Matrix()->Element(1), DataPlot::Green);113 altitudeTrajectory->GetMatrix()->Element(1), DataPlot::Green); 114 114 } 115 115 … … 459 459 void UavStateMachine::TakeOff(void) { 460 460 flagZTrajectoryFinished = false; 461 462 if((altitudeState==AltitudeState_t::Stopped) && safeToFly && uav->isReadyToFly() && uav->GetBatteryMonitor()->IsBatteryLow()==false && !flagConnectionLost) { 461 462 if(altitudeState!=AltitudeState_t::Stopped) { 463 Warn("cannot takeoff, altitudeState!=AltitudeState_t::Stopped\n"); 464 joy->ErrorNotify(); 465 } else if(!safeToFly) { 466 Warn("cannot takeoff, uav is not safe to fly\n"); 467 joy->ErrorNotify(); 468 } else if(!uav->isReadyToFly()) { 469 Warn("cannot takeoff, uav is not ready\n"); 470 joy->ErrorNotify(); 471 } else if(uav->GetBatteryMonitor()->IsBatteryLow()) { 472 Warn("cannot takeoff, battery is low\n"); 473 joy->ErrorNotify(); 474 } else if(flagConnectionLost) { 475 Warn("cannot takeoff, connection with flairgcs lost\n"); 476 joy->ErrorNotify(); 477 } else { 463 478 //The uav always takes off in fail safe mode 464 479 flagBatteryLow=false; … … 480 495 altitudeState = AltitudeState_t::TakingOff; 481 496 SignalEvent(Event_t::TakingOff); 482 } else {483 Warn("cannot takeoff\n");484 joy->ErrorNotify();485 497 } 486 498 } … … 511 523 altitudeState=AltitudeState_t::FinishLanding; 512 524 safeToFly=false; 513 Printf("Emergency landing!\n"); 525 Warn("Emergency landing!\n"); 526 Warn("You will not be able to take off again\n"); 514 527 } 515 528
Note:
See TracChangeset
for help on using the changeset viewer.