int main(int argc, char** argv) { std::cout << "Hello, world!" << std::endl; // setup signal interrupt handler signal(SIGINT, signal_callback_handler); // specify which options are available as cmd line arguments setupCmdLineReader(); // read agent id from command line parameters (--agent=mario) agent = readAgentFromCmdLine(argc, argv); // initialize the behavior tree client node ros::init(argc, argv, std::string("behavior_tree") + "_" + agent); // initialize OpenGL engine for visualization glut_setup(argc, argv); // point to the root of the behavior tree node_cursor = node = &root; node_cursor->set_highlighted(true); // create the bt from the file bt.txt (put on the path) std::cout << "----------------- PARSE FILE -----------------" << std::endl; parse_file(std::string("bt") + "_" + agent + ".txt"); // print the data parsed from the specification file std::cout << "----------------- PRINT TREE -----------------" << std::endl; root.print_subtree(); // wait until user inputs Enter to start std::cout << "Press Enter To Start" << std::endl; std::cin.get(); // start ticking the root of the tree at frequency: TICK_FREQUENCY while (ros::ok()) { std::cout << "**** run" << run << std::endl; std::cout << "-------------- EXECUTE TREE --------------" << std::endl; root.execute_reset_status(); root.execute(); // sending tick get_keypressed(); // processing keystrokes process_keypressed(); glut_process(); // update visualization glutPostRedisplay(); ros::Duration(1.0/TICK_FREQUENCY).sleep(); std::cout << "**** run" << run << std::endl; } // missing to clear the dynamically allocated tree // delete_tree(); return 0; }
int main(int argc, char** argv) { setbuf(stdout, NULL); /* for writing to stdout asap */ glutInit(&argc, argv); my_setup(argc, argv); glut_setup(); gl_setup(); glutMainLoop(); return(0); }
/******************************************************* FUNCTION: main ARGS: argc, argv RETURN: 0 DOES: main function (duh!); starts GL, GLU, GLUT, then loops ********************************************************/ int main(int argc, char** argv) { glutInit(&argc, argv); glut_setup(); gl_setup(); my_setup(); glutMainLoop(); return(0); }
/*Typical OpenGL/GLUT Main function */ int main(int argc, char **argv) { /* program arguments */ /* initialize GLUT and OpenGL; Must be called first */ glutInit( &argc, argv ) ; /* our own initializations; we'll define these setup procedures */ glut_setup() ; gl_setup() ; my_setup(); /* turn control over to GLUT */ glutMainLoop() ; return(0) ; /* make the compiler happy */ }
int main(int argc, char **argv) { /* General initialization for GLUT and OpenGL Must be called first */ glutInit(&argc, argv); /* we define these setup procedures */ glut_setup(); gl_setup(); my_setup(argc, argv); /* go into the main event loop */ glutMainLoop(); return (0); }
//Typical OpenGL/GLUT Main function int main(int argc, char **argv) { // program arguments //initialize shape info for (int x = 0; x < SIZE; x++) { //even shapes are rectangles, odd shapes are circles if (x % 2 == 0) list_of_shapes[x].is_circle = 0; else list_of_shapes[x].is_circle = 1; list_of_shapes[x].curr_x = 0; list_of_shapes[x].curr_y = 0; list_of_shapes[x].p_ptr = NULL; } // initialize GLUT and OpenGL; Must be called first glutInit( &argc, argv ) ; // our own initializations; we'll define these setup procedures glut_setup() ; gl_setup() ; my_setup(); // turn control over to GLUT glutMainLoop() ; //Free memory for (int x = 0; x < 25; x++) { if (list_of_shapes[x].p_ptr != NULL) { delete [] list_of_shapes[x].p_ptr; } } return(0) ; // make the compiler happy }