Marine systems simulation
ShipConsoleInput.h
1#ifndef _CSHIPCONSOLE_H_
2#define _CSHIPCONSOLE_H_
3
8#include <string>
9#include <SimObject.h>
10
11#ifdef FH_VISUALIZATION
12#pragma warning(push)
13#pragma warning( disable : 4251 )
14 #include <ois/OIS.h>
15#pragma warning(pop)
16class CFhCamera;
17#endif
18
19#include <Eigen/Eigen>
20
21namespace Ship{
22 #ifdef FH_VISUALIZATION
23 class ShipConsoleInput: public SimObject, OIS::JoyStickListener{
24 #else
25 class ShipConsoleInput: public SimObject{
26 #endif
27 public:
28 EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
29 enum engines{
30 PORT_ENGINE,
31 STARBOARD_ENGINE,
32 NUM_ENGINE
33 };
34
35 enum thrusters{
36 THRUSTER0,
37 THRUSTER1,
38 THRUSTER2,
39 NUM_THRUSTER
40 };
41
42 ShipConsoleInput(const std::string simObjectName, ISimObjectCreator* const creator);
43
44 void OdeFcn(const double T, const double *const X, double *const XDot, const bool IsMajorTimeStep){}
45
46 const double *RudderAngle(const double T, const double* const X);
47 const double *EngineCommand(const double T, const double* const X);
48 const double *EngineCommandPort(const double T, const double* const X);
49 const double *EngineCommandStarboard(const double T, const double* const X);
50
51 const double *EnginePower(const double T, const double* const X);
52 const double *EnginePowerPort(const double T, const double* const X);
53 const double *EnginePowerStarboard(const double T, const double* const X);
54
55 const double *ThrusterPower(const double T, const double* const X);
56 const double *Thruster0Power(const double T, const double* const X);
57 const double *Thruster1Power(const double T, const double* const X);
58 const double *Thruster2Power(const double T, const double* const X);
59
60 const double *ThrusterCommand(const double T, const double* const X);
61 const double *Thruster0Command(const double T, const double* const X);
62 const double *Thruster1Command(const double T, const double* const X);
63 const double *Thruster2Command(const double T, const double* const X);
64
65#ifdef FH_VISUALIZATION
66 virtual void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
67 virtual void RenderUpdate( const double T, const double* const X );
68 bool buttonPressed(const OIS::JoyStickEvent &arg, int button);
69 bool buttonReleased(const OIS::JoyStickEvent &arg, int button);
70 bool axisMoved(const OIS::JoyStickEvent &arg, int axis);
71 bool povMoved(const OIS::JoyStickEvent &arg, int index);
72 bool sliderMoved(const OIS::JoyStickEvent &arg, int index);
73#endif
74
75 private:
76 int m_joypadID;
77
78#ifdef FH_VISUALIZATION
79 CFhCamera* m_cam;
80#endif
81
82 ISignalPort *m_inParentOrientation;
83 ISignalPort *m_inParentPosition;
84
85 bool m_controlCamera;
86
87 size_t m_activeCamera;
88 Eigen::Vector3d m_cameraPositons[4];
89 double m_cameraRotZ[4];
90 double m_cameraRotY[4];
91
92
93 double m_rudderAngle;
94
95 bool m_engineEnable[NUM_ENGINE];
96 double m_enginePower[NUM_ENGINE];
97 double m_engineCommand[NUM_ENGINE];
98
99 double m_enginePowerOut[NUM_ENGINE];
100
101 double m_thrusterPower[NUM_THRUSTER];
102 double m_thrusterPowerOut[NUM_THRUSTER];
103 bool m_thrusterEnable[NUM_THRUSTER];
104 double m_thrusterCommandOut[NUM_THRUSTER];
105 int m_thrusterInput[NUM_THRUSTER];
106
107 };
108}
109#endif
Definition: ShipConsoleInput.h:25
Simple waypoint object.
Definition: CableAttach.h:16