Marine systems simulation
VesselOBJ.h
1
11
12#ifndef VesselOBJ_H
13#define VesselOBJ_H
14
15#include <stdio.h>
16#include <string>
17
18#include "SimObject.h"
19
20//#include "supplement/NewMOC.h" // collision detection
21
26namespace Visualization
27{
28
29class VesselOBJ : public SimObject
30{
31 public:
33 VesselOBJ(std::string sSimObjectName, ISimObjectCreator* pCreator);
34
36 //~VesselOBJ();
37
38
40 virtual void OdeFcn(const double dT, const double* const adX, double* const adXDot, const bool bIsMajorTimeStep);
41
42# ifdef FH_VISUALIZATION
44 virtual void RenderInit(Ogre::Root* const pOgreRoot, ISimObjectCreator* const pCreator);
45
47 virtual void RenderUpdate(const double dT, const double* const adX);
48# endif
49
50 protected:
52 ISignalPort* m_pInSurge;
53 ISignalPort* m_pInSway;
54 ISignalPort* m_pInHeave;
55 ISignalPort* m_pInRoll;
56 ISignalPort* m_pInPitch;
57 ISignalPort* m_pInYaw;
58 ISignalPort** m_pInContactPoints;
59 ISignalPort** m_pInContactNormals;
60
62 const double* OutHeading(const double dT, const double* const adX);
63 const double* OutPos(const double dT, const double* const adX);
64 const double* OutThrusterPos(const double dT, const double* const adX, int iThruster);
65 const double* OutContactForcePos(const double dT, const double* const adX, int iContact);
66
67 void CalcOutput(const double dT, const double* const adX);
68 //void DetectCollisions(const double dT, const double* const adX);
69
70 double m_adOut_Pos[3];
71 double m_adOut_Heading;
72 double m_OutThrusterPos[3];
73 double m_OutContactForces[3];
74
75 ICommonComputation* m_pCommonCalc;
76
77 double m_dSurge;
78 double m_dSway;
79 double m_dHeave;
80 double m_dPitch;
81 double m_dRoll;
82 double m_dYaw;
83
84
85 int m_NumThrusters;
86 std::vector<Ogre::Vector3> m_aThrusterPos;
87 std::vector<Ogre::Vector3> m_aOutThrusterPos;
88
89 std::vector<Ogre::Vector3> m_aContactForces;
90 std::vector<Ogre::Vector3> m_aContactPointsA;
91 std::vector<Ogre::Vector3> m_aContactPointsB;
92
93 /*bool m_CollisionDetection;
94 int m_NumCollisionPoints;
95 double m_dMaxContactDistance; /// if within this distnance, then contact force F=k*dx, where dx = closest_distance - m_dMaxContactDistance
96 double m_dContactStiffness; /// coefficient k [N/m] such that contact force F=k*dx
97 double m_dConstContactForce; /// constant component F0 [N] added to the contact force F=F0+k*dx*/
98
99
100 // initial orientation of the mesh and thrusters
101 Ogre::Quaternion m_InitOrientation;
102 Ogre::Matrix3 m_InitMeshRot;
103
104 double m_dInitialPos[3];
105
106# ifdef FH_VISUALIZATION
107 Ogre::Entity* m_RenderMass;
108 Ogre::SceneNode* m_RenderNode;
109 Ogre::SceneNode** m_SpheresRenderNodes;
110 double m_LengthScale;
111 double m_BreadthScale;
112 double m_DepthScale;
113 std::string m_MeshName;
114
115 // collision detection
116 //Collision::CollisionTools* m_Collision;
117# endif
118};
119
120
121#endif
122};
Definition: VesselOBJ.h:30
std::vector< Ogre::Vector3 > m_aContactPointsA
forces in contact points
Definition: VesselOBJ.h:90
ISignalPort * m_pInPitch
Pitch input port [rad].
Definition: VesselOBJ.h:56
ISignalPort * m_pInSway
Sway input port [m].
Definition: VesselOBJ.h:53
virtual void OdeFcn(const double dT, const double *const adX, double *const adXDot, const bool bIsMajorTimeStep)
The destructor cleans up.
ISignalPort * m_pInRoll
Roll input port [rad].
Definition: VesselOBJ.h:55
ISignalPort ** m_pInContactPoints
Points where contacts with the vessel mesh will be checked.
Definition: VesselOBJ.h:58
ISignalPort * m_pInHeave
Heave input port [m].
Definition: VesselOBJ.h:54
ISignalPort * m_pInSurge
Input ports.
Definition: VesselOBJ.h:52
std::vector< Ogre::Vector3 > m_aThrusterPos
number of thruster whose 3d positions will be available via output ports
Definition: VesselOBJ.h:86
std::vector< Ogre::Vector3 > m_aContactPointsB
inport points to check for collision with Vessel
Definition: VesselOBJ.h:91
std::vector< Ogre::Vector3 > m_aContactForces
global positions
Definition: VesselOBJ.h:89
VesselOBJ(std::string sSimObjectName, ISimObjectCreator *pCreator)
The constructor sets the pointer to the output object and the parser object.
Ogre::Quaternion m_InitOrientation
contact points on Vessel
Definition: VesselOBJ.h:101
ISignalPort * m_pInYaw
Yaw input port [rad].
Definition: VesselOBJ.h:57
const double * OutHeading(const double dT, const double *const adX)
Output ports.
ICommonComputation * m_pCommonCalc
Calculations necessary for more than one output port.
Definition: VesselOBJ.h:75
ISignalPort ** m_pInContactNormals
Normal directions from contact points.
Definition: VesselOBJ.h:59
std::vector< Ogre::Vector3 > m_aOutThrusterPos
thruster positions in vessel cooridinates
Definition: VesselOBJ.h:87