Bullet Collision Detection & Physics Library
btMultiBodyJointMotor.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2013 Erwin Coumans http://bulletphysics.org
4 
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15 
17 
18 #ifndef BT_MULTIBODY_JOINT_MOTOR_H
19 #define BT_MULTIBODY_JOINT_MOTOR_H
20 
21 #include "btMultiBodyConstraint.h"
22 struct btSolverInfo;
23 
25 {
26 protected:
27 
33  btScalar m_rhsClamp;//maximum error
34 
35 
36 public:
37 
38  btMultiBodyJointMotor(btMultiBody* body, int link, btScalar desiredVelocity, btScalar maxMotorImpulse);
39  btMultiBodyJointMotor(btMultiBody* body, int link, int linkDoF, btScalar desiredVelocity, btScalar maxMotorImpulse);
40  virtual ~btMultiBodyJointMotor();
41  virtual void finalizeMultiDof();
42 
43  virtual int getIslandIdA() const;
44  virtual int getIslandIdB() const;
45 
46  virtual void createConstraintRows(btMultiBodyConstraintArray& constraintRows,
48  const btContactSolverInfo& infoGlobal);
49 
50  virtual void setVelocityTarget(btScalar velTarget, btScalar kd = 1.f)
51  {
52  m_desiredVelocity = velTarget;
53  m_kd = kd;
54  }
55 
56  virtual void setPositionTarget(btScalar posTarget, btScalar kp = 1.f)
57  {
58  m_desiredPosition = posTarget;
59  m_kp = kp;
60  }
61 
62  virtual void setErp(btScalar erp)
63  {
64  m_erp = erp;
65  }
66  virtual btScalar getErp() const
67  {
68  return m_erp;
69  }
70  virtual void setRhsClamp(btScalar rhsClamp)
71  {
72  m_rhsClamp = rhsClamp;
73  }
74  virtual void debugDraw(class btIDebugDraw* drawer)
75  {
76  //todo(erwincoumans)
77  }
78 };
79 
80 #endif //BT_MULTIBODY_JOINT_MOTOR_H
81 
virtual int getIslandIdB() const
virtual void debugDraw(class btIDebugDraw *drawer)
virtual btScalar getErp() const
virtual void setErp(btScalar erp)
btMultiBodyJointMotor(btMultiBody *body, int link, btScalar desiredVelocity, btScalar maxMotorImpulse)
This file was written by Erwin Coumans.
virtual int getIslandIdA() const
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
Definition: btIDebugDraw.h:29
virtual void createConstraintRows(btMultiBodyConstraintArray &constraintRows, btMultiBodyJacobianData &data, const btContactSolverInfo &infoGlobal)
virtual void setRhsClamp(btScalar rhsClamp)
virtual void setVelocityTarget(btScalar velTarget, btScalar kd=1.f)
virtual void setPositionTarget(btScalar posTarget, btScalar kp=1.f)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:292