AnimatLab  2
Test
BlPrismatic.cpp
Go to the documentation of this file.
1 
7 #include "StdAfx.h"
8 #include "BlJoint.h"
9 #include "BlMotorizedJoint.h"
10 #include "BlPrismaticLimit.h"
11 #include "BlRigidBody.h"
12 #include "BlPrismatic.h"
13 #include "BlSimulator.h"
14 
15 namespace BulletAnimatSim
16 {
17  namespace Environment
18  {
19  namespace Joints
20  {
21 
29 {
30  SetThisPointers();
31  m_btPrismatic = NULL;
32 
36 
37  m_lpUpperLimit->LimitPos(1, false);
38  m_lpLowerLimit->LimitPos(-1, false);
39  m_lpPosFlap->LimitPos(Prismatic::JointPosition(), false);
41 
42  m_lpUpperLimit->Color(0, 0, 1, 1);
43  m_lpLowerLimit->Color(1, 1, 0.333, 1);
44  m_lpPosFlap->Color(1, 0, 1, 1);
45 
48 }
49 
57 {
58  //ConstraintLimits are deleted in the base objects.
59  try
60  {
61  DeleteGraphics();
62  DeletePhysics(false);
63  }
64  catch(...)
65  {Std_TraceMsg(0, "Caught Error in desctructor of BlPrismatic/\r\n", "", -1, false, true);}
66 }
67 
68 
70 {
71  Prismatic::EnableLimits(bVal);
72 
73  SetLimitValues();
74 }
75 
76 void BlPrismatic::SetLimitValues()
77 {
78  if(m_lpSim && m_btJoint && m_btPrismatic)
79  {
80  GetLimitsFromRelaxations(m_vLowerLinear, m_vUpperLinear, m_vLowerAngular, m_vUpperAngular);
81 
82  float fltErp = 0, fltCfm=0;
83 
84  if(m_bEnableLimits)
85  {
86  m_bJointLocked = false;
87 
88  m_vLowerLinear[0] = m_lpLowerLimit->LimitPos();
89  m_vUpperLinear[0] = m_lpUpperLimit->LimitPos();
90 
91  float fltKp = m_lpUpperLimit->Stiffness();
92  float fltKd = m_lpUpperLimit->Damping();
93  float fltH = m_lpSim->PhysicsTimeStep()*1000;
94 
95  fltErp = (fltH*fltKp)/((fltH*fltKp) + fltKd);
96  fltCfm = 1/((fltH*fltKp) + fltKd);
97  }
98  else
99  {
100  //To disable limits in bullet we need the lower limit to be bigger than the upper limit
101  m_bJointLocked = false;
102 
103  m_vLowerLinear[0] = 1;
104  m_vUpperLinear[0] = -1;
105  }
106 
107  m_btPrismatic->setParam(BT_CONSTRAINT_STOP_CFM, fltCfm, 0);
108  m_btPrismatic->setParam(BT_CONSTRAINT_STOP_ERP, fltErp, 0);
109 
110  float fltBounce = m_lpUpperLimit->Restitution();
111  float fltHigh = m_btPrismatic->getTranslationalLimitMotor()->m_restitution = fltBounce;
112 
113  m_btPrismatic->setLinearLowerLimit(m_vLowerLinear);
114  m_btPrismatic->setLinearUpperLimit(m_vUpperLinear);
115 
116  m_btPrismatic->setAngularLowerLimit(m_vLowerAngular);
117  m_btPrismatic->setAngularUpperLimit(m_vUpperAngular);
118  }
119 }
120 
122 {
123  Prismatic::TimeStepModified();
124  SetLimitValues();
125 }
126 
127 void BlPrismatic::JointPosition(float fltPos)
128 {
129  m_fltPosition = fltPos;
130  if(m_lpPosFlap)
131  m_lpPosFlap->LimitPos(fltPos);
132 }
133 
134 
135 void BlPrismatic::SetAlpha()
136 {
137  BlJoint::SetAlpha();
138 
142 }
143 
144 void BlPrismatic::DeleteJointGraphics()
145 {
146  OsgPrismaticLimit *lpUpperLimit = dynamic_cast<OsgPrismaticLimit *>(m_lpUpperLimit);
147  OsgPrismaticLimit *lpLowerLimit = dynamic_cast<OsgPrismaticLimit *>(m_lpLowerLimit);
148  OsgPrismaticLimit *lpPosFlap = dynamic_cast<OsgPrismaticLimit *>(m_lpPosFlap);
149 
150  OsgPrismatic::DeletePrismaticGraphics(m_osgJointMT, lpUpperLimit, lpLowerLimit, lpPosFlap);
151 
155 }
156 
157 void BlPrismatic::CreateJointGraphics()
158 {
159  OsgPrismaticLimit *lpUpperLimit = dynamic_cast<OsgPrismaticLimit *>(m_lpUpperLimit);
160  OsgPrismaticLimit *lpLowerLimit = dynamic_cast<OsgPrismaticLimit *>(m_lpLowerLimit);
161  OsgPrismaticLimit *lpPosFlap = dynamic_cast<OsgPrismaticLimit *>(m_lpPosFlap);
162 
163  m_lpPosFlap->LimitPos(Prismatic::JointPosition());
164  OsgPrismatic::CreatePrismaticGraphics(BoxSize(), CylinderRadius(),
165  m_osgJointMT, lpUpperLimit,
166  lpLowerLimit, lpPosFlap);
167 }
168 
169 void BlPrismatic::SetupPhysics()
170 {
171  if(m_btJoint)
172  DeletePhysics(false);
173 
174  InitBaseJointPointers(m_lpParent, m_lpChild, m_aryRelaxations, 0);
175 
176  btTransform mtJointRelParent, mtJointRelChild;
177  CStdFPoint vRot(0, 0, osg::PI);
178  CalculateRelativeJointMatrices(vRot, mtJointRelParent, mtJointRelChild);
179 
180  m_btPrismatic = new btAnimatGeneric6DofConstraint(*m_lpBlParent->Part(), *m_lpBlChild->Part(), mtJointRelParent, mtJointRelChild, false);
181 
182  GetBlSimulator()->DynamicsWorld()->addConstraint(m_btPrismatic, true);
183  m_btPrismatic->setDbgDrawSize(btScalar(5.f));
184 
185  BlPrismaticLimit *lpUpperLimit = dynamic_cast<BlPrismaticLimit *>(m_lpUpperLimit);
186  BlPrismaticLimit *lpLowerLimit = dynamic_cast<BlPrismaticLimit *>(m_lpLowerLimit);
187 
188  m_btJoint = m_btPrismatic;
189  m_bt6DofJoint = m_btPrismatic;
190 
191  //Re-enable the limits once we have initialized the joint
193 
194  //If the motor is enabled then it will start out with a velocity of zero.
196 
197  //Turn off sleeping thresholds for parent and child of prismatic joints to prevent the parts from
198  //falling asleep. If it does the joint motor has a tendency to not work.
199  if(m_lpBlParent && m_lpBlParent->Part())
200  m_lpBlParent->Part()->setSleepingThresholds(0, 0);
201 
202  if(m_lpBlChild && m_lpBlChild->Part())
203  m_lpBlChild->Part()->setSleepingThresholds(0, 0);
204 
205  m_btPrismatic->setJointFeedback(&m_btJointFeedback);
206 
207  Prismatic::Initialize();
208  BlJoint::Initialize();
209 }
210 
212 {
213  SetupGraphics();
214  SetupPhysics();
215 }
216 
217 
218 #pragma region DataAccesMethods
219 
220 float *BlPrismatic::GetDataPointer(const std::string &strDataType)
221 {
222  float *lpData=NULL;
223  std::string strType = Std_CheckString(strDataType);
224 
225  if(strType == "JOINTROTATION")
226  return &m_fltPosition;
227  else if(strType == "JOINTPOSITION")
228  return &m_fltPosition;
229  else if(strType == "JOINTACTUALVELOCITY")
230  return &m_fltVelocity;
231  else if(strType == "JOINTFORCE")
232  return &m_fltForce;
233  else if(strType == "JOINTDESIREDPOSITION")
234  return &m_fltReportSetPosition;
235  else if(strType == "JOINTSETPOSITION")
236  return &m_fltReportSetPosition;
237  else if(strType == "JOINTDESIREDVELOCITY")
238  return &m_fltReportSetVelocity;
239  else if(strType == "JOINTSETVELOCITY")
240  return &m_fltReportSetVelocity;
241  else if(strType == "ENABLE")
242  return &m_fltEnabled;
243  else if(strType == "CONTACTCOUNT")
244  THROW_PARAM_ERROR(Al_Err_lMustBeContactBodyToGetCount, Al_Err_strMustBeContactBodyToGetCount, "JointID", m_strName);
245  else
246  {
247  lpData = BlMotorizedJoint::Physics_GetDataPointer(strType);
248  if(lpData) return lpData;
249 
250  lpData = Prismatic::GetDataPointer(strType);
251  if(lpData) return lpData;
252 
253  THROW_TEXT_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "JointID: " + STR(m_strName) + " DataType: " + strDataType);
254  }
255 
256  return lpData;
257 }
258 
259 bool BlPrismatic::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError)
260 {
261  if(BlJoint::Physics_SetData(strDataType, strValue))
262  return true;
263 
264  if(Prismatic::SetData(strDataType, strValue, false))
265  return true;
266 
267  //If it was not one of those above then we have a problem.
268  if(bThrowError)
269  THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType);
270 
271  return false;
272 }
273 
274 void BlPrismatic::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
275 {
276  BlJoint::Physics_QueryProperties(aryProperties);
277  Prismatic::QueryProperties(aryProperties);
278 
279  aryProperties.Add(new TypeProperty("JointRotation", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
280  aryProperties.Add(new TypeProperty("JointPosition", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
281  aryProperties.Add(new TypeProperty("JointActualVelocity", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
282  aryProperties.Add(new TypeProperty("JointForce", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
283  aryProperties.Add(new TypeProperty("JointRotationDeg", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
284  aryProperties.Add(new TypeProperty("JointDesiredPosition", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
285  aryProperties.Add(new TypeProperty("JointSetPosition", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
286  aryProperties.Add(new TypeProperty("JointDesiredVelocity", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
287  aryProperties.Add(new TypeProperty("JointSetVelocity", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
288  aryProperties.Add(new TypeProperty("Enable", AnimatPropertyType::Boolean, AnimatPropertyDirection::Get));
289 }
290 
291 #pragma endregion
292 
294 {
296  //int iTest = 0;
297  //if(m_lpSim->Time() >= 1.02)
298  // iTest = 1;
299 
300  UpdateData();
303 }
304 
305 bool BlPrismatic::JointIsLocked()
306 {
307  btVector3 vLower, vUpper;
308  m_btPrismatic->getLinearLowerLimit(vLower);
309  m_btPrismatic->getLinearUpperLimit(vUpper);
310  if( (vLower[0] == vUpper[0]) || (vLower[0] > vUpper[0]) )
311  return true;
312  else
313  return false;
314 }
315 
316 
317 void BlPrismatic::Physics_EnableLock(bool bOn, float fltPosition, float fltMaxLockForce)
318 {
319  if (m_btJoint && m_btPrismatic)
320  {
321  if(bOn)
322  {
323  m_bJointLocked = true;
324 
325  m_vLowerLinear[0] = m_vUpperLinear[0] = fltPosition;
326 
327  m_btPrismatic->setLinearLowerLimit(m_vLowerLinear);
328  m_btPrismatic->setLinearUpperLimit(m_vUpperLinear);
329 
330  m_btPrismatic->enableSpring(0, false);
331  m_btPrismatic->getTranslationalLimitMotor()->m_enableMotor[0] = true;
332  m_btPrismatic->getTranslationalLimitMotor()->m_targetVelocity[0] = 0;
333  m_btPrismatic->getTranslationalLimitMotor()->m_maxMotorForce[0] = fltMaxLockForce;
334  }
335  else if (m_bMotorOn)
336  Physics_EnableMotor(true, 0, fltMaxLockForce, false);
337  else
338  SetLimitValues();
339  }
340 }
341 
342 void BlPrismatic::Physics_EnableMotor(bool bOn, float fltDesiredVelocity, float fltMaxForce, bool bForceWakeup)
343 {
344  if (m_btJoint && m_btPrismatic)
345  {
346  if(bOn)
347  {
348  //if(Std_ToLower(m_lpThisJoint->ID()) == "61cbf08d-4625-4b9f-87cd-d08b778cf04e" && GetSimulator()->Time() >= 1.01)
349  // bOn = bOn; //Testing
350 
351  //I had to cut this if statement out. I kept running into one instance after another where I ran inot a problem if I did not do this every single time.
352  // It is really annoying and inefficient, but I cannot find another way to reiably guarantee that the motor will behave coorectly under all conditions without
353  // doing this every single time I set the motor velocity.
354  //if(!m_bMotorOn || bForceWakeup || m_bJointLocked || JointIsLocked() || fabs(m_btPrismatic->getTranslationalLimitMotor()->m_targetVelocity[0]) < 1e-4)
355  //{
356  SetLimitValues();
357  m_lpThisJoint->WakeDynamics();
358  //}
359 
360  m_btPrismatic->enableSpring(0, false);
361  m_btPrismatic->getTranslationalLimitMotor()->m_enableMotor[0] = true;
362  m_btPrismatic->getTranslationalLimitMotor()->m_targetVelocity[0] = -fltDesiredVelocity;
363  m_btPrismatic->getTranslationalLimitMotor()->m_maxMotorForce[0] = fltMaxForce;
364  }
365  else
366  {
367  TurnMotorOff();
368 
369  if(m_bMotorOn || bForceWakeup || m_bJointLocked || JointIsLocked())
370  {
371  m_iAssistCountdown = 3;
373  m_lpThisJoint->WakeDynamics();
374  SetLimitValues();
375  }
376  }
377 
378  m_bMotorOn = bOn;
379  }
380 }
381 
382 void BlPrismatic::Physics_MaxForce(float fltVal)
383 {
384  if(m_btJoint && m_btPrismatic)
385  m_btPrismatic->getTranslationalLimitMotor()->m_maxMotorForce[0] = fltVal;
386 }
387 
388 float BlPrismatic::GetCurrentBtPosition()
389 {
390  if(m_btJoint && m_btPrismatic)
391  {
392  btVector3 vDiff = m_btPrismatic->getTranslationalLimitMotor()->m_currentLinearDiff;
393  return vDiff[0];
394  }
395  else
396  return 0;
397 }
398 
399 void BlPrismatic::TurnMotorOff()
400 {
401  if(m_btPrismatic)
402  {
404  {
405  //If we have the spring enabled then use that.
406  m_btPrismatic->enableSpring(0, true);
407  }
408  else if(m_lpFriction && m_lpFriction->Enabled())
409  {
410  //Otherwise if we have friction enable use it.
411 
412  //0.032 is a coefficient that produces friction behavior in bullet using the same coefficient values
413  //that were specified in vortex engine. This way I get similar behavior between the two.
414  float maxMotorImpulse = m_lpFriction->Coefficient()*0.032f*(m_lpThisAB->GetSimulator()->InverseMassUnits() * m_lpThisAB->GetSimulator()->InverseDistanceUnits());
415  m_btPrismatic->enableSpring(0, false);
416  m_btPrismatic->getTranslationalLimitMotor()->m_enableMotor[0] = true;
417  m_btPrismatic->getTranslationalLimitMotor()->m_targetVelocity[0] = 0;
418  m_btPrismatic->getTranslationalLimitMotor()->m_maxMotorForce[0] = maxMotorImpulse;
419  }
420  else //Otherwise just turn the motor off
421  {
422  m_btPrismatic->enableSpring(0, false);
423  m_btPrismatic->getTranslationalLimitMotor()->m_enableMotor[0] = false;
424  }
425 
426  m_btPrismatic->getTranslationalLimitMotor()->m_accumulatedImpulse = btVector3(0, 0, 0);
427  m_btPrismatic->getTranslationalLimitMotor()->m_targetVelocity = btVector3(0, 0, 0);
428  m_btPrismatic->getTranslationalLimitMotor()->m_currentLimit[0] = 0;
429  m_btPrismatic->getTranslationalLimitMotor()->m_currentLimit[1] = 0;
430  m_btPrismatic->getTranslationalLimitMotor()->m_currentLimit[2] = 0;
431  m_btPrismatic->getTranslationalLimitMotor()->m_currentLimitError = btVector3(0, 0, 0);
432  }
433 }
434 
435 void BlPrismatic::AxisConstraintSpringEnableChanged(bool bEnabled)
436 {
437  if(!m_bMotorOn)
438  m_btPrismatic->enableSpring(0, bEnabled);
439 }
440 
441 void BlPrismatic::SetConstraintFriction()
442 {
443  if(m_btPrismatic && !m_bJointLocked && !m_bMotorOn && m_bEnabled)
444  TurnMotorOff();
445 }
446 
448 {
449  Prismatic::ResetSimulation();
450 
451  for(int iIdx=0; iIdx<3; iIdx++)
452  {
453  m_btPrismatic->getRotationalLimitMotor(iIdx)->m_currentPosition = 0;
454  m_btPrismatic->getRotationalLimitMotor(iIdx)->m_accumulatedImpulse = 0;
455  m_btPrismatic->getRotationalLimitMotor(iIdx)->m_currentLimit = 0;
456  m_btPrismatic->getRotationalLimitMotor(iIdx)->m_currentLimitError = 0;
457  m_btPrismatic->getRotationalLimitMotor(iIdx)->m_targetVelocity = 0;
458  }
459 
460  m_btPrismatic->getTranslationalLimitMotor()->m_currentLinearDiff = btVector3(0, 0, 0);
461  m_btPrismatic->getTranslationalLimitMotor()->m_accumulatedImpulse = btVector3(0, 0, 0);
462  m_btPrismatic->getTranslationalLimitMotor()->m_targetVelocity = btVector3(0, 0, 0);
463  m_btPrismatic->getTranslationalLimitMotor()->m_currentLimit[0] = 0;
464  m_btPrismatic->getTranslationalLimitMotor()->m_currentLimit[1] = 0;
465  m_btPrismatic->getTranslationalLimitMotor()->m_currentLimit[2] = 0;
466  m_btPrismatic->getTranslationalLimitMotor()->m_currentLimitError = btVector3(0, 0, 0);
467 }
468 
470 {
471  if(m_btPrismatic) m_btPrismatic->enableFeedback(true);
472  GetSimulator()->AddToExtractExtraData(m_lpThisJoint);
473 }
474 
475 bool BlPrismatic::NeedApplyAssist()
476 {
477  //int i = 4;
478  //if(GetSimulator()->Time() >= 1.1)
479  // i=5;
480 
481  if(m_btPrismatic && m_bMotorOn && m_lpBlParent && m_lpBlChild && m_btParent && m_btChild && m_lpAssistPid && m_lpAssistPid->Enabled())
482  {
483  float fltSetVel = SetVelocity();
484  float fltPos = m_btPrismatic->getTranslationalLimitMotor()->m_currentLinearDiff[0];
485  float fltLow = m_btPrismatic->getTranslationalLimitMotor()->m_lowerLimit[0];
486  float fltHigh = m_btPrismatic->getTranslationalLimitMotor()->m_upperLimit[0];
487 
488  float fltLow1Perc = fabs(fltLow)*0.001;
489  float fltHigh1Perc = fabs(fltHigh)*0.001;
490 
491  //If we are moving upwards and are not at upper limit then apply force.
492  if(fltSetVel > 0 && fabs(fltHigh-fltPos)>=fltHigh1Perc)
493  return true;
494 
495  //If we are moving downwards and are not at lower limit then apply force.
496  if(fltSetVel < 0 && fabs(fltPos-fltLow)>=fltLow1Perc)
497  return true;
498 
499  //If we get here then we should be applying assist forces, but we are at the limit, so clear the
500  //vectors so we are not actually applying anything.
502  }
503 
504  return false;
505 }
506 
508 {
509  //If the motor is on and moving then give it an assisst if it is not making its velocity goal.
510  if(NeedApplyAssist())
511  {
512  if(m_iAssistCountdown<=0)
513  {
514  float fDisUnits = m_lpThisAB->GetSimulator()->InverseDistanceUnits();
515  float fMassUnits = m_lpThisAB->GetSimulator()->InverseMassUnits();
516  float fltRatio = fMassUnits * fDisUnits;
517 
518  float fltDt = GetSimulator()->PhysicsTimeStep();
519  float fltSetPoint = SetVelocity();
520  float fltInput = m_lpThisJoint->JointVelocity() * fDisUnits;
521 
522  m_lpAssistPid->Setpoint(fltSetPoint);
523  m_fltMotorAssistMagnitude = m_lpAssistPid->Calculate(fltDt, fltInput);
524  float fltForceMag = m_fltMotorAssistMagnitude;
525  if(fltForceMag > m_fltMaxForceNotScaled)
526  fltForceMag = m_fltMaxForceNotScaled;
527  if(fltForceMag < -m_fltMaxForceNotScaled)
528  fltForceMag = -m_fltMaxForceNotScaled;
529 
530  btVector3 vMotorAxis = m_btPrismatic->GetLinearForceAxis(0);
531 
532  btVector3 vBodyAForceReport = -fltForceMag * vMotorAxis;
533  btVector3 vBodyBForceReport = fltForceMag * vMotorAxis;
534  btVector3 vBodyAForce = fltRatio * vBodyAForceReport;
535  btVector3 vBodyBForce = fltRatio * vBodyBForceReport;
537 
538  for(int i=0; i<3; i++)
539  {
540  m_vMotorAssistForceToA[i] = vBodyAForce[i];
541  m_vMotorAssistForceToB[i] = vBodyBForce[i];
542  m_vMotorAssistForceToAReport[i] = vBodyAForceReport[i];
543  m_vMotorAssistForceToBReport[i] = vBodyBForceReport[i];
544  }
545 
546  m_btParent->applyCentralForce(vBodyAForce);
547  m_btChild->applyCentralForce(vBodyBForce);
548  m_iAssistCountdown = 0;
549  }
550  else
552  }
553 }
554 
555  } //Joints
556  } // Environment
557 } //BulletAnimatSim
float BoxSize()
Gets the width of the flaps used to display the hinge in the environment.
Definition: Prismatic.cpp:114
Declares the vs prismatic class.
virtual void ApplyMotorAssist()
Applies the motor assist.
virtual void PhysicsTimeStep(float fltVal)
Sets the integration time step for the physics engine.
Definition: Simulator.cpp:1126
float m_fltMaxForceNotScaled
The un=scaled maximum force.
virtual float LimitPos()
Gets the limit position.
virtual void StepSimulation()
Step the simulation for this object.
virtual void UpdateData()
Called to collect any body data for this part.
Definition: BodyPart.cpp:80
virtual float Restitution()
Gets the restitution coefficient of the constraint.
virtual void Alpha(float fltA)=0
Sets the alpha color value for this constraint.
virtual void ResetSimulation()
Resets the simulation back to time 0.
Simulator * m_lpSim
The pointer to a Simulation.
Definition: AnimatBase.h:43
CStdFPoint m_vMotorAssistForceToAReport
Force vector that the motor assist is applying to body A. (un-scaled units).
float m_fltEnabled
This is used for reporting the enabled state in a GetDataPointer call.
Definition: Node.h:35
virtual float Coefficient()
Gets the Coefficient of friction for this constraint.
PidControl * m_lpAssistPid
The PID controller for the motor assist system.
ConstraintFriction * m_lpFriction
The friction for this joint.
Definition: Joint.h:67
CStdFPoint m_vMotorAssistForceToA
Force vector that the motor assist is applying to body A. (scaled units).
virtual float Stiffness()
Gets the stiffness of the constraint.
virtual Simulator * GetSimulator()
Gets the simulator pointer.
Definition: AnimatBase.cpp:123
virtual void IsShowPosition(bool bVal)
Sets whether this contstraint is actually just being used to show the current position of the joint...
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
virtual bool Enabled()
Tells whether this node is enabled.
Definition: Node.cpp:84
ConstraintLimit * m_lpUpperLimit
Upper limit constring pointer.
Definition: Prismatic.h:37
virtual void EnableFeedback()
Enables joint feedback.
virtual float Damping()
Gets the damping value of the contraint.
BlConstraintRelaxation * m_aryBlRelaxations[6]
The bullet relaxation for the primary displacement relaxation.
Definition: BlJoint.h:45
virtual bool EnableMotor()
Tells if the motor is enabled.
CStdFPoint m_vMotorAssistForceToBReport
Force vector that the motor assist is applying to body B. (un-scaled units).
RigidBody * m_lpChild
The child rigid body for this joint.
Definition: Joint.h:44
bool m_bEnableLimits
If true then any ConstraintLimits for this joint are enabled.
Definition: Joint.h:47
CStdFPoint m_vMotorAssistForceToB
Force vector that the motor assist is applying to body B. (scaled units).
void Std_TraceMsg(const int iLevel, std::string strMessage, std::string strSourceFile, int iSourceLine, bool bLogToFile, bool bPrintHeader)
Traces a message to the debugger window.
ConstraintLimit * m_lpLowerLimit
Lower limit constring pointer.
Definition: Prismatic.h:40
float m_fltForce
The current force being applied to the joint by the motor.
Definition: Joint.h:58
virtual bool Enabled()
Tells whether this node is enabled.
Definition: PidControl.cpp:94
bool m_bEnabled
Tells if this item is enabled or not. If it is not enabled then it is not run.
Definition: AnimatBase.h:40
float m_fltReportSetPosition
This is the variable that is reported to AnimatLab on what the set position was.
virtual void TimeStepModified()
If the time step is modified then we need to recalculate the length of the delay buffer.
virtual bool Enabled()
Tells whether this item is enabled or not. This is not actually used for all objects, only specific ones. I am putting it in the base class though to prevent numerous duplications.
float m_fltMotorAssistMagnitudeReport
The reportable motor assist Force magnitude.
float m_fltAlpha
The current alpha transparency for this body part.
Definition: MovableItem.h:76
float m_fltReportSetVelocity
This is the variable that is reported to AnimatLab on what the set veloicty was.
ConstraintLimit * m_lpPosFlap
Pointer to a constraint that is used to represent the position flap.
Definition: Prismatic.h:43
virtual void SetVelocityToDesired()
Sets the desired velocity to use for the motor.
virtual float JointPosition()
Gets the joint position.
Definition: Joint.cpp:532
virtual void DeleteGraphics()=0
Deletes up the graphics for the constraint.
virtual void Color(float fltR, float fltG, float fltB, float fltA)
Sets the color to use when displaying this contraint.
float CylinderRadius()
Gets the radius cylinder of the cylinder used to display the axis of the prismatic joint in the envir...
Definition: Prismatic.cpp:100
virtual void IsLowerLimit(bool bVal)
Sets whether this is a lower limit or not..
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
virtual float SetVelocity()
Gets the velocity that is actually set using the physics method.
virtual void ClearAssistForces()
Clears the assist forces.
virtual bool EnableLimits()
Tells if ConstraintLimits are enabled.
Definition: Joint.cpp:139
virtual void CreateJoint()
Creates the joint.
float m_fltMotorAssistMagnitude
The motor assist Force magnitude.
ConstraintRelaxation * m_aryRelaxations[6]
The relaxations for the constraints.
Definition: Joint.h:64
std::string m_strName
The name for this object.
Definition: AnimatBase.h:61