FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
SwitchConsoleInput.h
1#ifndef SwitchConsoleInput_h__
2#define SwitchConsoleInput_h__
3
69#include <fhsim/simobject/SimObject.h>
70
71#include <memory>
72#include <string>
73
74#include "JoystickInput.h"
75
76namespace Ship{
77
78#ifdef FH_VISUALIZATION
79 namespace joystick { class SdlJoystickPoller; }
80#endif
81
82 class SwitchConsoleInput: public SimObject, public joystick::JoystickListener{
83 public:
84 SwitchConsoleInput(const std::string simObjectName, ISimObjectCreator* const creator);
85 ~SwitchConsoleInput() override;
86
87 void OdeFcn(const double T, const double *const X, double *const XDot) const;
88
89 void InitialConditionSetup(const double T, const double *const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
90
91 const double * WinchSpeed(const double T, const double* const X);
92 const double * WinchCable(const double T, const double* const X);
93
94 const double * AttachCable(const double T, const double* const X);
95
96 const double * BaseRotationAngle(const double T, const double* const X);
97 const double * BaseElevationAngle(const double T, const double* const X);
98 const double * BaseElevationAngleRate(const double T, const double* const X);
99
100 const double * JointAngle0(const double T, const double* const X);
101 const double * JointAngleRate0(const double T, const double* const X);
102 const double * ElementLength0(const double T, const double* const X);
103
104 const double * JointAngle1(const double T, const double* const X);
105 const double * JointAngleRate1(const double T, const double* const X);
106 const double * ElementLength1(const double T, const double* const X);
107
108#ifdef FH_VISUALIZATION
109 virtual void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
110 virtual void RenderUpdate( const double T, const double* const X );
111 void RenderRelease() override;
112#endif
114
115 void ButtonPressed(int button, const joystick::JoystickState& state) override;
116 void ButtonReleased(int button, const joystick::JoystickState& state) override;
117 void AxisMoved(int axis, const joystick::JoystickState& state) override;
119 private:
120
121 size_t m_joypadID;
122
123 double m_winchSpeed;
124 int m_winchCounter;
125 int m_winchState;
126 bool m_craneEnable;
127 bool m_connectEnable;
128
129 double m_baseSpeed;
130 int m_baseState;
131
132 double m_baseAngleSpeed;
133 int m_baseAngle;
134
135 int m_jointAngleState0;
136 int m_jointAngleState1;
137
138 int m_telescopeState0;
139 int m_telescopeState1;
140
141 double m_jointAngleSpeed0;
142 double m_jointAngleSpeed1;
143
144 double m_jointTelescopeSpeed0;
145 double m_jointTelescopeSpeed1;
146
147 double m_baseLimits[2];
148
149 double m_baseAngleLimits[2];
150 double m_baseLength;
151
152 double m_angleLimits0[2];
153 double m_telescopeLimits0[2];
154
155 double m_angleLimits1[2];
156 double m_telescopeLimits1[2];
157
158 double m_winchSpeedOut;
159 double m_attachOut;
160
161#ifdef FH_VISUALIZATION
162 std::unique_ptr<joystick::SdlJoystickPoller> m_joystick;
163#endif
164 };
165
166
167}
168#endif // SwitchConsoleInput_h__
Definition SwitchConsoleInput.h:82
void AxisMoved(int axis, const joystick::JoystickState &state) override
SDL axis axis changed (OIS axisMoved, or sliderMoved for a slider axis).
void ButtonPressed(int button, const joystick::JoystickState &state) override
Button button went down (OIS buttonPressed).
void ButtonReleased(int button, const joystick::JoystickState &state) override
Button button went up (OIS buttonReleased).
Receives the changes between two joystick states, as an OIS JoyStickListener received events.
Definition JoystickInput.h:96
Simple waypoint object.
Definition CableAttach.h:58
Definition JoystickInput.h:79