Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Search  

/home/mrm/Simex/simulations/hr_bike/biker.cxx File Reference

#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <climits>
#include <cmath>
#include <fstream>
#include <sstream>
#include "biker.H"

Include dependency graph for biker.cxx:

Include dependency graph

Functions

int startUpGLUT (int, char **)
void db_restart ()
int db_main (int argc, char *argv[])
double db_get_biker_position_x ()
double db_get_biker_position_y ()
double db_get_biker_position_z ()
double db_get_biker_speed_x ()
double db_get_biker_speed_y ()
double db_get_biker_speed_z ()
double db_get_biker_desired_speed_x ()
double db_get_biker_desired_speed_y ()
double db_get_biker_desired_speed_z ()
void db_set_biker_desired_speed_x (double speed_x)
void db_set_biker_desired_speed_y (double speed_y)

Variables

totalSim biker

Function Documentation

int startUpGLUT int   ,
char **   
 

00311 {
00312     int numModel;
00313 
00314     glutInit(&argc, argv);
00315     glutInitWindowPosition(100, 100);
00316     glutInitWindowSize(640, 480);
00317     glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
00318     glutCreateWindow("Biker Guy");
00319     glutDisplayFunc(db_displayFunc);
00320     glutMouseFunc(mouse);
00321     glutMotionFunc(motion);
00322     glutKeyboardFunc(keyboard);
00323     glEnable(GL_DEPTH_TEST);
00324     glClearDepth(1.0f);                     // Depth Buffer Setup
00325     glDepthFunc(GL_LEQUAL);                 // The Type Of Depth Testing To Do    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);// Really Nice Perspective Calculations
00326     glShadeModel(GL_SMOOTH);                // Enable Smooth Shading
00327     glClearColor(0.0f, 0.0f, 0.5f, 0.5f);   // Black Background
00328 
00329     glMatrixMode(GL_PROJECTION);
00330     gluPerspective( /* field of view in degree */ 22.0,
00331         /* aspect ratio */ 640.0 / 480.0,
00332         /* Z near */ 1.0,
00333         /* Z far */ 1000.0);
00334 
00335     glMatrixMode(GL_MODELVIEW);
00336     glLoadIdentity();
00337         glEnable(GL_LIGHTING);
00338          glEnable(GL_CULL_FACE);
00339         glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
00340         glEnable(GL_LIGHT0);
00341         camera.UseOffSet(true); 
00342         camera.SetLocation(0,7.0,0);
00343         camera.SetLookAt(0,0,0);
00344 
00345 
00346 
00347 
00348 
00349         for (numModel=0;numModel<NUM_MODELS;numModel++) {
00350                 model_list[numModel] = 0;
00351                 model_file[numModel] = NULL;
00352                 material_mode[numModel] = 0;
00353         }
00354         LoadModels();
00355 
00356 
00357 //      biker_loop();
00358         biker.bikeOrient(locationlist, orientationlist);
00359         groundZ = 0;
00360         groundX = locationlist[0][0];
00361         groundY = locationlist[0][1];
00362         glutIdleFunc(db_driver);
00363     glutMainLoop();
00364         
00365     return 0;
00366 
00367 }

void db_restart  
 

00116                  {
00117   biker.bikerLowControl.initializeLowControl();
00118   biker.bikerLowControl.clearKinematics();
00119   biker.bikerPlant.initializePlant();
00120   biker.bikerPlant.clearKinematics();
00121   biker.initializeSim();
00122   biker.bikerConstraints.clearKinematics();
00123 }

int db_main int    argc,
char *    argv[]
 

00203                                     {
00204 //void main(int argc, char *argv[]) {
00205 
00206   std::cout << "size is: " << sizeof (SmSDFastSim<BOCbiker>) << "\n";
00207   //--------------------------------------------
00208   (void)argc;
00209   (void)argv;
00210   //--------------------------------------------
00211 
00212   SmSDFastSim<BOCbiker> *sim;
00213   sim = &biker.bikerSim;
00214   BOCbiker *sd;
00215   sd = &(sim->core());
00216 
00217   // Add tau callback to BOC sim for SDFast
00218   sim->insertIntFrcObj(biker.bikerLowControl);
00219 
00220   // Add plant callback to BOC sim for SDFast
00221   sim->insertIntFrcObj(biker.bikerPlant);
00222 
00223   sim->setConstraintCB (biker.bikerConstraints);
00224 
00225   biker.initializeSim();
00226   sd->sdinit();
00227   sd->sdstab(2.0 * 100.0, 100.0 * 100.0);
00228 
00229 //  To remove graphics part of programming (to run faster)
00230 //  insert this while loop and remove call to startUpGLUT
00231 //
00232 //  while (1) 
00233 //    biker.bikerLoop ();
00234 
00235 //  startUpGLUT (argc, argv);
00236 
00237   //Modification: 08/24/2002 Pascal
00238   return 0;
00239   
00240 
00241 }

double db_get_biker_position_x  
 

00244                          {
00245   return(biker.bikerSim.state().q.d_x);
00246 }

double db_get_biker_position_y  
 

00249                          {
00250   return(biker.bikerSim.state().q.d_y);
00251 }

double db_get_biker_position_z  
 

00254                          {
00255   return(biker.bikerSim.state().q.d_z);
00256 }

double db_get_biker_speed_x  
 

00259                       {
00260   return(biker.bikerSim.state().u.d_x);
00261 }

double db_get_biker_speed_y  
 

00264                       {
00265   return(biker.bikerSim.state().u.d_y);
00266 }

double db_get_biker_speed_z  
 

00269                       {
00270   return(biker.bikerSim.state().u.d_z);
00271 }

double db_get_biker_desired_speed_x  
 

00274                               {
00275   return(biker.bikerLowControl.desiredX);
00276 }

double db_get_biker_desired_speed_y  
 

00279                               {
00280   return(biker.bikerLowControl.desiredY);
00281 }

double db_get_biker_desired_speed_z  
 

00284                               {
00285   return(0.0);
00286 }

void db_set_biker_desired_speed_x double    speed_x
 

00289                                             {
00290   biker.bikerLowControl.desiredX=speed_x;
00291 }

void db_set_biker_desired_speed_y double    speed_y
 

00294                                             {
00295   biker.bikerLowControl.desiredY=speed_y;
00296 }


Variable Documentation

totalSim biker
 


Generated on Sat Jul 19 04:01:41 2003 for SIMEX by doxygen1.2.18