Metadata-Version: 2.2
Name: reforge-core
Version: 0.0.5
Summary: Reforge Core SDK by Reforge Robotics.
Author-Email: Reforge Robotics <info@reforgerobotics.com>
License: MIT
Project-URL: Homepage, https://docs.reforgerobotics.com/sdk-reference/sdk-introduction
Requires-Python: >=3.9
Requires-Dist: anytree==2.13.0
Requires-Dist: numpy<2
Requires-Dist: scipy==1.14.1
Requires-Dist: torch==2.3.1
Requires-Dist: requests
Description-Content-Type: text/markdown

# Reforge SDK (`reforge-core`)

Reforge SDK is the independently built Python package that powers Reforge calibration and model-based vibration control.

This README is intended for PyPI distribution of `reforge-core`.

## What This Package Provides

### Calibration module (`reforge_core.calibration`)

The calibration module provides the cloud interface used after a robot calibration run:

- Uploads calibration data artifacts
- Triggers identification or fine-tuning jobs in Reforge Cloud API
- Polls job status and downloads generated model artifacts
- Extracts returned model files for control use

Primary entry point:

- `reforge_core.calibration.api.ReforgeAPIManager`

### Control module (`reforge_core.control`)

The control module provides vibration-aware command shaping for robot trajectories:

- Loads per-axis model files generated by calibration/identification
- Computes shaping parameters from current robot state
- Shapes single commands or full trajectories
- Returns shaped positions, velocities, and accelerations for execution

Primary entry points:

- `reforge_core.control.python.covalent_wrapper.ShaperInterface`
- `reforge_core.control.python.covalent_wrapper.RobotState`

## Interface with `reforge-interface` (`src/robot`)

Reforge SDK is designed to be consumed by the `reforge-interface` repository, where robot-specific integration lives.

Expected responsibilities in `reforge-interface/src/robot`:

- Robot transport and SDK communication loop
- Sensor acquisition (joint encoders, TCP accelerometer)
- Calibration routine execution and local data storage
- Invocation of Reforge SDK calibration + control APIs

Typical artifact flow:

1. `src/robot` runs calibration and stores local data (for example under `src/robot/data/<date>`).
2. `ReforgeAPIManager` uploads the data and requests model generation.
3. Returned model artifacts are saved for runtime control (commonly under `src/robot/models/current`).
4. `ShaperInterface` loads those models and the robot URDF to shape outgoing joint commands before they are sent through the robot driver in `src/robot`.

In this architecture, `reforge-interface/src/robot` owns robot I/O and execution, while `reforge-core` owns calibration-cloud orchestration and shaping logic.
`python_src_root` should point at the `reforge-interface/src` directory so runtime dependencies (for example dynamics utilities and robot assets) can be resolved.

## Minimal Usage Sketch

```python
from reforge_core.calibration.api import ReforgeAPIManager
from reforge_core.control.python.covalent_wrapper import ShaperInterface, RobotState

# Calibration/model generation
api = ReforgeAPIManager(reforge_api_token="<token>", robot_id="<robot_id>")
api.run_cloud_model_generation(data_folder="src/robot/data/<YYYY-MM-DD>")

# Runtime shaping
shaper = ShaperInterface(
    sample_time=0.005,
    model_directory="src/robot/models/current",
    python_src_root="src",
    urdf_filepath="src/robot/urdf/<robot>.urdf",
    num_axes=3,
    num_joints=6,
)

state = RobotState(joint_angles=...)  # numpy array
shaped = shaper.shape_sample(..., state)
```

## Installation

```bash
pip install reforge-core
```
