def drawDivider(x, y, Color):
    pygame.draw.rect(screen, Color, (x, y, 10, 900), 0)


def barrierExists(barrierList, x, y):
    for barrier in barrierList:
        if barrier.x == x and barrier.y == y:
            return True
    return False


# ---------------- Initialize Pygame Pieces -----------------
robotX = 800
robotY = 800

robot = Robot(screen, robotX, robotY)

y_change = 0
x_change = 0

barrierList = []

# ---------------- Initialize Receiver/Server -----------------
IP = '192.168.0.21'
PORT = 1234
r = Receiver(IP, PORT)

# ---------------- Initialize Variables -----------------
temp_data = 0
accel_data = ''
gyro_data = ''
Example #2
0
    def __init__(self):
        # Toggle simulation elements
        server_online = False
        pygame_running = True
        controller_connected = False
        data_status = 'GUI'

        print(time.time())

        # Color List
        white = (255, 255, 255)
        green = (0, 255, 0)
        blue = (0, 0, 128)
        black = (0, 0, 0)

        # ---------------- Initialize Pygame -----------------
        pygame.init()

        # ---------------- Initialize Pygame Pieces -----------------
        if pygame_running:

            screen = pygame.display.set_mode((1400, 900))

            robotX = 800
            robotY = 800
            robot_angle = 0
            scanner_angle = 0

            robot = Robot(screen, robotX, robotY, 35, 35, (255, 255, 255))
            scanner = Robot(screen, robotX, robotY, 20, 20, (0, 0, 255))

            y_change = 0
            x_change = 0

            barrierList = []

            font = pygame.font.Font('freesansbold.ttf', 32)
            font_24 = pygame.font.Font('freesansbold.ttf', 24)

        # ---------------- Initialize Receiver/Server -----------------
        if server_online:
            # Make sure IP and PORT match server side IP and PORT
            IP = '192.168.2.2'
            PORT = 10001
            r = Receiver(IP, PORT)
            r.client.connect()

        # ---------------- Initialize Variables -----------------
        temp_data = 0
        accel_data = ''
        gyro_data = ''
        sonar_data = 0
        ir_data = 1

        message = ''

        # ---------------- Initialize Controller -----------------
        if controller_connected:
            c = Controller()

        # Set control mode to either "user-controlled" or "automated
        control_mode = "user-controlled"

        # ------------------- Configure Robot --------------------

        arm_vert_axis = 0
        arm_horiz_axis = 0

        claw_open = True
Example #3
0
    screen = pygame.display.set_mode((width, height))
    sim_surface = pygame.Surface((sim_width, sim_height))
    dist_surface = pygame.Surface((dist_width, dist_height))

    if simulation == 'minimap':
        robotX = sim_width * 6 / 7
        robotY = sim_height * 8 / 9

        robot_angle = 0
        scanner_angle = 0

        robot_height = robot_width = sim_height * 4 / 90
        scanner_height = scanner_width = sim_height * 2 / 90

        robot = Robot(sim_surface, robotX, robotY, robot_height, robot_width,
                      (255, 255, 255))
        scanner = Robot(sim_surface, robotX, robotY, scanner_height,
                        scanner_width, (0, 0, 255))

        y_change = 0
        x_change = 0

        barrierList = []
        barrier_width = sim_height / 100

    elif simulation == 'lanecontrol':
        robotX = sim_width / 2
        robotY = sim_height / 2

        robot_height = robot_width = sim_height / 3
        scanner_height = scanner_width = sim_height / 3
def drawDivider(x, y, Color):
    pygame.draw.rect(screen, Color, (x, y, 10, 900), 0)


def barrierExists(barrierList, x, y):
    for barrier in barrierList:
        if barrier.x == x and barrier.y == y:
            return True
    return False


robotX = 800
robotY = 800

robot = Robot(screen, robotX, robotY)

y_change = 0
x_change = 0

barrierList = []

c = Controller()
angle = 0
rotation = ''

fl = Motor(4)
fr = Motor(17)
br = Motor(22)
bl = Motor(27)
    screen = pygame.display.set_mode((width, height))
    sim_surface = pygame.Surface((sim_width, sim_height))
    cockpit_surface = pygame.Surface((cockpit_width, cockpit_height))
    compass_surface = pygame.Surface((compass_width, compass_height))

    if simulation == 'minimap':
        robotX = sim_width * 6 / 7
        robotY = sim_height * 8 / 9

        robot_angle = 0
        scanner_angle = 0

        robot_height = robot_width = sim_height * 4 / 90
        scanner_height = scanner_width = sim_height * 2 / 90

        robot = Robot(sim_surface, robotX, robotY, robot_height, robot_width,
                      (255, 255, 255))
        scanner = Robot(sim_surface, robotX, robotY, scanner_height,
                        scanner_width, (0, 0, 255))

        y_change = 0
        x_change = 0

        barrierList = []
        barrier_width = sim_height / 100

    elif simulation == 'lanecontrol':
        robotX = sim_width / 2
        robotY = sim_height / 2

        pixels_per_inch = sim_height / 36