PYTHON   24

RunToss

Guest on 2nd August 2022 12:42:09 AM

  1. from cozmo_fsm import *
  2. from cozmo.util import degrees, Pose
  3. import math
  4.  
  5. class Toss(StateNode):
  6.     def start(self, event=None):
  7.         if self.running: return
  8.         robot.play_anim_trigger(cozmo.anim.Triggers.CodeLabHiccup)
  9.  
  10.  
  11. class RunToss(StateMachineProgram):
  12.     def setup(self):
  13.         """
  14.            StateNode() =N=> get_ready
  15.            #We use 10 here because it is the maximum speed according
  16.            #to the documentation
  17.            get_ready: SetLiftHeight(0) =C=> Toss()
  18.        """
  19.        
  20.         # Code generated by genfsm on Tue Feb  4 16:40:43 2020:
  21.        
  22.         statenode1 = StateNode() .set_name("statenode1") .set_parent(self)
  23.         get_ready = SetLiftHeight(0) .set_name("get_ready") .set_parent(self)
  24.         toss1 = Toss() .set_name("toss1") .set_parent(self)
  25.        
  26.         nulltrans1 = NullTrans() .set_name("nulltrans1")
  27.         nulltrans1 .add_sources(statenode1) .add_destinations(get_ready)
  28.        
  29.         completiontrans1 = CompletionTrans() .set_name("completiontrans1")
  30.         completiontrans1 .add_sources(get_ready) .add_destinations(toss1)
  31.        
  32.         return self

Raw Paste


Login or Register to edit or fork this paste. It's free.