|
FhSim
3.1.0
Marine systems simulation
|
Collaboration diagram for Switch console input:Reads the crane switch console joystick with SDL device index ConsoleID (OIS JoyStick::getID() until 3.0.0), through SDL (visualization builds only; without visualization the rates stay zero). It opens the joystick in RenderInit and polls it in RenderUpdate. Without the joystick it logs a warning and the rates stay zero.
Mapping from OIS to SDL. The SDL indices are the OIS indices (JoystickInput.h):
| Rate | OIS | SDL |
|---|---|---|
| BaseRotation speed | axis 2 / MAX_AXIS | SDL_JoystickGetAxis(2) / 32767 |
| BaseElevationAngleRate | axis 1 / MAX_AXIS | SDL_JoystickGetAxis(1) / 32767 |
| JointAngleRate0 | axis 3 / MAX_AXIS | SDL_JoystickGetAxis(3) / 32767 |
| Telescope 0 speed | axis 4 / MAX_AXIS | SDL_JoystickGetAxis(4) / 32767 |
| JointAngleRate1 | axis 0 / MAX_AXIS | SDL_JoystickGetAxis(0) / 32767 |
| Telescope 1 speed | slider 0 / MAX_AXIS | SDL_JoystickGetAxis(5) / 32767 (slider 0) |
The axes are read on any axis or slider change; a rate below 0.05 in magnitude is zero. Buttons (SDL button i = OIS button i): 14 and 17 winch out while held, 15 winch in while held (the winch speed is 0.5 times the number held), 13 enables the crane while held, 12 attaches the cable while held.
All have size 1. The angles, lengths and the rate scale are not given units in the code.
| Name | Width | Description |
|---|---|---|
| WinchSpeed | 1 | Winch speed: 0.5 times the winch counter set by the winch buttons (see above) |
| WinchCable | 1 | Winched length of the cable (state WinchLength) |
| AttachCable | 1 | 1 while the attach button is held, else 0 |
| BaseRotationAngle | 1 | State BaseSpeed (the rotation angle of the base: the name of the state is historic) |
| BaseElevationAngle | 1 | State BaseAngle |
| BaseElevationAngleRate | 1 | Rate set by the base elevation axis |
| JointAngle0 | 1 | Angle of joint 0 |
| JointAngle1 | 1 | Angle of joint 1 |
| JointAngleRate0 | 1 | Rate set by the joint 0 axis |
| JointAngleRate1 | 1 | Rate set by the joint 1 axis |
| ElementLength0 | 1 | Length of telescope 0 |
| ElementLength1 | 1 | Length of telescope 1 |
The object has no input ports. A state stops moving in the direction of a limit when it is outside the limits. The crane states move only while the enable button is held.
| Name | Width | Description |
|---|---|---|
| ConsoleID | 1 | SDL device index of the console joystick, written as a string of an integer. Required |
| BaseAngleLimits | 2 | Lower and upper limit of the base rotation angle. Required |
| BaseElevationLimits | 2 | Lower and upper limit of the base elevation angle. Required |
| JointAngleLimits0 | 2 | Lower and upper limit of joint 0. Required |
| JointAngleLimits1 | 2 | Lower and upper limit of joint 1. Required |
| JointTelescopeLimits0 | 2 | Lower and upper limit of the length of telescope 0. Required |
| JointTelescopeLimits1 | 2 | Lower and upper limit of the length of telescope 1. Required |
| InitialWinchedLength | 1 | Initial value of the state WinchLength. Default 0 |
The initial value of a limited state is its lower limit.
| Name | Width | Description |
|---|---|---|
| WinchLength | 1 | Winched length. Initial value from InitialWinchedLength |
| BaseSpeed | 1 | Base rotation angle (integral of the base rotation axis rate) |
| BaseAngle | 1 | Base elevation angle |
| JointAngle0 | 1 | Angle of joint 0 |
| JointAngle1 | 1 | Angle of joint 1 |
| Telesope0 | 1 | Length of telescope 0 (the spelling of the name is as in the code) |
| Telesope1 | 1 | Length of telescope 1 |