Skip to main content

Common robot utility classes and functions for Dexmate robots

Project description

Dexmate Robot Configuration Utilities

Python

Type-safe dataclass configurations and a unified interface for accessing Dexmate robot information.

Installation

pip install dexbot-utils

Usage

RobotInfo (Recommended)

from dexbot_utils import RobotInfo

# Load by variant name
robot = RobotInfo("vega_1")

# Basic properties
print(robot.robot_model)     # "vega_1"
print(robot.robot_type)      # "vega"
print(robot.robot_version)   # "1"

# Component access
print(robot.has_left_arm)    # True
print(robot.get_component_list())
# ['left_arm', 'right_arm', 'torso', 'chassis', 'head', ...]

# Get component details
joints = robot.get_component_joints("left_arm")
# ['L_arm_j1', 'L_arm_j2', ..., 'L_arm_j7']

dof = robot.get_component_dof("left_arm")  # 7

# Access component config directly
arm_config = robot.get_component_config("left_arm")
print(arm_config.side)       # "left"
print(arm_config.pv_mode)    # False

# URDF queries (if URDF is loaded)
# URDF queries (if URDF is loaded)
if robot.has_urdf:
    joint_limits = robot.get_joint_limits()
    pos_limits = robot.get_joint_pos_limits()
    vel_limits = robot.get_joint_vel_limits()
    link_names = robot.get_link_names()

Environment Variables

Load configuration from environment:

export ROBOT_CONFIG=vega_1
# or derive from robot name
export ROBOT_NAME=dm/vgabcd123456-1  # -> vega_1
robot = RobotInfo()  # auto-loads from env

Direct Config Access

For direct access to configuration dataclasses:

from dexbot_utils.configs import get_robot_config, get_available_variants

# List available variants
variants = get_available_variants()
# ['vega_1', 'vega_1_gripper', ...]

# Get config directly
config = get_robot_config("vega_1")
left_arm = config.components["left_arm"]
print(left_arm.joints)

CLI

# List available configurations
# List available configurations
dexbot cfg list

# Show configuration details
dexbot cfg show vega_1

Advance Usage: Adding New Configs

1. Create Component Configs

Define components in configs/components/your_robot/:

# configs/components/my_robot/arm.py
from dataclasses import dataclass
from ..base import BaseJointComponentConfig

@dataclass
class MyArmConfig(BaseJointComponentConfig):
    side: str = "left"
    pv_mode: bool = False

    @property
    def joints(self) -> list[str]:
        prefix = "L" if self.side == "left" else "R"
        return [f"{prefix}_arm_j{i}" for i in range(1, 8)]

2. Create Robot Config

Define the robot in configs/robots/ with @register_variant:

# configs/robots/my_robot.py
from dataclasses import dataclass, field
from ..registry import register_variant
from ..components.my_robot import MyArmConfig
from .base import BaseRobotConfig, BaseComponentConfig

@register_variant("my_robot")
@dataclass
class MyRobotConfig(BaseRobotConfig):
    robot_model: str = "my_robot"
    abbr: str = "mr"
    urdf_path: str = "robots/my_robot/robot.urdf"

    components: dict[str, BaseComponentConfig] = field(
        default_factory=lambda: {
            "left_arm": MyArmConfig(side="left"),
            "right_arm": MyArmConfig(side="right"),
        }
    )

3. Register

Import in configs/robots/__init__.py:

from .my_robot import MyRobotConfig

Now use it:

robot = RobotInfo("my_robot")

Development

Setup

# Install dev dependencies
pip install -e ".[dev]"

# Setup pre-commit hooks
prek install

Licensing

This project is dual-licensed:

Open Source License

This software is available under the GNU Affero General Public License v3.0 (AGPL-3.0). See the LICENSE file for details.

Commercial License

For businesses that want to use this software in proprietary applications without the AGPL requirements, commercial licenses are available.


🤝 Ready to build amazing robots?

📧 Contact Us

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

dexbot_utils-0.4.5-py3-none-any.whl (57.1 kB view details)

Uploaded Python 3

File details

Details for the file dexbot_utils-0.4.5-py3-none-any.whl.

File metadata

  • Download URL: dexbot_utils-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 57.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dexbot_utils-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 039b7030f02510942a0cc1d35f5d4366ffe051db0c44ce1eb0c9847f8896b443
MD5 f947e97d8a20ccb9c853eeae5ee215c6
BLAKE2b-256 e622d6457ce929ced6ab35a8ecd7e6cc51a8199262450a9c45562ef5083cf966

See more details on using hashes here.

Provenance

The following attestation bundles were made for dexbot_utils-0.4.5-py3-none-any.whl:

Publisher: pypi.yml on dexmate-ai/dexbot-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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