Cheetah Software  1.0
main_helper.h File Reference
#include <Types.h>
#include <RobotController.h>
+ Include dependency graph for main_helper.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int main_helper (int argc, char **argv, RobotController *ctrl)
 

Variables

MasterConfig gMasterConfig
 

Function Documentation

int main_helper ( int  argc,
char **  argv,
RobotController ctrl 
)

Definition at line 31 of file main_helper.cpp.

References MasterConfig::_robot, CHEETAH_3, install_segfault_handler(), MINI_CHEETAH, printUsage(), SimulationBridge::run(), MiniCheetahHardwareBridge::run(), and MasterConfig::simulated.

31  {
33  if (argc != 3) {
34  printUsage();
35  return EXIT_FAILURE;
36  }
37 
38  if (argv[1][0] == '3') {
40  } else if (argv[1][0] == 'm') {
42  } else {
43  printUsage();
44  return EXIT_FAILURE;
45  }
46 
47  if (argv[2][0] == 's') {
48  gMasterConfig.simulated = true;
49  } else if (argv[2][0] == 'r') {
50  gMasterConfig.simulated = false;
51  } else {
52  printUsage();
53  return EXIT_FAILURE;
54  }
55 
56  printf("[Quadruped] Cheetah Software\n");
57  printf(" Quadruped: %s\n",
58  gMasterConfig._robot == RobotType::MINI_CHEETAH ? "Mini Cheetah"
59  : "Cheetah 3");
60  printf(" Driver: %s\n", gMasterConfig.simulated
61  ? "Development Simulation Driver"
62  : "Quadruped Driver");
63 
64  // dispatch the appropriate driver
67  SimulationBridge simulationBridge(gMasterConfig._robot, ctrl);
68  simulationBridge.run();
69  printf("[Quadruped] SimDriver run() has finished!\n");
71  SimulationBridge simulationBridge(gMasterConfig._robot, ctrl);
72  simulationBridge.run();
73  } else {
74  printf("[ERROR] unknown robot\n");
75  assert(false);
76  }
77  } else {
80  hw.run();
81  printf("[Quadruped] SimDriver run() has finished!\n");
83  printf("[ERROR] can't do cheetah 3 hardware\n");
84  assert(false);
85  } else {
86  printf("[ERROR] unknown robot\n");
87  assert(false);
88  }
89  }
90 
91  return 0;
92 }
bool simulated
Definition: Types.h:8
void printUsage()
Definition: main_helper.cpp:24
MasterConfig gMasterConfig
Definition: main_helper.cpp:19
RobotType _robot
Definition: Types.h:7
void install_segfault_handler()

+ Here is the call graph for this function:

Variable Documentation

MasterConfig gMasterConfig

Definition at line 19 of file main_helper.cpp.