DEFINITIONS ----------- pay out        Winch motor turns to remove cable and lower the CTD reel in        Winch motor turns to rewind cable and raise the CTD encoder tick   Encoder on the reel has discrete ticks that can be counted. soak depth     Measured in encoder ticks, the depth where the CTD is known to be fully submerged ASSUMPTIONS ----------- 1. The winch motor can be told to command any speed -100 to 100.   100 = Pay out at full speed    50 = Pay out at half speed     0 = Stop   -50 = Reel in at half speed  -100 = Reel in at full speed 2. The winch motor can be told to travel to any encoder tick (WINCH_TO_TICK message). Empirical measurement will define what maximum tick number is. 0 = Fully retracted 3. Speed can only be commanded when CTD_DEPTH has been reported within the past 1 second. 4. The winch app will respond to the latest command, whether speed or encoder tick. 4. If CTD_DEPTH is older than 1 second, stop the motor. Only allow reeling in, do not pay out. 5. Depth control is handled by the state machine. The winch app only simply responds to motion requests. 6. The winch app will stop paying out so that CABLE_LENGTH encoder ticks is the most that can be payed out. 7. The winch app will stop reeling in so that 0 encoder ticks is the most that can be reeled in. 8. Going from stopped to +/- 100 speed will ramp up over maximum of 1 second. 9. Travel between encoder ticks will ramp up to +/-ENC_TICK_SPEED. 10. Winch at = 0 means CTD is stowed. CONFIG PARAMETERS ----------------- SOAK_DEPTH  Whole number encoder ticks where the CTD is known to be fully submerged.  Data type:        int32_t  Default value:    None  Range:            0 and positive integers  Definition error: App cannot start CABLE_LENGTH  Whole number encoder ticks that is the last tick allowed to be reached before the cable is completely unrolled.  Data type:        int32_t  Default value:    None  Range:            Non-zero positive integers  Definition error: App cannot start ENC_TICK_SPEED  Maximum speed the motor will ramp up to when moving between encoder ticks  Data type:        int32_t  Default value:    10.0  Range:            Non-zero positive real numbers  Definition error: Use default value CAST_SPEED  Maximum speed the motor will ramp up to when paying out or reeling in during a cast  Data type:        int32_t  Default value:    25.0  Range:            Non-zero positive real numbers  Definition error: Use default value SUBSCRIPTIONS ------------- WINCH_ALL_STOP  When “true”, stop the winch motor at the current position. Take no action for any other value.  Expected source: iRex4  Data type:       String  Expected values: “true” (case insensitive) CTD_DEPTH  Current depth of the CTD as reported by the CTD unit  Expected source: iRex4CTD  Data type:       Double  Expected values: > 0.0 = Valid                   0.0   = Invalid                   < 0.0 = CTD not reporting WINCH_CMD Explicit command to change state Expected source: pRex4 Data type: string Expected values: SOAK Pay out or reel in to reach the encoder tick defined as SOAK_DEPTH [num] Start at soak depth, pay out until CTD_DEPTH==[num] or CABLE_LENGTH encoder ticks is reached No need to hold at depth. Reel in to soak depth. Travel at CAST_SPEED. STOW Reel in to reach encoder tick of 0 WINCH_TO_TICK Command for the winch to travel to this encoder tick position   Expected source: pRex4   Data type:       Double (treat value as an int)   Expected values: 0 (to return to fully retracted) Positive integers PUBLICATIONS ------------ MESSAGE_NAME (data type) [expected source] Definition WINCH_AT_TICK (int) Current encoder tick of the winch. Reported one call to Iterate() --> at 5 hZ. WINCH_STATE (string) Current state of the winch. Reported on change. STOW Not moving with encoder position of 0, fully reeled-in. TRAVEL Paying out or reeling in while traveling to an encoder position SOAK Not moving with encoder position of SOAK_DEPTH. CAST Actively paying out/reeling in during a cast STOP Stopped at a position other than STOW or SOAK