Bullet Collision Detection & Physics Library: btMultiBodySphericalJointMotor.h Source File

Bullet Collision Detection & Physics Library

btMultiBodySphericalJointMotor.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2018 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_SPHERICAL_JOINT_MOTOR_H
19 #define BT_MULTIBODY_SPHERICAL_JOINT_MOTOR_H
20
21 #include "btMultiBodyConstraint.h"
22 struct btSolverInfo;
23
24 class btMultiBodySphericalJointMotor : public btMultiBodyConstraint
25 {
26 protected:
27 btVector3 m_desiredVelocity;
28 btQuaternion m_desiredPosition;
29 btScalar m_kd;
30 btScalar m_kp;
31 btScalar m_erp;
32 btScalar m_rhsClamp; //maximum error
33
34 public:
35 btMultiBodySphericalJointMotor(btMultiBody* body, int link, btScalar maxMotorImpulse);
36
37 virtual ~btMultiBodySphericalJointMotor();
38 virtual void finalizeMultiDof();
39
40 virtual int getIslandIdA() const;
41 virtual int getIslandIdB() const;
42
43 virtual void createConstraintRows(btMultiBodyConstraintArray& constraintRows,
44 btMultiBodyJacobianData& data,
45 const btContactSolverInfo& infoGlobal);
46
47 virtual void setVelocityTarget(const btVector3& velTarget, btScalar kd = 1.f)
48 {
49 m_desiredVelocity = velTarget;
50 m_kd = kd;
51 }
52
53 virtual void setPositionTarget(const btQuaternion& posTarget, btScalar kp = 1.f)
54 {
55 m_desiredPosition = posTarget;
56 m_kp = kp;
57 }
58
59 virtual void setErp(btScalar erp)
60 {
61 m_erp = erp;
62 }
63 virtual btScalar getErp() const
64 {
65 return m_erp;
66 }
67 virtual void setRhsClamp(btScalar rhsClamp)
68 {
69 m_rhsClamp = rhsClamp;
70 }
71 virtual void debugDraw(class btIDebugDraw* drawer)
72 {
73 //todo(erwincoumans)
74 }
75 };
76
77 #endif //BT_MULTIBODY_SPHERICAL_JOINT_MOTOR_H
btMultiBodySphericalJointMotor::m_kp
btScalar m_kp
Definition: btMultiBodySphericalJointMotor.h:30
btMultiBodySphericalJointMotor::debugDraw
virtual void debugDraw(class btIDebugDraw *drawer)
Definition: btMultiBodySphericalJointMotor.h:71
btMultiBodySphericalJointMotor::btMultiBodySphericalJointMotor
btMultiBodySphericalJointMotor(btMultiBody *body, int link, btScalar maxMotorImpulse)
This file was written by Erwin Coumans.
Definition: btMultiBodySphericalJointMotor.cpp:25
btMultiBodySphericalJointMotor::getIslandIdA
virtual int getIslandIdA() const
Definition: btMultiBodySphericalJointMotor.cpp:59
btAlignedObjectArray< btMultiBodySolverConstraint >
btMultiBodySphericalJointMotor::getIslandIdB
virtual int getIslandIdB() const
Definition: btMultiBodySphericalJointMotor.cpp:77
btMultiBodyConstraint.h
btMultiBodySphericalJointMotor::m_kd
btScalar m_kd
Definition: btMultiBodySphericalJointMotor.h:29
btMultiBodySphericalJointMotor::setPositionTarget
virtual void setPositionTarget(const btQuaternion &posTarget, btScalar kp=1.f)
Definition: btMultiBodySphericalJointMotor.h:53
btMultiBody
Definition: btMultiBody.h:49
btMultiBodySphericalJointMotor::m_rhsClamp
btScalar m_rhsClamp
Definition: btMultiBodySphericalJointMotor.h:32
btMultiBodyConstraint
Definition: btMultiBodyConstraint.h:40
btMultiBodySphericalJointMotor::setVelocityTarget
virtual void setVelocityTarget(const btVector3 &velTarget, btScalar kd=1.f)
Definition: btMultiBodySphericalJointMotor.h:47
btMultiBodySphericalJointMotor::finalizeMultiDof
virtual void finalizeMultiDof()
Definition: btMultiBodySphericalJointMotor.cpp:39
btMultiBodySphericalJointMotor::getErp
virtual btScalar getErp() const
Definition: btMultiBodySphericalJointMotor.h:63
btMultiBodySphericalJointMotor::setErp
virtual void setErp(btScalar erp)
Definition: btMultiBodySphericalJointMotor.h:59
btMultiBodySphericalJointMotor::~btMultiBodySphericalJointMotor
virtual ~btMultiBodySphericalJointMotor()
Definition: btMultiBodySphericalJointMotor.cpp:55
btMultiBodySphericalJointMotor::m_erp
btScalar m_erp
Definition: btMultiBodySphericalJointMotor.h:31
btMultiBodySphericalJointMotor::setRhsClamp
virtual void setRhsClamp(btScalar rhsClamp)
Definition: btMultiBodySphericalJointMotor.h:67
btIDebugDraw
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
Definition: btIDebugDraw.h:26
btMultiBodyJacobianData
Definition: btMultiBodyConstraint.h:28
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:80
btMultiBodySphericalJointMotor
Definition: btMultiBodySphericalJointMotor.h:24
btMultiBodySphericalJointMotor::createConstraintRows
virtual void createConstraintRows(btMultiBodyConstraintArray &constraintRows, btMultiBodyJacobianData &data, const btContactSolverInfo &infoGlobal)
Definition: btMultiBodySphericalJointMotor.cpp:95
btContactSolverInfo
Definition: btContactSolverInfo.h:69
btMultiBodySphericalJointMotor::m_desiredVelocity
btVector3 m_desiredVelocity
Definition: btMultiBodySphericalJointMotor.h:27
btQuaternion
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
Definition: btQuaternion.h:49
btMultiBodySphericalJointMotor::m_desiredPosition
btQuaternion m_desiredPosition
Definition: btMultiBodySphericalJointMotor.h:28
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:294