Mission monitor sequencer: Difference between revisions

From Rsewiki
Line 10: Line 10:


  <?xml version="1.0" ?>
  <?xml version="1.0" ?>
  <plan name="planB" full="true">
  <plan name="CrossRoad">
     <init>
     <init>
         gateFound = false
         odoPose.tripB = 0
         <plan name="straight" if="not gateFound and odoPose.tripB &lt; 100.0">
        nearRoad = false // define local variable
             odoPose.tripB = odoPose.tripB + 15.1;
         <plan name="maxOdoDist" if="odoPose.tripB > 250">  
             if (odoPose.tripB > 80.0) break "planB"
             print("Driven too far on odo " odoPose.tripB "m") // print message
            break CrossRoad // failed to cross road - could trigger a relocalization
        </plan>
        <plan name="closeToRoad" if="hypot(utmPose.poseY - 6174307, utmPose.poseX - 707873) &lt; 15" >
             print("Cose to road slowing down) // print message
            smr.speed=0.5  // set the desired maximum speed in mrc interface module
            nearRoad = true  // set flag
            disable  // disable this rule (plan)
        </plan>
        <plan name="turn">
            <parameter angle="pi" dist=1.0/>
            <commands to="smr.send">
              # construct commands to MRC using the smr.send command
              'drive @v ' smr.speed ' : ($drivendist > ' dist ')'
              'turn ' angle
              'drive : ($drivendist > ' dist ')'
            </commands>
         </plan>
         </plan>
     </init>
     </init>
     print("started")
     print("started")
     enable("straight")         # active - or until disabled.
     enable("maxOdoDist")   // should have found road by now
     odoPose.tripB = 100.1
     enable("closeToRoad") // active until disabled.
    wait(1) : false;
     roaddrive.right(0.75) : nearRoad // follow road 75cm from edge until near road
    odoPose.tripB = 0.4
     // more stuff missing here to detect traffic etc.
    wait(99) : gateFound
     ...
    print("wait expired!!! - block print")
    turn() // turn back - using a call to a plan
     <commands to="smr.send">
     success=true
        # through gate, turn right and re-find line near wall
        'followline "bm" @v0.3: ($drivendist >0.37)'
        'turn 90' + ' slut'
    </commands>
    <post>
        print("finsihed gate-on-the-loose")
     </post>
</plan>
 
<plan name="planMain" full="default">
     <init>
        powHi = 13.9
        powLo = powHi - 3.5
        <plan name="powerMon" if="power.low()">
            print("Stopping - out of power")
            break pit
        </plan>
        energy = 66;
    </init>
    enable("powerMon")
    <commands to="print">
        # through gate, turn right and re-find line near wall
        'followline "bm" @v0.3: ($drivendist >0.37)'
        'turn 90' + ' slut'
     </commands>
    wait(20) : false
    planB()
     <post>
     <post>
         print("finished OK")
         print("finsihed crossRoad - success=" success)
     </post>
     </post>
  </plan>
  </plan>


A number of these plans can be started (enabled) simultaniously, an can in principle be total independant. I.e.one can control the robot arm whele another controls the navigation.
A number of these plans can be started (enabled) simultaniously, an can in principle be total independant. I.e.one can control the robot arm whele another controls the navigation.

Revision as of 08:28, 15 August 2008

Introduction

This plug-in implements a a language that is a mixture of a rule-based and a sequential based language. The idea is that a number of situations need permanent - or semi permanent - monitoring to get a good situation awareness for the root, and at the same time a large number of the robot tasks are better described by a sequential language.

This implementation attempts to cover this gab.

Language

An example function could look like this:

<?xml version="1.0" ?>
<plan name="CrossRoad">
   <init>
       odoPose.tripB = 0
       nearRoad = false // define local variable
       <plan name="maxOdoDist" if="odoPose.tripB > 250"> 
           print("Driven too far on odo " odoPose.tripB "m") // print message
           break CrossRoad // failed to cross road - could trigger a relocalization
       </plan>
       <plan name="closeToRoad" if="hypot(utmPose.poseY - 6174307, utmPose.poseX - 707873) < 15" >
           print("Cose to road slowing down) // print message
           smr.speed=0.5  // set the desired maximum speed in mrc interface module
           nearRoad = true  // set flag
           disable  // disable this rule (plan)
       </plan>
       <plan name="turn">
           <parameter angle="pi" dist=1.0/>
           <commands to="smr.send">
             # construct commands to MRC using the smr.send command
             'drive @v ' smr.speed ' : ($drivendist > ' dist ')'
             'turn ' angle
             'drive : ($drivendist > ' dist ')'
           </commands>
       </plan>
   </init>
   print("started")
   enable("maxOdoDist")   // should have found road by now
   enable("closeToRoad")  // active until disabled.
   roaddrive.right(0.75) : nearRoad // follow road 75cm from edge until near road
   // more stuff missing here to detect traffic etc.
   ...
   turn() // turn back - using a call to a plan
   success=true
   <post>
       print("finsihed crossRoad - success=" success)
   </post>
</plan>

A number of these plans can be started (enabled) simultaniously, an can in principle be total independant. I.e.one can control the robot arm whele another controls the navigation.