pathmotion.cc 1.75 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
/* pathmotion: garcia robot path generator
 *
 * Dan Flickinger
 *
 * 2004/10/04
 * 2004/11/17
 */

#define PATH_SIMPLE
#include "dgrobot/commotion.h"

int main(int argc, char **argv)
{ 
  // fnord!
  
//  char fileINname [64];
//  char commandIN [16];
  
  float length, radius, i_velocity, f_velocity;
  int pstatus;
  
  
  grobot robot1; 
//  ifstream fileIN;
  spathseg * pathc;

//   cout << "Cubic path generation" << endl
//        << "PATH FILE? ->" << flush;
//   cin >> fileINname;
//   
//   
//   fileIN.open(fileINname, ios::in);
//   
//   while (!(fileIN.eof())) {
//     // read file until end
//     
//     fileIN >> length >> radius >> i_velocity >> f_velocity;
//     
//     if (!(fileIN.eof())) {
      
//  while (strcmp(commandIN, "q") != 0) {
    
//    cout << "? ";
//    cin >> length >> radius >> i_velocity >> f_velocity;

  // set up segment, half circle of radius 1 m
  length = M_PI;
  radius = 1.0f;
  i_velocity = 0.0f;
  f_velocity = 0.2f;

      
  pathc = new spathseg(&robot1, length, radius, i_velocity, f_velocity);
  cout << "New path segment created" << endl;
  pstatus = pathc->execute();
  cout << "Segment executed" << endl;
      
  if (pstatus == 0) {
    // everything is GOOD
    cout << "Completed path segment " << length << "m." << endl;
  } else {
    // damn, path segment did not complete
    cout << "Path segment " << length << "m FAILED." << endl;
        
    // FIXME: do something!
        
               
        
  }
  delete pathc;
  // leave pointer hanging until next loop iteration. Woo!
    
//  }
  
  
  //fileIN.close();
  
  // set wheels to zero!
  robot1.setWheels(0.0f, 0.0f);
      
  return 0;
  
}