# Quick Start ## 1. Get the proto file ```bash # Clone the repo (or just grab the proto file) git clone https://github.com/menloresearch/asimov-firmware.git cd asimov-firmware ``` ## 2. Generate Python bindings ```bash pip install protobuf protoc --python_out=. proto/asimov_command.proto ``` This creates `asimov_command_pb2.py`. ## 3. Send your first command ```python import socket import time from asimov_command_pb2 import RobotCommand, ControlMode # Connect to robot sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) robot = ('192.168.1.100', 8888) # Change to your robot's IP # Send a command cmd = RobotCommand() cmd.mode = ControlMode.CONTROL_MODE_DAMP cmd.enable = True cmd.timestamp_us = int(time.time() * 1e6) sock.sendto(cmd.SerializeToString(), robot) print("Sent DAMP command") ``` ## 4. Read telemetry ```python import socket from asimov_command_pb2 import RobotState # Listen for telemetry sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(('0.0.0.0', 9999)) sock.settimeout(1.0) try: data, addr = sock.recvfrom(512) state = RobotState() state.ParseFromString(data) print(f"Battery: {state.battery_percent}%") print(f"Mode: {state.current_mode}") except socket.timeout: print("No telemetry received (is the robot running?)") ``` ## 5. Make it walk ```python import socket import time from asimov_command_pb2 import RobotCommand, ControlMode sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) robot = ('192.168.1.100', 8888) def send(mode, vx=0, vy=0, vyaw=0): cmd = RobotCommand() cmd.mode = mode cmd.vx = vx cmd.vy = vy cmd.vyaw = vyaw cmd.enable = True cmd.timestamp_us = int(time.time() * 1e6) sock.sendto(cmd.SerializeToString(), robot) # Stand up print("Standing up...") send(ControlMode.CONTROL_MODE_STAND) time.sleep(2.5) # Start balancing print("Balancing...") send(ControlMode.CONTROL_MODE_START) time.sleep(0.5) # Walk forward print("Walking forward...") for _ in range(100): send(ControlMode.CONTROL_MODE_MOVE, vx=0.3) time.sleep(0.02) # 50 Hz # Stop print("Stopping...") send(ControlMode.CONTROL_MODE_DAMP) ``` ## Important - **Send commands at ≥10 Hz** or the robot E-stops (deadman switch) - **Start in DAMP mode** before transitioning to STAND - **Wait for STAND to complete** (~2 seconds) before sending START ## Next Steps - [Examples](examples) - More Python scripts - [Protocol Reference](protocol) - All the message fields