def think(self, state):
        time_angle = angles.Angle.from_radians(
            state.simulation_time.total_secs)
        transformation = TransformationMatrix.TransformationMatrix(
            1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0,
            1).translate(Vector3.Vector3().with_z(1)).rotate_x(
                time_angle).rotate_y(time_angle).translate(
                    Vector3.Vector3().with_x(1)).rotate_z(time_angle)

        self._shape_set.clear()

        for line in self._lines:
            self._shape_set.add(transformation.transform(line))
Ejemplo n.º 2
0
    def __init__(self):
        self.ball_mass_kilograms = Measures.get_value('ball_mass_kilograms', 0.026)
        self.ball_radius_metres = Measures.get_value('ball_radius_metres', 0.04)
        self.field_y_length = Measures.get_value('field_y_length', 14)
        self.field_x_length = Measures.get_value('field_x_length', 21)
        self.field_z_length = Measures.get_value('field_z_length', 40)
        self.goal_y_length = Measures.get_value('goal_y_length', 2.1)
        self.goal_z_length = Measures.get_value('goal_z_length', 0.8)
        self.goal_x_length = Measures.get_value('goal_x_length', 0.6)
        self.penalty_area_x_length = Measures.get_value('penalty_area_x_length', 1.8)
        self.penalty_area_y_length = Measures.get_value('penalty_area_y_length', 3.9)
        self.free_kick_distance = Measures.get_value('free_kick_distance', 1.3)
        self.free_kick_move_distance = Measures.get_value('free_kick_move_distance', 1.5)
        self.goal_kick_distance = Measures.get_value('goal_kick_distance', 1.0)

        self.field_x_left = -self.field_x_length/2
        self.field_x_right = self.field_x_length/2
        self.field_y_top = self.field_x_length/2
        self.field_y_bottom = -self.field_y_length/2

        self.flag_height = 0
        self.goal_post_x = self.field_x_length/2

        self.flag_left_top_position = Vector3.Vector3(-self.field_x_length/2, self.field_y_length/2, self.flag_height)
        self.flag_right_top_position = Vector3.Vector3(self.field_x_length/2, self.field_y_length/2, self.flag_height)
        self.flag_left_bottom_position = Vector3.Vector3(-self.field_x_length/2, -self.field_y_length/2, self.flag_height)
        self.flag_right_bottom_position = Vector3.Vector3(+self.field_x_length/2, -self.field_y_length/2, self.flag_height)
        self.goal_left_top_position = Vector3.Vector3(-self.goal_post_x, self.goal_y_length/2, self.goal_z_length)
        self.goal_right_top_position = Vector3.Vector3(self.goal_post_x, self.goal_y_length/2, self.goal_z_length)
        self.goal_left_bottom_position = Vector3.Vector3(-self.goal_post_x, -self.goal_y_length/2, self.goal_z_length)
        self.goal_right_bottom_position = Vector3.Vector3(+self.goal_post_x, -self.goal_y_length/2, self.goal_z_length)
Ejemplo n.º 3
0
    def to_vector3(self):
        t = Distance * self.phi.cos
        x = t * self.theta.cos
        y = t * self.theta.sin
        z = Distance * self.phi.sin

        return Vector3.Vector3(x, y, z)  #need addition
Ejemplo n.º 4
0
 def __init__(self, scanner):
     self.scanner = scanner
     self.errors = Errors()
     self.t = Scanner.Token()
     self.la = Scanner.Token()
     self.err_dist = int()
     self.team_name = str()
     self.simulation_time = timedelta()
     self.game_time = timedelta()
     self.play_mode = PlayMode.PlayMode.unknown  #needs to rewatch
     self.team_side = PerceptorState.FieldSide.unknown
     self.player_id = int()
     self.agent_temperature = float()
     self.agent_battery = float()
     self.gyro_states = list()
     self.accelerometer_states = list()
     self.hinge_states = list()
     self.univsersal_joints_states = list()
     self.touch_states = list()
     self.force_states = list()
     self.landmark_positiions = list()
     self.visible_lines = list()
     self.team_mate_positions = list()
     self.opposition_positions = list()
     self.ball_position = Polar.Polar()
     self.messages = list()
     self.agent_position = Vector3.Vector3()
Ejemplo n.º 5
0
 def accelerometer_state_expr(self):
     label = str()
     v = Vector3.Vector3()
     self.expect(19)
     self.expect(7)
     self.expect(17)
     label = self.ident()
     self.expect(5)
     self.expect(7)
     self.expect(20)
     v = self.vector3()
     self.expect(5)
     self.expect(5)
     return AccelerometerState(label, v)
Ejemplo n.º 6
0
    def get_random_position(self, side):
        x1 = -self.field_x_length/2
        x2 = self.field_x_length/2

        if side == PerceptorState.FieldSide.left:
            x2 = 0
        
        elif side == PerceptorState.FieldSide.right:
            x1 = 0
        
        z = (random.randint(0, 10000)/10000)*self.field_z_length
        y = ((random.randint(0, 10000)/10000)*self.field_y_length) - self.field_y_length/2
        x = ((random.randint(0, 10000)/10000)*(x2-x1)) + x1

        return Vector3.Vector3(x,y,z)
        
    def __init__(self):
        super(DebugShapeTransformationAgent, self).__init__(NaoBody.NaoBody())
        line = Shape.Line
        Vector3 = Vector3.Vector3
        self._lines = [
            line(Vector3(0, 0, 0), Vector3(0, 1, 0)),
            line(Vector3(0, 1, 0), Vector3(1, 1, 0)),
            line(Vector3(1, 1, 0), Vector3(1, 0, 0)),
            line(Vector3(1, 0, 0), Vector3(0, 0, 0)),
            line(Vector3(0, 0, 0), Vector3(0, 0, 1)),
            line(Vector3(0, 0, 1), Vector3(1, 0, 1)),
            line(Vector3(1, 0, 1), Vector3(1, 0, 0)),
            line(Vector3(1, 0, 0), Vector3(0, 0, 0)),
            line(Vector3(0, 0, 0), Vector3(0, 0, 1)),
            line(Vector3(0, 0, 1), Vector3(0, 1, 1)),
            line(Vector3(0, 1, 1), Vector3(0, 1, 0)),
            line(Vector3(0, 1, 0), Vector3(0, 0, 0)),
            line(Vector3(0, 0, 1), Vector3(0, 1, 1)),
            line(Vector3(0, 1, 1), Vector3(1, 1, 1)),
            line(Vector3(1, 1, 1), Vector3(1, 0, 1)),
            line(Vector3(1, 0, 1), Vector3(0, 0, 1)),
            line(Vector3(0, 1, 0), Vector3(0, 1, 1)),
            line(Vector3(0, 1, 1), Vector3(1, 1, 1)),
            line(Vector3(1, 1, 1), Vector3(1, 1, 0)),
            line(Vector3(1, 1, 0), Vector3(0, 1, 0)),
            line(Vector3(1, 0, 0), Vector3(1, 0, 1)),
            line(Vector3(1, 0, 1), Vector3(1, 1, 1)),
            line(Vector3(1, 1, 1), Vector3(1, 1, 0)),
            line(Vector3(1, 1, 0), Vector3(1, 0, 0))
        ]

        self._shape_set = ShapeSet.ShapeSet('Cube')
Ejemplo n.º 8
0
 def vector3(self):
     x, y, z = self.double(), self.double(), self.double()
     return Vector3.Vector3(x, y, z)