Ignore:
Timestamp:
02/07/18 17:49:27 (5 years ago)
Author:
Sanahuja Guillaume
Message:

matrix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairMeta/src/UavStateMachine.cpp

    r206 r214  
    3939#include <Vector3D.h>
    4040#include <Vector2D.h>
    41 #include <cvmatrix.h>
     41#include <Matrix.h>
    4242#include <stdio.h>
    4343#include <TrajectoryGenerator1D.h>
     
    109109      new TrajectoryGenerator1D(uavTab->NewRow(), "alt cons", "m");
    110110  uav->GetMetaUsRangeFinder()->GetZPlot()->AddCurve(
    111       altitudeTrajectory->Matrix()->Element(0), DataPlot::Green);
     111      altitudeTrajectory->GetMatrix()->Element(0), DataPlot::Green);
    112112  uav->GetMetaUsRangeFinder()->GetVzPlot()->AddCurve(
    113       altitudeTrajectory->Matrix()->Element(1), DataPlot::Green);
     113      altitudeTrajectory->GetMatrix()->Element(1), DataPlot::Green);
    114114}
    115115
     
    459459void UavStateMachine::TakeOff(void) {
    460460  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 {
    463478    //The uav always takes off in fail safe mode
    464479    flagBatteryLow=false;
     
    480495    altitudeState = AltitudeState_t::TakingOff;
    481496    SignalEvent(Event_t::TakingOff);
    482   } else {
    483     Warn("cannot takeoff\n");
    484     joy->ErrorNotify();
    485497  }
    486498}
     
    511523    altitudeState=AltitudeState_t::FinishLanding;
    512524    safeToFly=false;
    513 Printf("Emergency landing!\n");
     525    Warn("Emergency landing!\n");
     526    Warn("You will not be able to take off again\n");
    514527}
    515528
Note: See TracChangeset for help on using the changeset viewer.