FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
WaypointRefGen.h
1#pragma once
2
45#include <Eigen/Eigen>
46#include <vector>
47#include <string>
48#include <fhsim/simobject/SimObject.h>
49#ifdef FH_VISUALIZATION
50#pragma warning(push)
51#pragma warning( disable : 4251 )
52 #include <Ogre.h>
53#pragma warning(pop)
54#endif
55#include "Waypoint.h"
56using namespace Eigen;
57
58
59namespace Ship{
60 class WaypointRefGen : public SimObject
61 {
62 public:
63 EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
64 WaypointRefGen(const std::string& simObjectName, ISimObjectCreator* const creator);
66 const double* DesiredQuaternion(const double T, const double* const X);
67 const double* DesiredHeading(const double T, const double* const X);
68 const double* DesiredHeadingRate(const double T, const double* const X);
69 const double* CrossTrackError(const double T, const double* const X);
70 const double* DesiredPosition(const double T,const double* const X);
71 const double* DesiredSpeed(const double T,const double* const X);
72 void OdeFcn(const double T, const double *const X,double *const ) const{}
73 void FinalSetup(const double T,const double* const X, ISimObjectCreator* const creator);
74 void Compute(const double T,const double* const X) const;
75 void AcceptedStep(double T, const double* X) override;
76
77 #ifdef FH_VISUALIZATION
78 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
79 void RenderUpdate(const double T, const double* const X);
80 #endif
81
82
83 private:
84 ISignalPort* m_adStatePositionPort;
85 ISignalPort* m_adStateVelocityPort;
86 ICommonComputation *m_Compute;
87
88 mutable std::vector<Waypoint> m_aWPList;
89
90 mutable Eigen::Vector3d m_adStatePosition;
91 Eigen::Vector3d m_adStateVelocity;
92 Eigen::Vector3d m_adStateVelocity_Desired;
93
94 std::string sideslipCompensation;
95
96 double initialPosition[3];
97 double* pK;
98 mutable double desiredHeading;
99 mutable double desiredHeadingRate;
100 mutable double crosstrackError;
101 double m_dLookaheadDistance;
102 double m_lookahead;
103 double m_dSideSlipAngle;
104 double alphaK;
105 double m_adStateTheta_Desired[4];
106 mutable double desiredPosition[3];
107 mutable double m_desiredSpeed;
108 int numberOfPoints;
109
110 int iCurrentWaypointNumber;
111
112 std::vector<double> waypoint_n;
113 std::vector<double> waypoint_e;
114 std::vector<double> waypoint_d;
115 std::vector<double> waypoint_r;
116 std::vector<double> waypoint_leg_speed;
117 double m_sectionType;
118
119 std::vector<Eigen::Vector3d> legstart;
120 std::vector<Eigen::Vector3d> legend;
121 std::vector<Eigen::Vector3d> circle_center;
122 std::vector<double> circle_radius;
123
124 #ifdef FH_VISUALIZATION
125 Ogre::SceneNode** m_wpNodes;
126 Ogre::SceneNode** m_legNodes;
127
128 Ogre::SceneNode** m_turnNodes;
129 Ogre::SceneNode** m_circNodes;
130
131 Ogre::SceneNode* m_LOSNode;
132 Ogre::SceneNode* m_TargetPointNode;
133
134 Ogre::ManualObject* sigth;
135 #endif
136 };
137}
Definition WaypointRefGen.h:61
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
Simple waypoint object.
Definition CableAttach.h:58