Newton Dynamics  4.00
ndJointWheel.h
1 /* Copyright (c) <2003-2022> <Newton Game Dynamics>
2 *
3 * This software is provided 'as-is', without any express or implied
4 * warranty. In no event will the authors be held liable for any damages
5 * arising from the use of this software.
6 *
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely
10 */
11 
12 #ifndef __ND_JOINT_WHEEL_H__
13 #define __ND_JOINT_WHEEL_H__
14 
15 #include "ndNewtonStdafx.h"
16 #include "ndJointBilateralConstraint.h"
17 
19 {
20  public:
22  :m_radios(ndFloat32(0.5f))
23  ,m_springK(ndFloat32(1.0f))
24  ,m_damperC(ndFloat32(0.0f))
25  ,m_upperStop(ndFloat32(-0.1f))
26  ,m_lowerStop(ndFloat32(0.2f))
27  ,m_regularizer(ndFloat32(0.1f))
28  ,m_brakeTorque(ndFloat32(0.0f))
29  ,m_handBrakeTorque(ndFloat32(0.0f))
30  ,m_steeringAngle(ndFloat32(0.0f))
31  {
32  }
33 
34  D_NEWTON_API void Save(nd::TiXmlNode* const xmlNode) const;
35  D_NEWTON_API void Load(const nd::TiXmlNode* const xmlNode);
36 
37  ndFloat32 m_radios;
38  ndFloat32 m_springK;
39  ndFloat32 m_damperC;
40  ndFloat32 m_upperStop;
41  ndFloat32 m_lowerStop;
42  ndFloat32 m_regularizer;
43  ndFloat32 m_brakeTorque;
44  ndFloat32 m_handBrakeTorque;
45  ndFloat32 m_steeringAngle;
46 };
47 
49 {
50  public:
51  D_CLASS_REFLECTION(ndJointWheel);
52  D_NEWTON_API ndJointWheel(const ndLoadSaveBase::ndLoadDescriptor& desc);
53  D_NEWTON_API ndJointWheel(const ndMatrix& pinAndPivotFrame, ndBodyKinematic* const child, ndBodyKinematic* const parent, const ndWheelDescriptor& desc);
54  D_NEWTON_API virtual ~ndJointWheel();
55 
56  D_NEWTON_API void SetBrake(ndFloat32 normalizedTorque);
57  D_NEWTON_API void SetHandBrake(ndFloat32 normalizedTorque);
58  D_NEWTON_API void SetSteering(ndFloat32 normalidedSteering);
59 
60  D_NEWTON_API void UpdateTireSteeringAngleMatrix();
61 
62  D_NEWTON_API ndMatrix CalculateBaseFrame() const;
63  D_NEWTON_API ndMatrix CalculateUpperBumperMatrix() const;
64 
65  D_NEWTON_API const ndWheelDescriptor& GetInfo() const;
66  D_NEWTON_API void SetInfo(const ndWheelDescriptor& info);
67 
68  protected:
69  D_NEWTON_API void JacobianDerivative(ndConstraintDescritor& desc);
70  D_NEWTON_API void Save(const ndLoadSaveBase::ndSaveDescriptor& desc) const;
71 
72  ndMatrix m_baseFrame;
73  ndWheelDescriptor m_info;
74  ndFloat32 m_posit;
75  ndFloat32 m_speed;
76  ndFloat32 m_regularizer;
77  ndFloat32 m_normalizedBrake;
78  ndFloat32 m_normalidedSteering;
79  ndFloat32 m_normalizedHandBrake;
80  bool m_vcdMode;
81  friend class ndMultiBodyVehicle;
82 };
83 
84 #endif
85 
nd::TiXmlNode
The parent class for everything in the Document Object Model.
Definition: tinyxml.h:437
ndMultiBodyVehicle
Definition: ndMultiBodyVehicle.h:41
ndJointWheel
Definition: ndJointWheel.h:49
ndJointBilateralConstraint::ndIkInterface
Definition: ndJointBilateralConstraint.h:65
ndConstraintDescritor
Definition: ndConstraint.h:179
ndJointBilateralConstraint
Definition: ndJointBilateralConstraint.h:53
ndBodyKinematic
Definition: ndBodyKinematic.h:40
ndWheelDescriptor
Definition: ndJointWheel.h:19
ndMatrix
Definition: ndMatrix.h:42
ndLoadSaveBase::ndLoadDescriptor
Definition: ndSaveLoadSytem.h:59
ndLoadSaveBase::ndSaveDescriptor
Definition: ndSaveLoadSytem.h:93