![]() |
An open-source, flexible 3D physical simulation framework
|
#include <JointPhysics.h>
Public Member Functions | |
JointPhysics (interfaces::PhysicsInterface *world) | |
the constructor More... | |
virtual | ~JointPhysics (void) |
the destructor More... | |
virtual bool | createJoint (interfaces::JointData *joint, const interfaces::NodeInterface *node1, const interfaces::NodeInterface *node2) |
create Joint getting as argument the JointData which give the joint informations. More... | |
virtual void | getAnchor (utils::Vector *anchor) const |
get the anchor of the joint More... | |
virtual void | setAnchor (const utils::Vector &anchor) |
set the anchor i.e. the position where the joint is created of the joint More... | |
virtual void | setAxis (const utils::Vector &axis) |
set the world informations More... | |
virtual void | setAxis2 (const utils::Vector &axis) |
Set the Axis2 of the Joint. More... | |
virtual void | getAxis (utils::Vector *axis) const |
Gets the actual axis of a joint. More... | |
virtual void | getAxis2 (utils::Vector *axis) const |
Gets the actual second axis of a joint. More... | |
virtual void | setWorldObject (interfaces::PhysicsInterface *world) |
set the world informations More... | |
virtual void | setForceLimit (interfaces::sReal max_force) |
virtual void | setForceLimit2 (interfaces::sReal max_force) |
virtual void | setVelocity (interfaces::sReal velocity) |
virtual void | setVelocity2 (interfaces::sReal velocity) |
virtual interfaces::sReal | getVelocity (void) const |
virtual interfaces::sReal | getVelocity2 (void) const |
virtual void | setJointAsMotor (int axis) |
virtual void | unsetJointAsMotor (int axis) |
virtual interfaces::sReal | getPosition (void) const |
virtual interfaces::sReal | getPosition2 (void) const |
virtual void | getForce1 (utils::Vector *f) const |
Gets the force the joint applies to the first body. More... | |
virtual void | getForce2 (utils::Vector *f) const |
Gets the force the joint applies to the second body. More... | |
virtual void | getTorque1 (utils::Vector *t) const |
Gets the torque the joint applies to the first body. More... | |
virtual void | getTorque2 (utils::Vector *t) const |
Gets the torque the joint applies to the second body. More... | |
virtual void | setTorque (interfaces::sReal torque) |
virtual void | setTorque2 (interfaces::sReal torque) |
virtual void | reattacheJoint (void) |
reset the achor to the actual position. More... | |
virtual void | update (void) |
we need to calculate the axis torques and joint load before we can return it. More... | |
virtual void | getJointLoad (utils::Vector *t) const |
virtual void | getAxisTorque (utils::Vector *t) const |
Return the torque vector for the first axis of the joint. More... | |
virtual void | getAxis2Torque (utils::Vector *t) const |
virtual void | changeStepSize (const interfaces::JointData &jointS) |
virtual interfaces::sReal | getMotorTorque (void) const |
virtual interfaces::sReal | getLowStop () const |
virtual interfaces::sReal | getHighStop () const |
virtual interfaces::sReal | getLowStop2 () const |
virtual interfaces::sReal | getHighStop2 () const |
virtual void | setLowStop (interfaces::sReal lowStop) |
virtual void | setHighStop (interfaces::sReal highStop) |
virtual void | setLowStop2 (interfaces::sReal lowStop2) |
virtual void | setHighStop2 (interfaces::sReal highStop2) |
![]() | |
virtual | ~JointInterface () |
Private Member Functions | |
void | calculateCfmErp (const interfaces::JointData *jointS) |
void | createHinge (interfaces::JointData *jointS, dBodyID body1, dBodyID body2) |
create a joint from type Hing More... | |
void | createHinge2 (interfaces::JointData *jointS, dBodyID body1, dBodyID body2) |
Creates a hinge2 joint in the physical environment. More... | |
void | createSlider (interfaces::JointData *jointS, dBodyID body1, dBodyID body2) |
void | createBall (interfaces::JointData *jointS, dBodyID body1, dBodyID body2) |
void | createUniversal (interfaces::JointData *jointS, dBodyID body1, dBodyID body2) |
Creates a universal joint in the physical environment. More... | |
void | createFixed (interfaces::JointData *jointS, dBodyID body1, dBodyID body2) |
Creates a fixed joint in the physical environment. More... | |
Private Attributes | |
WorldPhysics * | theWorld |
dJointID | jointId |
dJointID | ball_motor |
dJointFeedback | feedback |
dBodyID | body1 |
dBodyID | body2 |
int | joint_type |
dReal | cfm |
dReal | cfm1 |
dReal | cfm2 |
dReal | erp1 |
dReal | erp2 |
dReal | lo1 |
dReal | lo2 |
dReal | hi1 |
dReal | hi2 |
dReal | damping |
dReal | spring |
dReal | jointCFM |
utils::Vector | axis1_torque |
utils::Vector | axis2_torque |
utils::Vector | joint_load |
dReal | motor_torque |
Definition at line 36 of file JointPhysics.h.
mars::sim::JointPhysics::JointPhysics | ( | interfaces::PhysicsInterface * | world | ) |
the constructor
the constructor of the Joint physics initialize the attributes of the object
Definition at line 48 of file JointPhysics.cpp.
|
virtual |
the destructor
Destroys the joint in the physics world.
pre:
post:
Definition at line 69 of file JointPhysics.cpp.
|
private |
Definition at line 77 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1189 of file JointPhysics.cpp.
|
private |
Definition at line 427 of file JointPhysics.cpp.
|
private |
Creates a fixed joint in the physical environment.
For static fixed objects a same group id is prefered, the fixed joint should only be used to dynamically connect and unconnect nodes.
pre:
post:
Definition at line 1085 of file JointPhysics.cpp.
|
private |
create a joint from type Hing
Creates a hinge joint in the physical environment.
We get a problem here. There two different way how a hinge joint can be used. First is can be used only as joint. So we should set the low and height stop to zero and use the stopcfm and stoperp values to simulate the spring-damping properties of the joint. The second case is, to use the hinge to simulate a motor. I don't know how the ode behavior will look like, if we set the same parameter and use the force and velocity params to simulate a motor.
Definition at line 322 of file JointPhysics.cpp.
|
private |
Creates a hinge2 joint in the physical environment.
pre:
post:
Definition at line 366 of file JointPhysics.cpp.
|
virtual |
create Joint getting as argument the JointData which give the joint informations.
create the joint with the informations giving from jointS
Implements mars::interfaces::JointInterface.
Definition at line 110 of file JointPhysics.cpp.
|
private |
Definition at line 400 of file JointPhysics.cpp.
|
private |
Creates a universal joint in the physical environment.
pre:
post:
Definition at line 477 of file JointPhysics.cpp.
|
virtual |
get the anchor of the joint
Implements mars::interfaces::JointInterface.
Definition at line 175 of file JointPhysics.cpp.
|
virtual |
Gets the actual axis of a joint.
pre:
post:
Implements mars::interfaces::JointInterface.
Definition at line 618 of file JointPhysics.cpp.
|
virtual |
Gets the actual second axis of a joint.
pre:
post:
Implements mars::interfaces::JointInterface.
Definition at line 656 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 902 of file JointPhysics.cpp.
|
virtual |
Return the torque vector for the first axis of the joint.
v1[0] = b1_pos[0] - anchor[0]; v1[1] = b1_pos[1] - anchor[1]; v1[2] = b1_pos[2] - anchor[2]; radius = dSqrt(v1[0]*v1[0]+ v1[1]*v1[1]+ v1[2]*v1[2]); normal[0] = axis[1]*v1[2] - axis[2]*v1[1]; normal[1] = -axis[0]*v1[2] + axis[2]*v1[0]; normal[2] = axis[0]*v1[1] - axis[1]*v1[0]; dot = (normal[0]*feedback.f1[0]+ normal[1]*feedback.f1[1]+ normal[2]*feedback.f1[2]); normal[0] *= dot*radius; normal[1] *= dot*radius; normal[2] *= dot*radius;
Implements mars::interfaces::JointInterface.
Definition at line 896 of file JointPhysics.cpp.
|
virtual |
Gets the force the joint applies to the first body.
pre:
post:
Implements mars::interfaces::JointInterface.
Definition at line 776 of file JointPhysics.cpp.
|
virtual |
Gets the force the joint applies to the second body.
pre:
post:
Implements mars::interfaces::JointInterface.
Definition at line 791 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1317 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1343 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1067 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1302 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1332 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1298 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 277 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 297 of file JointPhysics.cpp.
|
virtual |
Gets the torque the joint applies to the first body.
pre:
post:
Implements mars::interfaces::JointInterface.
Definition at line 806 of file JointPhysics.cpp.
|
virtual |
Gets the torque the joint applies to the second body.
pre:
post:
Implements mars::interfaces::JointInterface.
Definition at line 821 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1098 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1123 of file JointPhysics.cpp.
|
virtual |
reset the achor to the actual position.
If a Node is moved or rotated by the editor, this function resets the constrains the joint applies to the Nodes that are connected.
pre:
post:
Implements mars::interfaces::JointInterface.
Definition at line 838 of file JointPhysics.cpp.
|
virtual |
set the anchor i.e. the position where the joint is created of the joint
Implements mars::interfaces::JointInterface.
Definition at line 520 of file JointPhysics.cpp.
|
virtual |
set the world informations
Set the Axis of the Joint to a new position.
pre:
post:
Implements mars::interfaces::JointInterface.
Definition at line 553 of file JointPhysics.cpp.
|
virtual |
Set the Axis2 of the Joint.
pre:
post:
Implements mars::interfaces::JointInterface.
Definition at line 585 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 205 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 224 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1372 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1402 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 690 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1354 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1390 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1146 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 1169 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 241 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 260 of file JointPhysics.cpp.
|
virtual |
set the world informations
Implements mars::interfaces::JointInterface.
Definition at line 686 of file JointPhysics.cpp.
|
virtual |
Implements mars::interfaces::JointInterface.
Definition at line 733 of file JointPhysics.cpp.
|
virtual |
we need to calculate the axis torques and joint load before we can return it.
Implements mars::interfaces::JointInterface.
Definition at line 913 of file JointPhysics.cpp.
|
private |
Definition at line 99 of file JointPhysics.h.
|
private |
Definition at line 99 of file JointPhysics.h.
|
private |
Definition at line 92 of file JointPhysics.h.
|
private |
Definition at line 94 of file JointPhysics.h.
|
private |
Definition at line 94 of file JointPhysics.h.
|
private |
Definition at line 96 of file JointPhysics.h.
|
private |
Definition at line 96 of file JointPhysics.h.
|
private |
Definition at line 96 of file JointPhysics.h.
|
private |
Definition at line 98 of file JointPhysics.h.
|
private |
Definition at line 96 of file JointPhysics.h.
|
private |
Definition at line 96 of file JointPhysics.h.
|
private |
Definition at line 93 of file JointPhysics.h.
|
private |
Definition at line 97 of file JointPhysics.h.
|
private |
Definition at line 97 of file JointPhysics.h.
|
private |
Definition at line 99 of file JointPhysics.h.
|
private |
Definition at line 95 of file JointPhysics.h.
|
private |
Definition at line 98 of file JointPhysics.h.
|
private |
Definition at line 92 of file JointPhysics.h.
|
private |
Definition at line 97 of file JointPhysics.h.
|
private |
Definition at line 97 of file JointPhysics.h.
|
private |
Definition at line 100 of file JointPhysics.h.
|
private |
Definition at line 98 of file JointPhysics.h.
|
private |
Definition at line 91 of file JointPhysics.h.