# uw12v000.mi
#
#  Retrieves waypoints from mafiles/goto_l12.ma
#  Retrieves envelope  from     mafiles/yo12.ma
#
#
# All science sensors sample on only downcast
#
# 08-Mar-02 tc@DinkumSoftware.com Initial
# 08-Apr-02 tc@DinkumSoftware.com all surface behaviors read bargs from file
# 06-May-02 tc@DinkumSoftware.com Changed prepare_to_dive
#                                 b_arg wait_time to 12 minutes
# 29-Jul-02 tc@DinkumSoftware.com Increased keystroke_wait_time(sec) from 30 to 300
#                                 to give iridium a chance to actually call.
# 06-Aug-02 tc@DinkumSoftware.com Added surface behavior to listen to science
# 04-Mar-03 tc@DinkumSoftware.com removed default b_args
# 23-Jul-03 tc@DinkumSoftware.com Added behavior sample
# 31-Jan-04 tc@DinkumSoftware.com removed abend: control_c arg it was set to
#                                 NOT allow user to interrupt. Basically manually
#                                 making cvs version 1.19 same as 1.16.  Kat
#                                 apparently deleted it by mistake in cvs ver 1.7
#                                 and didn't put back the right copy when she made 1.8
# 11-Aug-05 pfurey@DinkumSoftware.com Removed abend b_arg: samedepth_for(s) 120,
#                                     using masterdata default 1800 sec.
# 20-Apr-06 moose@DinkumSoftware.com Cloned from uw11v001.mi to uw12v000.mi,
#                                    changed 11's to 12's,
#                                    removed surface behaviors that
#                                       come up if haven't had comms,
#                                       when mission done,
#                                       every waypoint,
#                                       and every 10 minutes
# 21-Apr-06 moose@DinkumSoftware.com Removed all surface behaviors and
#                                    prepare_to_dive behavior
#


behavior: abend
    b_arg: overdepth_sample_time(s)       10.0 # how often to check

                                               # MS_ABORT_OVERTIME
    b_arg: overtime(s)                  7200.0 # < 0 disables

    b_arg: samedepth_for_sample_time(s)   30.0 # how often to check


    # An alternative method of terminating a mission (b_arg: sensor_type)
behavior: mission_ender
    b_arg: start_when(enum) 1          # See doco above: 1,2,3, or 4


    # Come up briefly if "yo" finishes
    # This happens if a bad altimeter hit causes a dive and climb to
    # complete in same cycle.  We surface and hopefully yo restarts
# behavior: surface
#    b_arg: args_from_file(enum) 12 # read from mafiles/surfac12.ma
#    b_arg: start_when(enum)   2   # 0-immediately, 1-stack idle 2-pitch idle 3-heading idle
                                  # 6-when_secs, 7-when_wpt_dist
#    b_arg: end_action(enum)   1     # 0-quit, 1 wait for ^C quit/resume, 2 resume
#    b_arg: gps_wait_time(s) 300    # how long to wait for gps
#    b_arg: keystroke_wait_time(s) 15   # how long to wait for control-C


    # Come up when requested by science
# behavior: surface
#    b_arg: args_from_file(enum) 12 # read from mafiles/surfac12.ma
#    b_arg: start_when(enum)     11 # BAW_SCI_SURFACE
#    b_arg: end_action(enum)   1     # 0-quit, 1 wait for ^C quit/resume, 2 resume
#    b_arg: report_all(bool)   0     # T->report all sensors once, F->just gps
#    b_arg: gps_wait_time(s) 300    # how long to wait for gps
#    b_arg: keystroke_wait_time(s) 300   # how long to wait for control-C


behavior: goto_list
    b_arg: args_from_file(enum) 12   # read from mafiles/goto_l12.ma
    b_arg: start_when(enum)      0   # 0-immediately, 1-stack idle 2-heading idle


behavior: yo
    b_arg: args_from_file(enum) 12   # read from mafiles/yo12.ma
    b_arg: start_when(enum) 2        #  0-immediately, 1-stack idle 2-depth idle
    b_arg: end_action(enum) 2        # 0-quit, 2 resume


   # Sample all science sensors only on downcast
behavior: sample
    b_arg: intersample_time(s)                0  # if < 0 then off, if = 0 then


behavior: sensors_in       # Turn most input sensors off


# Some documentation on b_arg's common to all behaviors
# NOTE: When you add these common b_args, put them at END of b_arg
#       list for behaviors.  They don't "naturally" belong there, but
#       it means you don't have to edit behaviors which typically have
#       hardwired b_arg positions in them

# NOTE: These are symbolically defined beh_args.h
# b_arg: START_WHEN     When the behavior should start, i.e. go from UNITIALIZED to ACTIVE
#
# b_arg: STOP_WHEN
#   0   complete
#   1-N same as "start_when"
#    BAW_IMMEDIATELY    0   // immediately
#    BAW_STK_IDLE       1   // When stack is idle (nothing is being commanded)
#    BAW_PITCH_IDLE     2   // When pitch is idle(nothing is being commanded)
#    BAW_HEADING_IDLE   3   // When heading is idle(nothing is being commanded)
#    BAW_UPDWN_IDLE     4   // When bpump/threng is idle(nothing is being commanded)
#    BAW_NEVER          5   // Never stop
#    BAW_WHEN_SECS      6   // After behavior arg "when_secs", from prior END if cycling
#    BAW_WHEN_WPT_DIST  7   // When sensor(m_dist_to_wpt) < behavior arg "when_wpt_dist"
#    BAW_WHEN_HIT_WAYPOINT 8 // When X_HIT_A_WAYPOINT is set by goto_wpt behavior
#    BAW_EVERY_SECS     9   // After behavior arg "when_secs", from prior START if cycling
#    BAW_EVERY_SECS_UPDWN_IDLE 10  // After behavior arg "when_secs", from prior START AND
#                                  //       updown is idle, no one commanding vertical motion
#    BAW_SCI_SURFACE    11  // SCI_WANTS_SURFACE is non-zero
#    BAW_NOCOMM_SECS    12  // when have not had comms for WHEN_SECS secs
