Example #1
0
hud_data = hud_pb2.HudPoint()
cannon_status = cannon_pb2.CannonStatus()
prompt_manager = PromptManager()
current_target_color = "red"

mqtt_id = "laptop"
mqtt_targets = ["vision", "wallu", "cannon", "game_master"]
mqtt_targets = ["vision", "cannon", "game_master", "wheel"]
#mqtt_targets = ["vision", "cannon", "game_master"]
mqtt_topics = [
    "motor_requests", "storage_control", "vitals", "cannon_prompts",
    "cannon_status", "target_color", "target_locations"
]
mqtt_manager = mqtt_interface.MqttInterface(id=mqtt_id,
                                            targets=mqtt_targets,
                                            topics=mqtt_topics,
                                            callback=mqtt_callback,
                                            alpha=True)
mqtt_manager.start_reading()

load_screen = cv2.imread("graphics/loadscreen.png", -1)
load_screen = cv2.resize(load_screen, (1920, 1080),
                         interpolation=cv2.INTER_AREA)
exit_icon = cv2.imread("graphics/icons/logout.png", -1)
exit_icon = cv2.resize(exit_icon, (40, 40), interpolation=cv2.INTER_AREA)
exit_icon_coords = []

# Set up socket for video streaming
LOCAL_IP = "0.0.0.0"
LOCAL_PORT = 50000
Example #2
0
        current_target_color = payload.decode("utf-8")
        prompt_manager.add_prompt("Target color selection changed to " + current_target_color)

arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("--local", help="connect to the video stream locally", action="store_true")
arg_parser.add_argument("--mic_index", help="choose a custom mic index (default 0)")
args = arg_parser.parse_args()

cannon_status = cannon_pb2.CannonStatus()
current_target_color = "red"

mqtt_id = "game_master"
voice_mqtt_id = "voice_control"
mqtt_targets = ["laptop"]
mqtt_topics = ["storage_control", "hud_data", "cannon_status", "cannon_prompts", "target_color"]
mqtt_manager = mqtt_interface.MqttInterface(id=mqtt_id, targets=mqtt_targets, topics=mqtt_topics, callback=mqtt_callback, local=True if args.local else False)
runtime_config = 0
mqtt_manager.start_reading()

# set up prompt manager
prompt_manager = PromptManager()


# Launch voice script
if args.mic_index:
    mic_index = str(args.mic_index)
else:
    mic_index = "0"
voice_subprocess = ["python3", "voice_unlock.py", voice_mqtt_id, "--mic_index="+mic_index]
if args.local:
    voice_subprocess.append("--local")
Example #3
0
    parsed = last_message.split("-")
    
    proto_msg.battery_voltage = int(parsed[0])
    proto_msg.payload = parsed[1]
    return proto_msg

# PySerial setup
serial_interface = SerialInterface("/dev/ttyUSB0")
serial_thread = threading.Thread(target=serial_interface.read_from_port)
serial_thread.start()

# MQTT setup
mqtt_id = "wallu"
mqtt_targets = ["laptop"]
mqtt_topics = ["motor_requests", "storage_control"]
mqtt_manager = mqtt_interface.MqttInterface(id=mqtt_id, targets=mqtt_targets, topics=mqtt_topics, callback=mqtt_callback, pulse=False)
runtime_config = 0
mqtt_manager.start_reading()

# First connect to Controller Main
while runtime_config == 0:
    print("Waiting for instructions from main controller...")
    time.sleep(0.5)

while True:
    continue # vitals still unstable
    if "VIT" in serial_interface.stack:
        vitals_proto = generate_vitals_message(serial_interface.stack.pop("VIT"))
        print("Sending vitals!")
        mqtt_manager.send_message("vitals", vitals_proto.SerializeToString())