Skip to main content

Python SDK to control NOVA A1 Robot — AP & WiFi mode, auto-discovery, live status

Project description

NOVA RBM — Robot Base Module

Python SDK to control the NOVA A1 robot via WebSocket.
Supports AP mode, WiFi mode (mDNS), and Scan mode (auto-discovers robot by scanning your local network).

Installation

pip install nova-rbm

Or install from source:

git clone https://github.com/nadhilrobomiracle/nova_rbm.git
cd nova_rbm
pip install -e .

Quick Start

Scan Mode — Auto Network Discovery (Recommended)

The SDK automatically detects your PC's current IP, strips the last number, then scans every address on your subnet (.1 to .254) using WebSocket (primary) and HTTP /status (secondary fallback) in parallel:

from nova_rbm import NovaRobot

bot = NovaRobot(mode="scan")
bot.connect()   # Finds robot automatically — no IP needed!
print(bot.ip)   # e.g. '192.168.29.47'
bot.forward()
bot.stop()
bot.disconnect()

Standalone Scan (returns IP string)

from nova_rbm import scan_network

ip = scan_network()               # auto-detect subnet from your device IP
print(ip)                         # e.g. '192.168.29.47'

# With progress tracking
def progress(scanned, total, current_ip):
    print(f"[{scanned}/{total}] Checking {current_ip}...")

ip = scan_network(on_progress=progress)

WiFi Mode (mDNS + automatic scan fallback)

Tries nova-robot.local first. If mDNS fails, automatically falls back to subnet scan:

from nova_rbm import NovaRobot

bot = NovaRobot(mode="wifi")
bot.connect()   # mDNS first → subnet scan fallback if mDNS fails
print(bot.status())
bot.disconnect()

AP Mode (robot's own hotspot)

Connect your computer to the NOVA_A1 WiFi, then:

from nova_rbm import NovaRobot

bot = NovaRobot(mode="ap")   # Fixed IP: 192.168.4.1
bot.connect()
print(bot.status())
bot.disconnect()

Manual IP Override

bot = NovaRobot(ip="192.168.29.47")
bot.connect()

Context Manager

Auto-connects, stops motors, and disconnects cleanly:

with NovaRobot(mode="scan") as bot:
    bot.forward()
    bot.set_speed(200)
    import time; time.sleep(2)
    # stop() and disconnect() called automatically

API Reference

Connection

Method Description
connect() Open WebSocket — auto-discovers IP based on mode
disconnect() Close the connection
reconnect() Drop and re-establish (re-runs discovery)

Discovery Modes

Mode Strategy
"ap" Fixed IP 192.168.4.1 (robot hotspot)
"wifi" mDNS nova-robot.local/status → subnet scan fallback
"scan" Detects your device IP, scans entire subnet (WebSocket + HTTP)

scan_network() Parameters

scan_network(
    subnet=None,        # e.g. '192.168.29' — auto-detected if None
    start=1,            # first host octet
    end=254,            # last host octet
    ws_timeout=1.5,     # WebSocket probe timeout per host
    http_timeout=1.5,   # HTTP probe timeout per host
    max_workers=64,     # parallel threads
    on_progress=None,   # callback fn(scanned, total, ip)
)

Status & Telemetry

Method Returns
status() Full status dict from /status endpoint
servo_angles() {1: angle, 2: angle, ..., 5: angle}
motor_state() {'state': 'stop', 'speed': 180}
led_color() {'r': 0, 'g': 0, 'b': 255}
wifi_info() {'wifi_mode': ..., 'connected_ssid': ..., 'ip_address': ..., 'rssi_dbm': ...}

Movement

Method Description
forward() Drive forward
backward() Drive backward
left() Spin left
right() Spin right
stop() Stop all motors
set_speed(0–255) Set motor speed

Servo Control

Method Description
set_servo(servo, angle) Move servo 1–5 to angle (enforces firmware limits)
set_all_servos({1: 60, 3: 100}) Set multiple servos at once
reset_servos() Reset all servos to defaults
get_servo_limits() Returns min/max/default for each servo

Servo limits (from firmware):

Servo Min Max Default
S1 50 75 75
S2 90 145 90
S3 35 150 85
S4 20 80 80
S5 110 135 110

LED Control

Method Description
set_rgb(r, g, b) Set LED strip color (0–255 each)
set_color("red") Set by name: red, green, blue, white, off, cyan, magenta, yellow, orange, purple, pink

Standalone Utilities

from nova_rbm import discover_robot_ip, scan_network, fetch_status

ip = discover_robot_ip()          # mDNS discovery
ip = scan_network()               # subnet scan discovery
data = fetch_status("192.168.29.47")

Full Status Response

{
  "status": "ok",
  "device": "NOVA_A1",
  "wifi_mode": "station",
  "connected_ssid": "MyWiFi",
  "ip_address": "192.168.29.47",
  "rssi_dbm": -45,
  "uptime_s": 1234,
  "ws_clients": 1,
  "motor": { "state": "stop", "speed": 180 },
  "led": { "r": 0, "g": 0, "b": 255 },
  "servos": { "s1": 75, "s2": 90, "s3": 85, "s4": 80, "s5": 110 }
}

Changelog

v0.4.0

  • New scan_network() — scans local subnet automatically by reading device IP
  • New mode="scan" in NovaRobot — fully automatic robot discovery
  • mode="wifi" fallback — if mDNS fails, auto-falls back to subnet scan
  • Parallel WebSocket + HTTP probes per host for maximum reliability

v0.3.0

  • WiFi mode discovery via mDNS (nova-robot.local)
  • AP mode support
  • Full servo, motor, LED control

License

MIT

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

nova_rbm-0.4.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

nova_rbm-0.4.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file nova_rbm-0.4.0.tar.gz.

File metadata

  • Download URL: nova_rbm-0.4.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for nova_rbm-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8eade008b949160057d551809641708ae52ab483dbb41ad66ff0f91d15961de8
MD5 275a2e51d683742dfcac2db893ab73d1
BLAKE2b-256 09661a05df37ca13a1be1e93eab3366e6bd294cacc23c2c877c2ce9e0fbbc228

See more details on using hashes here.

File details

Details for the file nova_rbm-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: nova_rbm-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for nova_rbm-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9fe9cf84fc9cae564265eba44151dfa99058bb136e40cc541eef5e94436fb18c
MD5 3bc87167ac54560606befd96d74cd89a
BLAKE2b-256 632b5a6b41d9008966f811a8d3eaa38c04c5800037e60f6c853e199f0f291e8f

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