예제 #1
0
 def set_drone_states(self, drones: List[Drone]):
     drones[3].position = vec3(250, 250, 100)
     drones[3].orientation = euler_to_rotation(vec3(0, math.pi / 2, 0))
     drones[3].velocity = vec3(0, 3000, 0)
     drones[3].angular_velocity = vec3(0, 0, 0)
     drones[4].position = vec3(-250, 250, 100)
     drones[4].orientation = euler_to_rotation(vec3(0, math.pi / 2, 0))
     drones[4].velocity = vec3(0, 3000, 0)
     drones[4].angular_velocity = vec3(0, 0, 0)
예제 #2
0
 def set_drone_states(self, drones: List[Drone]):
     drones[0].position = vec3(0, 0, 100)
     drones[0].orientation = euler_to_rotation(vec3(0, math.pi / 2, 0))
     drones[0].velocity = vec3(0, 0, 0)
     drones[0].angular_velocity = vec3(0, 0, 0)
     drones[1].position = vec3(-250, 4500, 100)
     drones[1].orientation = euler_to_rotation(vec3(0, -math.pi / 2, 0))
     drones[1].velocity = vec3(0, 0, 0)
     drones[1].angular_velocity = vec3(0, 0, 0)
     drones[2].position = vec3(250, 4500, 100)
     drones[2].orientation = euler_to_rotation(vec3(0, -math.pi / 2, 0))
     drones[2].velocity = vec3(0, 0, 0)
     drones[2].angular_velocity = vec3(0, 0, 0)
     for i in range(3, 7):
         drones[i].position = vec3(0, -4500, 500)
예제 #3
0
 def set_drone_states(self, drones: List[Drone]):
     for i, drone in enumerate(drones):
         drone.position = self.pos
         drone.position[2] += i * self.height
         drone.orientation = euler_to_rotation(vec3(0, math.pi / 2, 0))
         drone.velocity = vec3(0, 0, 0)
         drone.angular_velocity = vec3(0, 0, 0)
예제 #4
0
 def set_drone_states(self, drones: List[Drone]):
     for i, drone in enumerate(drones):
         angle = (-1)**i * -math.pi / 2
         x = -self.x_distance * (-1)**i
         y = (self.y_distance + self.gap_offset * (i // 2)) * (-1)**i
         drone.position = vec3(x, y, 20)
         drone.orientation = euler_to_rotation(vec3(0, angle, 0))
         drone.velocity = vec3(0, 0, 0)
         drone.angular_velocity = vec3(0, 0, 0)
예제 #5
0
 def set_drone_states(self, drones: List[Drone]):
     for i, drone in enumerate(drones):
         angle = (2 * math.pi / 64) * i
         drone.position = vec3(dot(rotation(angle), vec2(self.radius, 0)))
         drone.position[2] = self.height
         drone.velocity = vec3(0, 0, 0)
         drone.orientation = euler_to_rotation(
             vec3(math.pi / 2, angle, math.pi))
         drone.angular_velocity = vec3(0, 0, 0)
예제 #6
0
 def set_drone_states(self, drones: List[Drone]):
     s = int(math.sqrt(len(drones)))  # Side length
     for i, drone in enumerate(drones):
         # Get grid pos.
         x = (i // s) - (s - 1) / 2
         y = (i % s) - (s - 1) / 2
         drone.position = vec3(x * self.spacing, y * self.spacing,
                               800)  # 800 is base height
         drone.orientation = euler_to_rotation(vec3(math.pi / 2, 0, 0))
         drone.velocity = vec3(0, 0, 100)
         drone.angular_velocity = vec3(0, 0, 0)
예제 #7
0
    def set_drone_states(self, drones: List[Drone]):
        for i, drone in enumerate(drones):
            if i in range(0, 16):
                pos = vec3(-self.radius, -self.offset, 20)
                angle = 0

            elif i in range(16, 32):
                pos = vec3(self.offset, -self.radius, 20)
                angle = math.pi / 2

            elif i in range(32, 48):
                pos = vec3(self.radius, self.offset, 20)
                angle = math.pi

            elif i in range(48, 64):
                pos = vec3(-self.offset, self.radius, 20)
                angle = 3 * math.pi / 2

            drone.position = pos
            drone.position[2] += (i % 16) * self.height
            drone.orientation = euler_to_rotation(vec3(0, angle, 0))
            drone.velocity = vec3(0, 0, 0)
            drone.angular_velocity = vec3(0, 0, 0)
예제 #8
0
def rotator_to_mat3(r: Rotator) -> mat3:
    return euler_to_rotation(vec3(r.pitch, r.yaw, r.roll))
예제 #9
0
def rotationToOrientation(rotation):
    return euler_to_rotation(vec3(rotation.pitch, rotation.yaw, rotation.roll))