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

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

btMultiBodyJointMotor.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2013 Erwin Coumans http://bulletphysics.org
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. 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"
22struct btSolverInfo;
23
24 class btMultiBodyJointMotor : public btMultiBodyConstraint
25{
26protected:
27 btScalar m_desiredVelocity;
28 btScalar m_desiredPosition;
29 btScalar m_kd;
30 btScalar m_kp;
31 btScalar m_erp;
32 btScalar m_rhsClamp; //maximum error
33
34public:
35 btMultiBodyJointMotor(btMultiBody* body, int link, btScalar desiredVelocity, btScalar maxMotorImpulse);
36 btMultiBodyJointMotor(btMultiBody* body, int link, int linkDoF, btScalar desiredVelocity, btScalar maxMotorImpulse);
37 virtual ~btMultiBodyJointMotor();
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(btScalar velTarget, btScalar kd = 1.f)
48 {
49 m_desiredVelocity = velTarget;
50 m_kd = kd;
51 }
52
53 virtual void setPositionTarget(btScalar 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_JOINT_MOTOR_H
btMultiBodyConstraint.h
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition btScalar.h:314
btAlignedObjectArray< btMultiBodySolverConstraint >
btIDebugDraw
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
Definition btIDebugDraw.h:27
btMultiBodyConstraint
Definition btMultiBodyConstraint.h:57
btMultiBodyJointMotor
Definition btMultiBodyJointMotor.h:25
btMultiBodyJointMotor::m_rhsClamp
btScalar m_rhsClamp
Definition btMultiBodyJointMotor.h:32
btMultiBodyJointMotor::debugDraw
virtual void debugDraw(class btIDebugDraw *drawer)
Definition btMultiBodyJointMotor.h:71
btMultiBodyJointMotor::m_desiredVelocity
btScalar m_desiredVelocity
Definition btMultiBodyJointMotor.h:27
btMultiBodyJointMotor::getIslandIdB
virtual int getIslandIdB() const
Definition btMultiBodyJointMotor.cpp:88
btMultiBodyJointMotor::m_desiredPosition
btScalar m_desiredPosition
Definition btMultiBodyJointMotor.h:28
btMultiBodyJointMotor::finalizeMultiDof
virtual void finalizeMultiDof()
Definition btMultiBodyJointMotor.cpp:37
btMultiBodyJointMotor::~btMultiBodyJointMotor
virtual ~btMultiBodyJointMotor()
Definition btMultiBodyJointMotor.cpp:66
btMultiBodyJointMotor::btMultiBodyJointMotor
btMultiBodyJointMotor(btMultiBody *body, int link, btScalar desiredVelocity, btScalar maxMotorImpulse)
This file was written by Erwin Coumans.
Definition btMultiBodyJointMotor.cpp:23
btMultiBodyJointMotor::m_kp
btScalar m_kp
Definition btMultiBodyJointMotor.h:30
btMultiBodyJointMotor::setVelocityTarget
virtual void setVelocityTarget(btScalar velTarget, btScalar kd=1.f)
Definition btMultiBodyJointMotor.h:47
btMultiBodyJointMotor::m_erp
btScalar m_erp
Definition btMultiBodyJointMotor.h:31
btMultiBodyJointMotor::m_kd
btScalar m_kd
Definition btMultiBodyJointMotor.h:29
btMultiBodyJointMotor::getErp
virtual btScalar getErp() const
Definition btMultiBodyJointMotor.h:63
btMultiBodyJointMotor::setPositionTarget
virtual void setPositionTarget(btScalar posTarget, btScalar kp=1.f)
Definition btMultiBodyJointMotor.h:53
btMultiBodyJointMotor::createConstraintRows
virtual void createConstraintRows(btMultiBodyConstraintArray &constraintRows, btMultiBodyJacobianData &data, const btContactSolverInfo &infoGlobal)
Definition btMultiBodyJointMotor.cpp:106
btMultiBodyJointMotor::getIslandIdA
virtual int getIslandIdA() const
Definition btMultiBodyJointMotor.cpp:70
btMultiBodyJointMotor::setRhsClamp
virtual void setRhsClamp(btScalar rhsClamp)
Definition btMultiBodyJointMotor.h:67
btMultiBodyJointMotor::setErp
virtual void setErp(btScalar erp)
Definition btMultiBodyJointMotor.h:59
btMultiBody
Definition btMultiBody.h:51
btContactSolverInfo
Definition btContactSolverInfo.h:76
btMultiBodyJacobianData
Definition btMultiBodyConstraint.h:44