gbehaviors.cc 2.41 KB
Newer Older
Timothy Stack's avatar
Timothy Stack committed
1 2 3 4 5 6
/*
 * EMULAB-COPYRIGHT
 * Copyright (c) 2005 University of Utah and the Flux Group.
 * All rights reserved.
 */

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
/* Garcia robot behavior class methods
 *
 * Dan Flickinger
 *
 * 2004/11/19
 * 2004/11/19
 */
 
 
#include "gbehaviors.h"


gbehavior::gbehavior() {
  // constructor
  
  
}



gbehavior::~gbehavior() {
  // destructor
  
  
}



void gbehavior::getStatus(char *MSG) {
  // get the status of this behavior and translate to an english string
  
  if (b_status == aGARCIA_ERRFLAG_NORMAL) {
    strcpy(MSG, "no problems");
  } else if (b_status == aGARCIA_ERRFLAG_STALL) {
    strcpy(MSG, "stall condition detected");
  } else if (b_status == aGARCIA_ERRFLAG_FRONTR_LEFT) {
    strcpy(MSG, "object detected, front left IR sensor");
  } else if (b_status == aGARCIA_ERRFLAG_FRONTR_RIGHT) {
    strcpy(MSG, "object detected, front right IR sensor");
  } else if (b_status == aGARCIA_ERRFLAG_REARR_LEFT) {
    strcpy(MSG, "object detected, rear left IR sensor");
  } else if (b_status == aGARCIA_ERRFLAG_REARR_RIGHT) {
    strcpy(MSG, "object detected, rear right IR sensor");
  } else if (b_status == aGARCIA_ERRFLAG_SIDER_LEFT) {
    strcpy(MSG, "object detected, left side IR sensor");
  } else if (b_status == aGARCIA_ERRFLAG_SIDER_RIGHT) {
    strcpy(MSG, "object detected, right side IR sensor");
  } else if (b_status == aGARCIA_ERRFLAG_FALL_LEFT) {
    strcpy(MSG, "drop-off detected, front left side");
  } else if (b_status == aGARCIA_ERRFLAG_FALL_RIGHT) {
    strcpy(MSG, "drop-off detected, front right side");
  } else if (b_status == aGARCIA_ERRFLAG_ABORT) {
    strcpy(MSG, "aborted");
  } else if (b_status == aGARCIA_ERRFLAG_NOTEXECUTED) {
    strcpy(MSG, "not executed for some stupid reason");
  } else if (b_status == aGARCIA_ERRFLAG_WONTEXECUTE) {
    strcpy(MSG, "will not execute: bitching about something");
  } else if (b_status == aGARCIA_ERRFLAG_BATT) {
    strcpy(MSG, "LOW BATTERY: robot cry");
  } else if (b_status == aGARCIA_ERRFLAG_IRRX) {
    strcpy(MSG, "IR receiver override");
  } else {
    strcpy(MSG, "NO STATUS");
  }
  
  

}



float gbehavior::getDisp() {
  // get final displacement for this behavior
  return b_disp;
}
  


void gbehavior::setStatus(int stat) {
  // set the status for this behavior
  b_status = stat;
}



void gbehavior::setDisp(float disp) {
  // set the final displacement for this behavior
  b_disp = disp;
}



void gbehavior::setID(int ID) {
  // set the ID for this behavior
  b_ID = ID;
}