Skip to main content

SDK for the TARS robot replica from Interstellar. Control movements, camera, display, and audio streaming via gRPC.

Project description

TARS

โš ๏ธ Note to Visitors

This repository is a personal fork for experimenting with a new distributed architecture. If you're looking for the main TARS-AI project, please visit:

๐Ÿ‘‰ https://github.com/TARS-AI-Community/TARS-AI

This fork splits TARS into a dual-machine setup:

  • Host Computer (macOS/Windows/Linux): Handles all AI processing (STT, TTS, LLM, Vision)
  • Raspberry Pi 5: Handles all hardware I/O (servos, camera, audio)

Architecture Overview

New Architecture: RPi is self-contained and runs a WebRTC server + gRPC server. The host computer connects to it as a client.

RPi 5 (tars) - Standalone Robot            Host Computer (tars-omni) - AI Brain
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ WEBRTC + gRPC SERVERS        โ”‚        โ”‚ WEBRTC CLIENT + AI          โ”‚
โ”‚                              โ”‚        โ”‚                             โ”‚
โ”‚ tars_daemon.py               โ”‚        โ”‚ tars_bot.py                 โ”‚
โ”‚                              โ”‚        โ”‚                             โ”‚
โ”‚ On boot:                     โ”‚        โ”‚ Connects to RPi:            โ”‚
โ”‚ - Starts WebRTC server       โ”‚ WebRTC โ”‚ - aiortc client             โ”‚
โ”‚ - Starts gRPC server         โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค - POST /api/offer           โ”‚
โ”‚ - POST /api/offer endpoint   โ”‚  P2P   โ”‚                             โ”‚
โ”‚                              โ”‚        โ”‚ Audio Pipeline:             โ”‚
โ”‚ Audio Routing:               โ”‚        โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚
โ”‚ - Mic โ†’ WebRTC track โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ–บโ”‚ VAD โ†’ STT โ†’ LLM     โ”‚     โ”‚
โ”‚ - WebRTC track โ†’ Speaker โ—„โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”ค โ†’ TTS โ†’ Audio Out   โ”‚     โ”‚
โ”‚                              โ”‚        โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚
โ”‚ DataChannel State Sync:      โ”‚        โ”‚                             โ”‚
โ”‚ - Receives eye states        โ”‚        โ”‚ Services:                   โ”‚
โ”‚ - Sends battery status       โ”‚        โ”‚ - Deepgram STT              โ”‚
โ”‚                              โ”‚        โ”‚ - GPT LLM + Tools           โ”‚
โ”‚ gRPC API (port 50051):       โ”‚        โ”‚ - ElevenLabs TTS            โ”‚
โ”‚ - Move(movement, speed)      โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค - Vision (tool calls)       โ”‚
โ”‚ - CaptureCamera(w, h, q)     โ”‚  gRPC  โ”‚                             โ”‚
โ”‚ - SetEmotion(emotion)        โ”‚        โ”‚ Tools call RPi via gRPC     โ”‚
โ”‚ - SetEyeState(state)         โ”‚        โ”‚                             โ”‚
โ”‚ - GetStatus()                โ”‚        โ”‚                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚
          โ”‚ I2C + USB + CSI
          โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Hardware         โ”‚
โ”‚ - Servos         โ”‚
โ”‚ - USB Soundcard  โ”‚
โ”‚ - Pi Camera      โ”‚
โ”‚ - Display        โ”‚
โ”‚ - Battery        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Key Principle: The robot is self-contained. It boots up and waits for an AI brain to connect, not the other way around.


What This Repo Contains

  • gRPC-based control system for Raspberry Pi 5 (low-latency hardware control)
  • WebRTC server for bidirectional audio streaming
  • 19 pre-programmed movements for servo control
  • Camera capture via gRPC (Pi Camera or USB webcam)
  • Real-time state synchronization via WebRTC DataChannel

Quick Start

Start the RPi daemon (waits for AI brain to connect):

# Start WebRTC + gRPC servers (default)
python tars_daemon.py

# Or using start script
./start.sh

# WebRTC only (no gRPC)
python tars_daemon.py --no-grpc

# Specify custom gRPC port
python tars_daemon.py --grpc-port 50052

The RPi will:

  1. Start the WebRTC server on port 8001
  2. Start the gRPC server on port 50051 (default)
  3. Wait for the host computer to connect via POST /api/offer
  4. Once connected, audio flows bidirectionally and gRPC handles hardware control

Documentation

User Guides:

  • DAEMON.md - Getting started with unified daemon

API Reference:

Architecture & Design:


๐Ÿค Contributing


๐Ÿ“œ License

This project is licensed under Creative Commons Attribution-NonCommercial 4.0 International (CC-BY-NC 4.0).

You may:

  • Build and modify your own TARS robot
  • Share improvements and derivatives
  • Use the project for personal, educational, and research purposes

You may not use this project for commercial purposes without explicit permission from the authors. Commercial use includes, but is not limited to:

  • Selling 3D printed parts, kits, or complete robots
  • Selling or distributing STL / CAD files for money
  • Offering paid assembly, customization, or installation services
  • Monetized YouTube, Social Media, Patreon, or subscription content that distributes project files or derivatives
  • Using this project in paid products, commercial research, or corporate projects
  • Integrating this project into commercial software or hardware products
  • Selling derivatives or modified versions of the hardware or software

If you are unsure whether your use case is commercial, assume it is and request permission from the authors.

See the LICENSE file for details.


๐Ÿงพ Attribution

Please follow the attribution guidelines when sharing or publishing derivative work:

๐Ÿ‘‰ ATTRIBUTION.md


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tars_robot-0.2.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tars_robot-0.2.0-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file tars_robot-0.2.0.tar.gz.

File metadata

  • Download URL: tars_robot-0.2.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for tars_robot-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7e7582257a70c033463df4f87d6e3d1967a5e25cf69b3edae0c9a17e5aad0731
MD5 4b68ef0f3686b2eb94785eb23b05ad27
BLAKE2b-256 684c4d59f43ba1ac31098146e705e1537edd9fa9c96f4659346a318416bc4834

See more details on using hashes here.

File details

Details for the file tars_robot-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tars_robot-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for tars_robot-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ddea38a4828eacd765cc19713a86bbe0cedbf8492d6d55d7e0693645ca1c6ad
MD5 fc68ad596533996aeec11b5118062566
BLAKE2b-256 fb5ad174ba087b8620f3dc66dac65db000adfa53c088ece6c84cc13061882dac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page