API Reference

Core Classes

LuckyRobots

class luckyrobots.LuckyRobots(host: str = None, port: int = None)[source]

Main LuckyRobots node for managing robot communication and control

__init__(host: str = None, port: int = None)[source]
host = 'localhost'
port = 3000
robot_client = None
world_client = None
static set_host(ip_address: str) None[source]

Set the host address for the LuckyRobots node

static get_robot_config(robot: str = None) dict[source]

Get the configuration for the LuckyRobots node

register_node(node: Node) None[source]

Register a node with the LuckyRobots node

start(scene: str = 'ArmLevel', robot: str = 'so100', task: str = 'pickandplace', observation_type: str = 'pixels_agent_pos', game_path: str = None) None[source]

Start the LuckyRobots node

wait_for_world_client(timeout: float = 60.0) bool[source]

Wait for the world client to connect to the websocket server

async handle_reset(request: ResetRequest) ResetResponse[source]

Handle the reset request by forwarding to the world client

async handle_step(request: StepRequest) StepResponse[source]

Handle the step request by forwarding to the world client

spin() None[source]

Spin the LuckyRobots node to keep it running

shutdown() None[source]

Shutdown the LuckyRobots node and clean up resources

Node

class luckyrobots.Node(name: str, namespace: str = '', host: str = None, port: int = None)[source]
__init__(name: str, namespace: str = '', host: str = None, port: int = None)[source]
get_qualified_name(name: str) str[source]

Get the qualified name for a given name

create_publisher(message_type: Type, topic: str, queue_size: int = 10) Publisher[source]

Create a publisher for a given topic

create_subscription(message_type: Type, topic: str, callback: Callable[[Any], None], queue_size: int = 10) Subscriber[source]

Create a subscriber for a given topic

create_client(service_type: Type, service_name: str) ServiceClient[source]

Create a client for a given service

async create_service(service_type: Type, service_name: str, handler: Callable[[Any], Any]) ServiceServer[source]

Create a service for a given service name

create_service_client(service_type: Type, service_name: str, host: str = 'localhost', port: int = 3000) ServiceClient[source]

Create a service client for a given service name

start() None[source]

Start the node

spin() None[source]

Spin the node

shutdown() None[source]

Shutdown the node

Models

class luckyrobots.ObservationModel(*, ObservationState: Dict[str, float], ObservationCameras: List[CameraData] | None = None)[source]

Observation model that matches the JSON structure

observation_state: Dict[str, float]
observation_cameras: List[CameraData] | None
process_all_cameras() None[source]

Process all camera images in the observation

class Config[source]
populate_by_name = True
model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Message Types

class luckyrobots.Reset[source]

Reset the robot

Request

alias of ResetRequest

Response

alias of ResetResponse

class luckyrobots.Step[source]

Step the robot with an action

Request

alias of StepRequest

Response

alias of StepResponse