FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
HydroBall.h
1#ifndef HYDRO_BALL_H
2#define HYDRO_BALL_H
3
4#include "sfh/constants.h"
5#include "sfh/math.h"
6#include "sfh/text.h"
7#include "sfh/util.h"
8#include <string>
9
10#include <Eigen/Dense>
11
12#include <fhsim/simobject/SimObject.h>
13#include <fhsim_environment/hydrodynamics/SphereHydro.h>
14#include <memory>
15
84class HydroBall : public SimObject
85{
86 public:
87 HydroBall(const std::string& simObjectName, ISimObjectCreator* const creator);
88 void OdeFcn(const double T, const double* const X, double* const XDot) const;
89
90 bool HasJacobians() const override;
91 void OdeJacobian(double T, const double* X, double* J, int nStates) override;
92 int GetJacobianSparsity(int nStates, int* rowPtr, int* colIdx) override;
93
94 void InitialConditionSetup(const double T, const double* const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
95
96#ifdef FH_VISUALIZATION
97 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
98 void RenderUpdate(const double T, const double* const X);
99#endif
100
101 protected:
102 void SetOutputPortValues(const double T, const double* const X) const;
103 const double* Position(const double T, const double* const X);
104 const double* Velocity(const double T, const double* const X);
105
106 ICommonComputation* m_SetOutputPortValues;
107 ISignalPort* m_ForceExt;
108 ISignalPort* m_Current;
109 int m_PositionIndex, m_VelocityIndex;
110 mutable double m_Position[3];
111 mutable double m_Velocity[3];
112
113 double m_Mass, m_Radius, m_RhoBall;
114 double m_Inertia;
115 environment::sphere_hydro::Sphere m_Sphere;
116
117#ifdef FH_VISUALIZATION
118 Ogre::SceneNode* m_RenderNode;
119 std::string m_MaterialName;
120 std::string m_MeshName;
121 double m_Scale;
122#endif
123};
124
125#endif
Definition HydroBall.h:85
environment::sphere_hydro::Sphere m_Sphere
The ball as the environment's sphere law sees it: default density, Cd from the standard curve,...
Definition HydroBall.h:115
double m_Inertia
Mass plus added mass [kg].
Definition HydroBall.h:114