Marine systems simulation
CVisualRBOGRE.h
1/*
2* Class CVisualRBOGRE (SimObject)
3* Author: Biao Su
4* Modified by Walter Caharija on 20.11.2018: added parameter to rotate body
5* Modified by Walter Caharija on 19.02.2019: included HelpFunctions.h for Pi constant
6*
7* This class enables visualization of a rigid body with triangular mesh.
8*/
9
14#ifndef CVisualRBOGRE_H
15#define CVisualRBOGRE_H
16
17#include <string>
18#include <Eigen/Eigen>
19#include <iostream>
20#include <iomanip>
21#include <fstream>
22#include <algorithm>
23#include <vector>
24#include <valarray>
25
26#include "SimObject.h"
27
28#include "sfh/text.h"
29#include "sfh/math/math.h"
30#include "sfh/sim/kinematics.h"
31#include "sfh/constants.h"
32
33namespace Visualization {
34
35typedef Eigen::Matrix<double, 3, 1> vec3;
36typedef Eigen::Matrix<int, 3, 1> vec3i;
37typedef Eigen::Quaternion<double> quat;
38
39class CVisualRBOGRE : public SimObject
40{
41public:
42 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
43
44 // Constructor
45 CVisualRBOGRE(std::string sSimObjectName, ISimObjectCreator* pCreator);
46 virtual ~CVisualRBOGRE() {};
48 virtual void OdeFcn(const double dT, const double* const adX, double* const adXDot, const bool bIsMajorTimeStep) {};
49
50#ifdef FH_VISUALIZATION
51 // Initial specification of the simObject geometry for rendering.
52 virtual void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const pCreator);
53
54 // Updating the simObject for rendering the next frame.
55 virtual void RenderUpdate(const double dT, const double* const adX);
56#endif
57
58protected:
59
60 // DOF
61 int m_DOFModes[6];
62 int m_DOFNum;
63 std::vector<int> m_DOFIndex;
64
65 // Mesh bias
66 vec3 m_PosBias;
67 vec3 m_RotBias;
68
69 // Input ports
70 ISignalPort* m_InPos;
71
72#ifdef FH_VISUALIZATION
73 Ogre::SceneNode* m_RenderNode;
74 Ogre::SceneManager* m_SceneMgr;
75#endif
76
77};
78
79};
80
81#endif
Definition: CVisualRBOGRE.h:40
virtual void OdeFcn(const double dT, const double *const adX, double *const adXDot, const bool bIsMajorTimeStep)
Calculate the state derivatives.
Definition: CVisualRBOGRE.h:48