3#include "sfh/constants.h"
10#include <fhsim/simobject/SimObject.h>
11#include <fhsim_environment/BodyWake.h>
12#include <fhsim_environment/EnvironmentProvider.h>
13#include <fhsim_environment/hydrodynamics/SphereHydro.h>
108 CablePendulum(
const std::string& simObjectName, ISimObjectCreator*
const creator);
109 void OdeFcn(
const double T,
const double*
const X,
double*
const XDot)
const;
110 void InitialConditionSetup(
const double T,
const double*
const currentIC,
double*
const updatedIC, ISimObjectCreator*
const creator);
111 void FinalSetup(
const double T,
const double*
const X, ISimObjectCreator*
const creator);
113 void PreOdeFcn(
double T,
const double* X, IStateUpdater* updater)
override;
115#ifdef FH_VISUALIZATION
116 void RenderInit(Ogre::Root*
const ogreRoot, ISimObjectCreator*
const creator);
117 void RenderUpdate(
const double T,
const double*
const X);
121 void SetOutputPortValues(
const double T,
const double*
const X)
const;
122 const double* MidpointPosition(
const double T,
const double*
const X);
123 const double* BallPosition(
const double T,
const double*
const X);
124 const double* BallVelocity(
const double T,
const double*
const X);
131 bool HasJacobians()
const override;
132 void OdeJacobian(
double T,
const double* X,
double* J,
int nStates)
override;
133 int GetJacobianSparsity(
int nStates,
int* rowPtr,
int* colIdx)
override;
137 void addDragJacobian(
const double T,
const double* pk,
const double* pl,
const double* vk,
138 double dF_dpk[9],
double dF_dpl[9],
double dF_dvk[9])
const;
139 Eigen::Vector3d Drag(
int k,
int l,
const double T,
const double*
const X)
const;
140 Eigen::Vector3d Spring(
int k,
int l,
const double T,
const double*
const X)
const;
141 Eigen::Vector3d Damp(
int k,
int l,
const double T,
const double*
const X)
const;
142 const double* SuspensionForce(
const double T,
const double*
const X);
143 const double* CableOnBallForce(
const double T,
const double*
const X);
146 ICommonComputation* m_SetOutputPortValues;
147 ISignalPort* m_SuspensionPos;
148 ISignalPort* m_SuspensionVel;
150 environment::EnvironmentProvider* Environment;
151 std::vector<int> m_PositionIndex, m_VelocityIndex;
152 int m_BallPositionIndex, m_BallVelocityIndex;
155 mutable double m_MidpointPosition[3];
156 mutable double m_BallPosition[3];
157 mutable double m_BallVelocity[3];
158 mutable double m_SuspensionForce[3];
159 mutable double m_CableOnBallForce[3];
160 double m_BallWaterVelocity[3] = {0.0, 0.0, 0.0};
167 double m_BallMass, m_BallRadius, m_RhoWater, m_BallRho;
168 double m_ElementMass, m_ElementLength0;
169 double m_SpringCoef, m_DamperCoef, m_GravYancy;
170 double m_Mass, m_Length, m_Diameter, m_RhoCable, m_Modulus;
172#ifdef FH_VISUALIZATION
173 Ogre::ManualObject* m_Line;
174 Ogre::SceneNode* m_RenderNode;
175 std::string m_MaterialName;
176 std::string m_MeshName;
Definition CablePendulum.h:106
environment::wake::BodyWakeSettings m_wakeSettings
The wake parameters.
Definition CablePendulum.h:164
std::optional< environment::sphere_hydro::SphereCaster > m_ballCaster
The ball on its states, for the wake.
Definition CablePendulum.h:163
void ballWaterVelocity(const double T, const double *X, double velocity[3]) const
The water velocity at the ball: the BodyWake's, without the ball's own wake.
void PreOdeFcn(double T, const double *X, IStateUpdater *updater) override
Rebuilds the ball's wake when due and takes the other objects' wakes at the ball.
const double * BallWaterVelocity(const double T, const double *const X)
Output port BallWaterVelocity [m/s], NED.
environment::sphere_hydro::Sphere m_ballShape
ρ, D = 2 R and C_d of the ball's drag.
Definition CablePendulum.h:162
std::unique_ptr< environment::wake::BodyWake > m_ballWake
The wake the ball casts and receives, from FinalSetup.
Definition CablePendulum.h:165
void addDragJacobian(const double T, const double *pk, const double *pl, const double *vk, double dF_dpk[9], double dF_dpl[9], double dF_dvk[9]) const
Adds the derivatives of Drag(k,l), the force on node k, to the blocks SetCableSegmentStructuralJacobi...
int m_stateBase
Global index of this object's first state; cached in the constructor.
Definition CablePendulum.h:153