28 #include <ode-dbl/common.h>
29 #include <selforg/storeable.h>
67 Pose osgPose(
const double * position ,
const double * rotation );
109 virtual void update() =0 ;
118 virtual void setColor(
const std::string& color);
121 virtual void setTexture(
const std::string& filename);
133 virtual void setTextures(
const std::vector<TextureDescr>& textures);
153 virtual bool applyForce(
double x,
double y,
double z);
160 virtual bool applyTorque(
double x,
double y,
double z);
165 virtual void setMass(
double mass,
bool density =
false) = 0;
170 void setMass(
double mass,
double cgx,
double cgy,
double cgz,
171 double I11,
double I22,
double I33,
172 double I12,
double I13,
double I23);
188 void decellerate(
double factorLin,
double factorAng);
220 virtual bool store(FILE* f)
const;
259 virtual void setMass(
double mass,
bool density =
false);
270 Box(
float lengthX,
float lengthY,
float lengthZ);
282 virtual void setMass(
double mass,
bool density =
false);
301 virtual void setMass(
double mass,
bool density =
false);
310 Capsule(
float radius,
float height);
319 virtual void setMass(
double mass,
bool density =
false);
328 Cylinder(
float radius,
float height);
337 virtual void setMass(
double mass,
bool density =
false);
362 virtual void setMass(
double mass,
bool density =
false);
385 virtual void setMass(
double mass,
bool density =
false);
434 virtual void setMass(
double mass,
bool density =
false);
465 virtual void setMass(
double mass,
bool density =
false) {}
Box(float lengthX, float lengthY, float lengthZ)
Definition: primitive.cpp:403
float thickness
Definition: primitive.h:365
Capsule primitive.
Definition: primitive.h:308
virtual void setPose(const Pose &pose)
set the pose of the primitive
Definition: primitive.cpp:799
float length
Definition: primitive.h:366
Interface for objects, that can be stored and restored to/from a file stream (binary).
Definition: storeable.h:33
bool substanceManuallySet
Definition: primitive.h:237
virtual void setVel(Pos vel)
Definition: primitive.h:473
int getNumVelocityViolations()
Definition: primitive.h:215
OSGPrimitive * osgprimitive
Definition: primitive.h:367
Data structure for accessing the ODE.
Definition: odehandle.h:44
Cylinder primitive.
Definition: primitive.h:326
Graphical capsule (a cylinder with round ends)
Definition: osgprimitive.h:198
OSGCapsule * osgcapsule
Definition: primitive.h:322
Physical substance definition, used for collision detection/treatment What we need is mu...
Definition: substance.h:103
virtual void update()
Updates the OSG nodes with ODE coordinates.
Definition: primitive.cpp:542
virtual void init(const OdeHandle &odeHandle, double mass, const OsgHandle &osgHandle, char mode=Body|Geom|Draw)
registers primitive in ODE and OSG.
Definition: primitive.cpp:573
virtual void update()
Updates the OSG nodes with ODE coordinates.
Definition: primitive.cpp:382
virtual void init(const OdeHandle &odeHandle, double mass, const OsgHandle &osgHandle, char mode=Body|Geom|Draw)
registers primitive in ODE and OSG.
Definition: primitive.cpp:363
static void setDestroyGeomFlag(bool _destroyGeom)
20091023; guettler: hack for tasked simulations; there are some problems if running in parallel mode...
Definition: primitive.h:211
virtual void update()
Updates the OSG nodes with ODE coordinates.
Definition: primitive.cpp:664
virtual OSGPrimitive * getOSGPrimitive()
returns the assoziated osg primitive if there or 0
Definition: primitive.h:463
Pose osgPose(dGeomID geom)
returns the osg (4x4) pose matrix of the ode geom
Definition: primitive.cpp:52
Graphical Mesh or arbitrary OSG model.
Definition: osgprimitive.h:253
Capsule(float radius, float height)
Definition: primitive.cpp:511
virtual void update()
Updates the OSG nodes with ODE coordinates.
Definition: primitive.h:462
osg::Vec3 toGlobal(const osg::Vec3 &pos) const
transforms the given point in local corrds of the primitive to global coordinates ...
Definition: primitive.cpp:307
Graphical box with Textures.
Definition: osgprimitive.h:159
virtual void setPosition(const Pos &pos)
set the position of the primitive (orientation is preserved)
Definition: primitive.cpp:147
Interface class for graphic primitives like spheres, boxes, and meshes, which can be drawn by OSG...
Definition: osgprimitive.h:62
virtual Pos getAngularVel() const
returns the angular velocity
Definition: primitive.cpp:203
virtual OSGPrimitive * getOSGPrimitive()
returns the assoziated osg primitive if there or 0
Definition: primitive.cpp:415
void decellerate(double factorLin, double factorAng)
applies a force to the body to decellerate its linear and angular velocity with the given factors...
Definition: primitive.cpp:278
virtual void update()
Updates the OSG nodes with ODE coordinates.
Definition: primitive.cpp:594
BoundingShape * boundshape
Definition: primitive.h:399
Sphere(float radius)
Definition: primitive.cpp:460
Sphere primitive.
Definition: primitive.h:289
dBodyID getBody() const
returns ODE bodyID if there
Definition: primitive.h:177
virtual OSGPrimitive * getOSGPrimitive()
returns the assoziated osg primitive if there or 0
Definition: primitive.cpp:361
Primitive()
Definition: primitive.cpp:82
virtual void init(const OdeHandle &odeHandle, double mass, const OsgHandle &osgHandle, char mode=Geom|Draw)
registers primitive in ODE and OSG.
Definition: primitive.cpp:632
virtual void init(const OdeHandle &odeHandle, double mass, const OsgHandle &osgHandle, char mode=Body|Geom|Draw)
registers primitive in ODE and OSG.
Definition: primitive.cpp:470
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
char mode
Definition: primitive.h:236
virtual ~Box()
Definition: primitive.cpp:411
Substance substance
Definition: primitive.h:232
Definition: primitive.h:89
virtual void setMass(double mass, bool density=false)
sets the mass of the body (uniform) if density==true then mass is interpreted as a density ...
Definition: primitive.cpp:670
virtual void setMass(double mass, bool density=false)
sets the mass of the body (uniform) if density==true then mass is interpreted as a density ...
Definition: primitive.cpp:500
Ray(double range, float thickness, float length)
Definition: primitive.cpp:614
virtual OSGPrimitive * getOSGPrimitive()
returns the assoziated osg primitive if there or 0
Definition: primitive.cpp:468
dBodyID body
Definition: primitive.h:235
virtual void update()
Updates the OSG nodes with ODE coordinates.
Definition: primitive.cpp:439
Modes
Body means that it is a dynamic object with a body.
Definition: primitive.h:89
int numVelocityViolations
number of times the maximal velocity was exceeded
Definition: primitive.h:238
virtual void setMass(double mass, bool density=false)
sets the mass of the body (uniform) if density==true then mass is interpreted as a density ...
Definition: primitive.h:465
virtual ~Mesh()
Definition: primitive.cpp:742
virtual ~Capsule()
Definition: primitive.cpp:515
Definition: primitive.h:91
dGeomID geom
Definition: primitive.h:234
float scale
Definition: primitive.h:398
virtual bool applyTorque(osg::Vec3 torque)
apply a torque (in world coordinates) to the primitive and returns true if it was possible ...
Definition: primitive.cpp:221
osg::Matrix Pose
Definition: pose.h:35
class for reading bounding shape description files (.bbox) and to create appropriate geoms ...
Definition: boundingshape.h:63
Vec3f Vec3
Definition: osgforwarddecl.h:42
void setSubstance(const Substance &substance)
Definition: primitive.cpp:315
Definition: primitive.h:89
virtual void setMass(double mass, bool density=false)
sets the mass of the body (uniform) if density==true then mass is interpreted as a density ...
Definition: primitive.cpp:551
holds texture file and repeat information.
Definition: osgprimitive.h:42
virtual ~Plane()
Definition: primitive.cpp:357
int globalNumVelocityViolations
counts number of max velocity violations at joints (Attention, this is a global variable, initialized to 0 at start)
Definition: primitive.cpp:48
Definition: primitive.h:89
Graphical sphere.
Definition: osgprimitive.h:184
Interface class for primitives represented in the physical and graphical world.
Definition: primitive.h:80
virtual ~Ray()
Definition: primitive.cpp:626
virtual bool store(FILE *f) const
stores the object to the given file stream (ASCII preferred).
Definition: primitive.cpp:320
virtual Pos getVel() const
returns the velocity
Definition: primitive.h:476
virtual Pos getPosition() const
returns the position
Definition: primitive.h:470
virtual Pose getPose() const
returns the pose
Definition: primitive.cpp:187
Definition: primitive.h:90
virtual void setMass(double mass, bool density=false)=0
sets the mass of the body (uniform) if density==true then mass is interpreted as a density ...
Definition: primitive.h:90
bool limitAngularVel(double maxVel)
checks whether the object has higher velocity than maxVel and limits it in case
Definition: primitive.cpp:261
Pose poseWithoutBodyAndGeom
Definition: primitive.h:400
virtual OSGPrimitive * getOSGPrimitive()
returns the assoziated osg primitive if there or 0
Definition: primitive.cpp:571
virtual void setMass(double mass, bool density=false)
sets the mass of the body (uniform) if density==true then mass is interpreted as a density ...
Definition: primitive.cpp:841
Mesh primitive.
Definition: primitive.h:374
Box primitive.
Definition: primitive.h:267
virtual bool applyForce(osg::Vec3 force)
apply a force (in world coordinates) to the primitive and returns true if it was possible ...
Definition: primitive.cpp:209
Ray primitive The actual visual representation can have different length than the ray object...
Definition: primitive.h:347
virtual void setTextures(const std::vector< TextureDescr > &textures)
assign a set of texture to the surfaces of the primitive
Definition: primitive.cpp:142
virtual void init(const OdeHandle &odeHandle, double mass, const OsgHandle &osgHandle, char mode=Body|Geom|Draw)
registers primitive in ODE and OSG.
Definition: primitive.cpp:748
virtual ~Sphere()
Definition: primitive.cpp:464
dGeomID getGeom() const
returns ODE geomID if there
Definition: primitive.h:175
virtual ~Primitive()
Definition: primitive.cpp:86
virtual void update()
Updates the OSG nodes with ODE coordinates.
Definition: primitive.cpp:491
OSGPlane * osgplane
Definition: primitive.h:262
virtual void setBoundingShape(BoundingShape *boundingShape)
Sets the BoundingShape externally (e.g.
Definition: primitive.cpp:793
Mesh(const std::string &filename, float scale)
Definition: primitive.cpp:737
OSGSphere * osgsphere
Definition: primitive.h:304
virtual void setPosition(Pos pos)
Definition: primitive.h:467
virtual void setPose(const Pose &pose)
set the pose of the primitive
Definition: primitive.cpp:156
virtual void update()=0
Updates the OSG nodes with ODE coordinates.
osg::Vec3 toLocal(const osg::Vec3 &pos) const
return the given point transformed to local coordinates of the primitive
Definition: primitive.cpp:293
static bool destroyGeom
Definition: primitive.h:243
virtual Pos getVel() const
returns the velocity
Definition: primitive.cpp:197
virtual ~Cylinder()
Definition: primitive.cpp:567
virtual void setColor(const Color &color)
sets the color for the underlaying osgprimitive
Definition: primitive.cpp:116
virtual bool restore(FILE *f)
loads the object from the given file stream (ASCII preferred).
Definition: primitive.cpp:332
void setLength(float len)
Definition: primitive.cpp:648
virtual void update()
Updates the OSG nodes with ODE coordinates.
Definition: primitive.cpp:826
Plane primitive.
Definition: primitive.h:248
Cylinder(float radius, float height)
Definition: primitive.cpp:563
DummyPrimitive()
Definition: primitive.h:455
virtual void setMass(double mass, bool density=false)
sets the mass of the body (uniform) if density==true then mass is interpreted as a density ...
Definition: primitive.cpp:391
Definition: primitive.h:91
Vec4f Vec4
Definition: osgforwarddecl.h:44
virtual Pos getPosition() const
returns the position
Definition: primitive.cpp:181
Graphical cylinder.
Definition: osgprimitive.h:215
virtual void init(const OdeHandle &odeHandle, double mass, const OsgHandle &osgHandle, char mode=Body|Geom|Draw)
registers primitive in ODE and OSG.
Definition: primitive.cpp:521
Plane()
Definition: primitive.cpp:353
bool limitLinearVel(double maxVel)
checks whether the object has higher velocity than maxVel and limits it in case
Definition: primitive.cpp:245
virtual void setTexture(const std::string &filename)
assigns a texture to the primitive
Definition: primitive.cpp:127
virtual void init(const OdeHandle &odeHandle, double mass, const OsgHandle &osgHandle, char mode=Body|Geom|Draw)=0
registers primitive in ODE and OSG.
OSGBoxTex * osgbox
Definition: primitive.h:284
Dummy Primitive which returns 0 for geom and body.
Definition: primitive.h:452
Graphical plane (represented as a large thin box, because OSG does not draw planes) ...
Definition: osgprimitive.h:130
virtual float getRadius()
Definition: primitive.cpp:824
virtual void setMass(double mass, bool density=false)
sets the mass of the body (uniform) if density==true then mass is interpreted as a density ...
Definition: primitive.cpp:448
const std::string filename
Definition: primitive.h:397
virtual OSGPrimitive * getOSGPrimitive()
returns the assoziated osg primitive if there or 0
Definition: primitive.cpp:746
Definition: primitive.h:89
void odeRotation(const Pose &pose, dMatrix3 &odematrix)
converts the rotation component of pose into an ode rotation matrix
Definition: primitive.cpp:70
virtual OSGPrimitive * getOSGPrimitive()=0
returns the assoziated osg primitive if there or 0
double range
Definition: primitive.h:364
virtual OSGPrimitive * getOSGPrimitive()
returns the assoziated osg primitive if there or 0
Definition: primitive.cpp:630
Category
Definition: primitive.h:91
virtual void init(const OdeHandle &odeHandle, double mass, const OsgHandle &osgHandle, char mode=Body|Geom|Draw)
registers primitive in ODE and OSG.
Definition: primitive.cpp:417
virtual void attachGeomAndSetColliderFlags()
attaches geom to body (if any) and sets the category bits and collision bitfields.
Definition: primitive.cpp:97
virtual OSGPrimitive * getOSGPrimitive()
returns the assoziated osg primitive if there or 0
Definition: primitive.cpp:519
OSGCylinder * osgcylinder
Definition: primitive.h:339
virtual void init(const OdeHandle &odeHandle, double mass, const OsgHandle &osgHandle, char mode=Body|Geom|Draw)
registers primitive in ODE and OSG.
Definition: primitive.h:459
virtual void setMass(double mass, bool density=false)
sets the mass of the body (uniform) if density==true then mass is interpreted as a density ...
Definition: primitive.cpp:603
OSGMesh * osgmesh
Definition: primitive.h:396