Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions docs/contents/specification/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,3 @@ Logging configuration used by the connector at startup:
- `defaults`: dictionary passed to the logging config (e.g. `log_file`).

See [setup_logger()](logging.md#spec-logging-setup-logger) for how it is applied.

## Deprecated: `InorbitConnectorConfig`

`InorbitConnectorConfig` is a deprecated single-robot configuration format. It can be converted to a fleet config via:

- `to_fleet_config(robot_id) -> ConnectorConfig`

New implementations should use `ConnectorConfig` directly.


26 changes: 5 additions & 21 deletions inorbit_connector/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import socket
from pathlib import Path
import tempfile
import warnings
import asyncio
import threading
import traceback
Expand Down Expand Up @@ -67,7 +66,6 @@
)
from inorbit_connector.models import (
ConnectorConfig,
InorbitConnectorConfig,
MapConfig,
MapConfigTemp,
RobotConfig,
Expand Down Expand Up @@ -926,12 +924,10 @@ def __init__(self, robot_id: str, config: ConnectorConfig, **kwargs) -> None:

Args:
robot_id (str): The ID of the InOrbit robot
config (ConnectorConfig): The connector configuration.
- New API: pass `ConnectorConfig` with a `fleet` field containing
multiple robot configurations. The one for the current robot will be
selected by the `robot_id` parameter.
- Deprecated: pass `InorbitConnectorConfig` (single-robot); it will be
converted to a `ConnectorConfig`.
config (ConnectorConfig): The connector configuration. Pass a
`ConnectorConfig` with a `fleet` field containing robot
configurations. The one for the current robot will be selected
by the `robot_id` parameter.

Keyword Args:
register_user_scripts (bool): Register user scripts automatically.
Expand All @@ -944,19 +940,7 @@ def __init__(self, robot_id: str, config: ConnectorConfig, **kwargs) -> None:
Relevant only if register_user_scripts is True.
"""
self.robot_id = robot_id

if isinstance(config, InorbitConnectorConfig):
# Deprecated behavior
warnings.warn(
"Passing InorbitConnectorConfig to Connector.__init__ is deprecated; "
"pass ConnectorConfig instead.",
DeprecationWarning,
stacklevel=2,
)
fleet_config = config.to_fleet_config(robot_id)
else:
fleet_config = config.to_singular_config(robot_id)

fleet_config = config.to_singular_config(robot_id)
super().__init__(fleet_config, **kwargs)

def _get_session(self) -> RobotSession:
Expand Down
37 changes: 1 addition & 36 deletions inorbit_connector/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def warn_log_level_deprecated(self) -> "ConnectorConfig":
"""Warn if log_level is set as it is deprecated.

Returns:
InorbitConnectorConfig: The model instance
ConnectorConfig: The model instance
"""
if self.log_level is not None:
warnings.warn(
Expand Down Expand Up @@ -403,38 +403,3 @@ def check_positive(cls, update_freq: float | None) -> float | None:
if update_freq <= 0:
raise ValueError("Must be positive and non-zero")
return update_freq


class InorbitConnectorConfig(ConnectorConfig, RobotConfig):
"""Class representing an Inorbit connector model for a single robot.

This class is deprecated. Use ConnectorConfig instead.
"""

# Exclude robot_id from single-robot configs - it will be provided when converting
# to fleet
robot_id: str | None = Field(default=None, exclude=True)
fleet: list[RobotConfig] = Field(default_factory=list, exclude=True)

def to_fleet_config(self, robot_id: str) -> ConnectorConfig:
"""Convert a single-robot config to a fleet config.

Creates a ConnectorConfig with a fleet list containing this robot's
configuration.

Args:
robot_id: The robot ID to use for the fleet config (ensures consistency)
"""
# Get the full config dump, excluding fleet and robot-specific fields
connector_data = self.model_dump(exclude={"fleet", "robot_id", "cameras"})

# Create RobotConfig instance from this config's robot-specific fields
robot_config = RobotConfig(
robot_id=robot_id,
cameras=self.cameras,
)

return ConnectorConfig(
**connector_data,
fleet=[robot_config],
)
Loading
Loading