iCub-main
OdeInit.h
Go to the documentation of this file.
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 /*
4 * Copyright (C) 2010 RobotCub Consortium, European Commission FP6 Project IST-004370
5 * Author: Vadim Tikhanoff
6 * email: vadim.tikhanoff@iit.it
7 * website: www.robotcub.org
8 * Permission is granted to copy, distribute, and/or modify this program
9 * under the terms of the GNU General Public License, version 2 or any
10 * later version published by the Free Software Foundation.
11 *
12 * A copy of the license can be found at
13 * http://www.robotcub.org/icub/license/gpl.txt
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
18 * Public License for more details
19 */
29 #ifndef ICUBSIMULATION_ODEINIT_INC
30 #define ICUBSIMULATION_ODEINIT_INC
31 
32 #include "iCub.h"
33 #include "world.h"
34 #include <time.h>
35 #include <yarp/os/Semaphore.h>
36 #include "iCubLogicalJoints.h"
37 #include "iCubSimulationControl.h"
38 //#include <vector>
39 
40 #include "RobotConfig.h"
41 
42 #include <list>
43 
44 using namespace std;
45 using namespace yarp::dev;
46 
47 class ICubSim;
48 
54 class OdeInit {
55 public:
56  double SimTime;
57  dWorldID world;
58  dSpaceID space;
59  dJointGroupID contactgroup;
60  dGeomID ground;
61  //dJointFeedback *feedback;
62  //dJointFeedback *feedback1;
63  //dJointFeedback *feedback_mat;
64  yarp::os::Semaphore mutex;
65  yarp::os::Semaphore mutexTexture;
68  bool stop;
69  bool sync;
70  //bool verbose;
71  int verbosity;
72  string name;
74  double contactFrictionCoefficient; //unlike the other ODE params fron .ini file that are used to intiialize the properties of the simulation (dWorldSet...),
75  //This parameter is employed on the run as contact joints are created (in OdeSdlSimulation::nearCallback() )
76  //for whole_body_skin_emul
77  struct contactOnSkin_t {
78  dGeomID body_geom_id;
80  int body_index; //if there are two iCub bodies colliding, they share the same contact geom and joint - but we need to know that they are two different
81  dContactGeom contact_geom;
82  dJointID contact_joint;
83  };
84  list<contactOnSkin_t> listOfSkinContactInfos;
85 
86 
87  void setName( string module ){
88  name = module;
89  }
90  string getName(){
91  return name;
92  }
93 
94  ~OdeInit();
95 
96  void setSimulationControl(iCubSimulationControl *control, int part);
97  void removeSimulationControl(int part);
98  static OdeInit& init(RobotConfig *config);
99  void sendHomePos();
100 
101  static OdeInit& get();
102 
103  static void destroy();
104 
105  static void printGeomClassAndNr(int geom_class, int geom_nr);
106  static void printInfoOnSpace(dSpaceID my_space,const std::string & my_space_name);
107 
108 
109 private:
110  OdeInit(RobotConfig *config);
111  static OdeInit *_odeinit;
112 
114 };
115 
116 #endif
static RobotConfig * robot_config
Definition: iCub_Sim.cpp:89
yarp::os::Semaphore mutex
Definition: OdeInit.h:64
yarp::os::Semaphore mutexTexture
Definition: OdeInit.h:65
bool sync
Definition: OdeInit.h:69
dSpaceID body_geom_space_id
Definition: OdeInit.h:79
int verbosity
Definition: OdeInit.h:71
The iCub header file.
Definition: iCub.h:75
ICubSim * _iCub
Definition: OdeInit.h:66
string getName()
Definition: OdeInit.h:90
dWorldID world
Definition: OdeInit.h:57
STL namespace.
dGeomID ground
Definition: OdeInit.h:60
list< contactOnSkin_t > listOfSkinContactInfos
Definition: OdeInit.h:84
double contactFrictionCoefficient
Definition: OdeInit.h:74
dSpaceID space
Definition: OdeInit.h:58
iCubSimulationControl ** _controls
Definition: OdeInit.h:73
Header for the world creation.
dJointID contact_joint
Definition: OdeInit.h:82
ODE state information.
Definition: OdeInit.h:54
dJointGroupID contactgroup
Definition: OdeInit.h:59
dContactGeom contact_geom
Definition: OdeInit.h:81
void setName(string module)
Definition: OdeInit.h:87
worldSim * _wrld
Definition: OdeInit.h:67
string name
Definition: OdeInit.h:72
bool stop
Definition: OdeInit.h:68
double SimTime
Definition: OdeInit.h:56
This is the header file for the yarp interface of the iCubSimulation.