示例#1
0
  def update(self,cart):
      """
      update the gui drawing the cart.
      wait if to maintain the required framerate.
      """
      
      self._draw(cart)
 
      gui.tick(self.frameRate)  
示例#2
0
    def update(self, cart):
        """
        update the gui drawing the cart.
        wait if to maintain the required framerate.
        """

        self._draw(cart)

        gui.tick(self.frameRate)
示例#3
0
force_scale = 10.0

sizes = [2, 1]

net = brain.loadBrain()

INIT_ANG = 0.3

cart.setAngle(math.pi + INIT_ANG)

while not gui.check_for_quit():  #  loop until user hits escape

    # Test for falling over
    # if fallen then reset with a random angle

    input = copy.deepcopy(cart.getState())
    input[0] = input[0] - math.pi
    out = net.ffwd(input)

    force = (out[0] - 0.5) * force_scale

    # step the car for a single GUI frame
    cart.step(force, dt)

    # draw the cart and display info
    draw(screen, cart, force)

    # slow the gui down to the given frameRate
    gui.tick(frameRate)
示例#4
0
        net.setWeights(guess)
        time=0;  

  
    input = copy.deepcopy(cart.getState())
    input[0]=input[0]-math.pi
    out=net.ffwd(input)
    
    force=(out[0]-0.5)*force_scale
 
    # step the car for a single GUI frame        
    cart.step(force,dt)
    
    time+=dt
    tot_time+=dt
    fit=time-cart.getX()
        
    ################  RESET CODE ##############################
    
  
        
    ############################################################
    
    if graphics:
        # draw the cart and display info
        draw(screen,cart,force)
    
        # slow the gui down to the given frameRate
        gui.tick(frameRate)