def entry(self):
     
     #Resets the variables since the last use of the state:
     
     #starting angle
     self.start_angle = imu.get_angle()[2]
     
     #Timers
     self.start_time=time.time()
     self.timer=self.start_time+self.time_between
     
     #Which direction it should start turning its head
     self.left_or_right=self.direction
     
     #Makes sure that the head hardness is correct and
     #stores the current head position
     robotbody.set_head_hardness(0.95)
     self.wanted_head_position=robotbody.get_head_position()
     
     #Initiates the turn in the right direction
     if self.direction=="left":
         walk.turn_left(0.2)
     else:
         walk.turn_right(0.2)
         
     #Sets a fancy blue eye colour
     robotbody.set_eyes_led(0, 0, 31)
         
     print("Tracking ball")
    def entry(self):
        #Resets all the variables:
        
        #The wanted head position
        self.wanted_head_position=[-pi/3,-0.733]
        
        #The angles it has found to the goal
        self.angles=[]
        
        #The fail timer
        self.fail_timer=time.time()+7
        
        #A couple of boolean variables to help the robot
        #through the different states of finding the two goal post
        self.ending=False
        self.failing=False
        
        #Makes sure that the head hardness is right and
        #updates the position of the head
        robotbody.set_head_hardness(0.95)  
        set_head_position(self.wanted_head_position)
        
        #Sets the walk speed to the actually zero
        walk.set_velocity(0, 0, 0)

        print ("searching for goal")
 def entry(self):
     
     robotbody.set_head_hardness(1.95)
     self.wanted_head_position=robotbody.get_head_position()
     
     self.last_distance=0
     self.last_observation=0
     self.start_travel=[]
     self.direction="stand still"
Beispiel #4
0
 def entry(self):
     print("following the ball")
     robotbody.set_head_hardness(0.95)
     self.last_observation_of_ball=-1
     if self.look_down:
         self.wanted_head_position=[0,pi/4.5]
     else:
         self.wanted_head_position=robotbody.get_head_position()
     
     set_head_position(self.wanted_head_position)
 def entry(self):
     robotbody.set_head_hardness(1.95)
     self.current_head_position=robotbody.get_head_position()
     
     self.wanted_head_position=[-pi/2,0]
     robotbody.set_head_position_list(self.wanted_head_position)
        
     self.ending=False
     
     self.numbers_of_observation=0
     self.angles=[]
     
     print ("searching for goal")
Beispiel #6
0
 def entry(self):
     print("lining up...")
     robotbody.set_head_hardness(0.95)
     self.goal_angle=robotbody.get_head_position()[0]
     
     self.wanted_head_position=[self.goal_angle,pi/4.5]
     set_head_position(self.wanted_head_position)
     
     self.timer=None
     self.lost_ball_timer=time.time()+10
     
     self.first_ball_angle=None
     self.last_ball_angle=None
Beispiel #7
0
 def entry(self):
     print("Tracking ball")
     robotbody.set_head_hardness(0.95)
     self.wanted_head_position=robotbody.get_head_position()
     
     self.start_angle = imu.get_angle()[2]
     
     self.start_time=time.time()
     self.timer=self.start_time+self.time_between
     
     self.left_or_right="right"
     
     walk.turn_left(0.2)
     set_head_position(self.wanted_head_position)
 def entry(self):
     #Starts the timer from when the ball was last seen
     self.lost_ball_timer=time.time()+5
     
     #Sets the wanted head position, either to the current or
     #to one looking down at the ball
     if self.look_down:
         self.wanted_head_position=[0,pi/8]
     else:
         self.wanted_head_position=robotbody.get_head_position()
     
     #Makes sure that the head hardness is correct and updates the head position
     robotbody.set_head_hardness(0.95)
     set_head_position(self.wanted_head_position)
     
     print("following the ball")
 def entry(self):
     #Resets all the variables for the last use of the state
     #The movement timer
     self.timer=None
     
     #The last and first angle to the ball
     self.first_ball_angle=None
     self.last_ball_angle=None
     
     #The lost ball timer
     self.lost_ball_timer=time.time()+7
     
     #Makes sure that the head hardness is right and sets the
     #wanted head position to the same as last by looking down at the ball
     robotbody.set_head_hardness(0.95)
     self.goal_angle=robotbody.get_head_position()[0]
     self.wanted_head_position=[self.goal_angle,pi/8]
     set_head_position(self.wanted_head_position)
     
     #Makes the robot stand still since it shouldn't move during while looking
     walk.set_velocity(0,0,0)
     
     print("lining up...")
 def entry(self):
     robotbody.set_head_hardness(1.95)
     current_head_position=robotbody.get_head_position()
     self.wanted_head_position=[current_head_position[0],current_head_position[1]]
Beispiel #11
0
def update():
    _program.update()
    motion.update()
    vision.update()



vision.entry()
# Main loop
while not robotbody.is_middle_button_pressed():
    update()
    time.sleep(_tDelay)
    vision.update()
    
vision.exit()
"""
from help_functions import ball_angle, set_head_position
from math import pi

robotbody.set_head_hardness(0.95)
set_head_position([0,pi/8])
motion.stand_still()
vision.entry()
#0.47 left foot
#-0.47 right foot
while not robotbody.is_middle_button_pressed():
    motion.update()
    vision.update()
    print (ball_angle())
    
vision.exit()