FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
WaypointRefGen.h
1#pragma once
2
10#include <Eigen/Eigen>
11#include <vector>
12#include <fhsim/simobject/SimObject.h>
13#ifdef FH_VISUALIZATION
14#pragma warning(push)
15#pragma warning( disable : 4251 )
16 #include <Ogre.h>
17#pragma warning(pop)
18#endif
19#include "Waypoint.h"
20using namespace Eigen;
21
22
23namespace Ship{
24 class WaypointRefGen : public SimObject
25 {
26 public:
27 EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
28 WaypointRefGen(const std::string& simObjectName, ISimObjectCreator* const creator);
30 const double* DesiredQuaternion(const double T, const double* const X);
31 const double* DesiredHeading(const double T, const double* const X);
32 const double* DesiredHeadingRate(const double T, const double* const X);
33 const double* CrossTrackError(const double T, const double* const X);
34 const double* DesiredPosition(const double T,const double* const X);
35 const double* DesiredSpeed(const double T,const double* const X);
36 void OdeFcn(const double T, const double *const X,double *const ) const{}
37 void FinalSetup(const double T,const double* const X, ISimObjectCreator* const creator);
38 void Compute(const double T,const double* const X) const;
39 void AcceptedStep(double T, const double* X) override;
40
41 #ifdef FH_VISUALIZATION
42 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
43 void RenderUpdate(const double T, const double* const X);
44 #endif
45
46
47 private:
48 ISignalPort* m_adStatePositionPort;
49 ISignalPort* m_adStateVelocityPort;
50 ICommonComputation *m_Compute;
51
52 Waypoint* m_aWPList;
53
54 mutable Eigen::Vector3d m_adStatePosition;
55 Eigen::Vector3d m_adStateVelocity;
56 Eigen::Vector3d m_adStateVelocity_Desired;
57
58 std::string sideslipCompensation;
59
60 double initialPosition[3];
61 double* pK;
62 mutable double desiredHeading;
63 mutable double desiredHeadingRate;
64 mutable double crosstrackError;
65 double m_dLookaheadDistance;
66 double m_lookahead;
67 double m_dSideSlipAngle;
68 double alphaK;
69 double m_adStateTheta_Desired[4];
70 mutable double desiredPosition[3];
71 mutable double m_desiredSpeed;
72 int numberOfPoints;
73
74 int iCurrentWaypointNumber;
75
76 double* waypoint_n;
77 double* waypoint_e;
78 double* waypoint_d;
79 double* waypoint_r;
80 std::vector<double> waypoint_leg_speed;
81 double m_sectionType;
82
83 Eigen::Vector3d* legstart;
84 Eigen::Vector3d* legend;
85 Eigen::Vector3d* circle_center;
86 double* circle_radius;
87
88 #ifdef FH_VISUALIZATION
89 Ogre::SceneNode** m_wpNodes;
90 Ogre::SceneNode** m_legNodes;
91
92 Ogre::SceneNode** m_turnNodes;
93 Ogre::SceneNode** m_circNodes;
94
95 Ogre::SceneNode* m_LOSNode;
96 Ogre::SceneNode* m_TargetPointNode;
97
98 Ogre::ManualObject* sigth;
99 #endif
100 };
101}
Definition WaypointRefGen.h:25
void AcceptedStep(double T, const double *X) override
switches to the next waypoint when the vessel is inside the circle of acceptance of the target
WaypointRefGen(const std::string &simObjectName, ISimObjectCreator *const creator)
reads parameters, registers states, input/output ports and shared resources
Definition Waypoint.h:16
Simple waypoint object.
Definition CableAttach.h:16