FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
SwitchConsoleInput.h
1#ifndef SwitchConsoleInput_h__
2#define SwitchConsoleInput_h__
3
26#include <fhsim/simobject/SimObject.h>
27
28#include <memory>
29#include <string>
30
31#include "JoystickInput.h"
32
33namespace Ship{
34
35#ifdef FH_VISUALIZATION
36 namespace joystick { class SdlJoystickPoller; }
37#endif
38
39 class SwitchConsoleInput: public SimObject, public joystick::JoystickListener{
40 public:
41 SwitchConsoleInput(const std::string simObjectName, ISimObjectCreator* const creator);
42 ~SwitchConsoleInput() override;
43
44 void OdeFcn(const double T, const double *const X, double *const XDot) const;
45
46 void InitialConditionSetup(const double T, const double *const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
47
48 const double * WinchSpeed(const double T, const double* const X);
49 const double * WinchCable(const double T, const double* const X);
50
51 const double * AttachCable(const double T, const double* const X);
52
53 const double * BaseRotationAngle(const double T, const double* const X);
54 const double * BaseElevationAngle(const double T, const double* const X);
55 const double * BaseElevationAngleRate(const double T, const double* const X);
56
57 const double * JointAngle0(const double T, const double* const X);
58 const double * JointAngleRate0(const double T, const double* const X);
59 const double * ElementLength0(const double T, const double* const X);
60
61 const double * JointAngle1(const double T, const double* const X);
62 const double * JointAngleRate1(const double T, const double* const X);
63 const double * ElementLength1(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 void RenderRelease() override;
69#endif
71
72 void ButtonPressed(int button, const joystick::JoystickState& state) override;
73 void ButtonReleased(int button, const joystick::JoystickState& state) override;
74 void AxisMoved(int axis, const joystick::JoystickState& state) override;
76 private:
77
78 size_t m_joypadID;
79
80 double m_winchSpeed;
81 int m_winchCounter;
82 int m_winchState;
83 bool m_craneEnable;
84 bool m_connectEnable;
85
86 double m_baseSpeed;
87 int m_baseState;
88
89 double m_baseAngleSpeed;
90 int m_baseAngle;
91
92 int m_jointAngleState0;
93 int m_jointAngleState1;
94
95 int m_telescopeState0;
96 int m_telescopeState1;
97
98 double m_jointAngleSpeed0;
99 double m_jointAngleSpeed1;
100
101 double m_jointTelescopeSpeed0;
102 double m_jointTelescopeSpeed1;
103
104 double m_baseLimits[2];
105
106 double m_baseAngleLimits[2];
107 double m_baseLength;
108
109 double m_angleLimits0[2];
110 double m_telescopeLimits0[2];
111
112 double m_angleLimits1[2];
113 double m_telescopeLimits1[2];
114
115 double m_winchSpeedOut;
116 double m_attachOut;
117
118#ifdef FH_VISUALIZATION
119 std::unique_ptr<joystick::SdlJoystickPoller> m_joystick;
120#endif
121 };
122
123
124}
125#endif // SwitchConsoleInput_h__
Definition SwitchConsoleInput.h:39
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:16
Definition JoystickInput.h:79