Metadata-Version: 2.4
Name: telekinesis-isaacsim-server
Version: 0.1.1
Summary: Local server that gives the Telekinesis Isaac Sim Bridge robot kinematics from Telekinesis Synapse.
Author-email: Telekinesis <support@telekinesis.ai>
Requires-Python: <3.13,>=3.11
Description-Content-Type: text/markdown
Requires-Dist: fastapi[standard]==0.141.1
Requires-Dist: loguru
Requires-Dist: numpy
Requires-Dist: pydantic-settings
Requires-Dist: telekinesis-synapse>=0.10.16
Requires-Dist: telekinesis-tf
Provides-Extra: dev
Requires-Dist: ruff==0.15.8; extra == "dev"
Requires-Dist: pylint==4.0.5; extra == "dev"

# Telekinesis Isaac Sim Server

A local FastAPI server that gives the Telekinesis Isaac Sim Bridge robot kinematics from
Telekinesis Synapse. It loads **robots**: Synapse robots built for kinematics only. A loaded
robot is never connected to hardware or to Isaac Sim, and the server commands no motion.

The server keeps robots in memory only. Stopping it forgets them.

## Setup

Requires Python 3.11 or 3.12 on Windows or Linux (x86_64).

```bash
conda create -n telekinesis-isaacsim-server python=3.11
conda activate telekinesis-isaacsim-server
pip install telekinesis-isaacsim-server
```

## Start the server

```bash
telekinesis-isaacsim-server
```

`python -m telekinesis.isaacsim_server` does the same.

It listens on `http://127.0.0.1:6000`, the address the bridge expects. The server has no
authentication and accepts local clients only. Stop it with Ctrl-C; every robot is shut down.

The interactive API docs are at `http://127.0.0.1:6000/docs`.

## Routes

Every route is under `/telekinesis-isaacsim-server/v1`.

| Method | Path | Body | Returns |
|---|---|---|---|
| GET | `/robot_class_names` | | Synapse robot class names, e.g. `UniversalRobotsUR10E` |
| POST | `/robots` | `{"class_name": ...}`, in any case | The new robot's description (201) |
| GET | `/robots` | | The description of every robot |
| GET | `/robots/{robot_id}` | | The robot's description |
| DELETE | `/robots/{robot_id}` | | Nothing (204) |
| POST | `/robots/{robot_id}/inverse_kinematics` | `{"poses", "seed"?, "tcp"?}` | `{"joint_names", "joint_positions"}`, one solution per pose |
| POST | `/robots/{robot_id}/link_poses` | `{"joint_names", "joint_positions"}` | `{"link_poses": {link_name: pose}}`, every URDF link in the base frame |
| PUT | `/robots/{robot_id}/tcps` | `{"tcps": {name: pose}}` | The robot's description |
| POST | `/robots/{robot_id}/plan_joint_trajectory` | `{"start", "target", "speed"?, "acceleration"?}` | `{"joint_names", "times", "joint_positions"}`, the planned motion |
| POST | `/robots/{robot_id}/plan_cartesian_trajectory_in_joint_space` | `{"start", "pose", "tcp"?, "seed"?, "speed"?, "acceleration"?}` | `{"joint_names", "times", "joint_positions"}`, the planned motion |
| POST | `/robots/{robot_id}/plan_cartesian_trajectory` | `{"start", "pose", "tcp"?, "speed"?, "acceleration"?}` | `{"joint_names", "times", "joint_positions"}`, the planned motion |

`POST /robots` loads the robot before answering; the first time a robot class is used, Synapse
downloads its URDF from the Telekinesis asset server. Every call loads a new robot under a new id.

The server assigns each robot a random UUID as its id. An id saved by a client stays valid until
the server stops; after a restart it answers 404 and is never reused for another robot.

| Status | When |
|---|---|
| 404 | No robot has the id, e.g. because the server restarted |
| 422 | Unknown `class_name`, malformed id, malformed body, a robot joint missing from the seed or the start, an unknown `tcp`, a TCP named like a URDF frame, a motion that cannot be planned, or a request Synapse rejects |
| 503 | The robot description could not be fetched |

### Inverse kinematics

`POST /robots/{robot_id}/inverse_kinematics` solves each pose in `poses`, in order, for the
robot's TCP `tcp` in its `base_frame`: the `default_tcp` when `tcp` is omitted or `null`, or a
TCP set with `PUT /robots/{robot_id}/tcps`. It returns the robot's `joint_names` and one solution
in radians per pose, or `null` for a pose it cannot reach.

The optional `seed` is where every search starts, usually the robot's current joints, given as
`joint_names` with matching `joint_positions` in radians. The names must include every joint of
the robot, in any order; other names, such as gripper fingers, are ignored. A seed on or past a
joint limit is moved just inside it.

### Link poses

`POST /robots/{robot_id}/link_poses` takes the robot's joints the same way, `joint_names` with
matching `joint_positions` in radians, and returns the pose of every link of the robot's URDF in
its `base_frame`, by link name. Joint positions outside the joint limits answer 422. A client uses
it to draw the robot in a given configuration, such as an inverse-kinematics solution.

### TCPs

`PUT /robots/{robot_id}/tcps` sets the robot's TCPs besides its `default_tcp`: `tcps` maps each
TCP's name to its pose in the `default_tcp` frame, as Synapse's `add_tcp` takes it. It replaces
every TCP set before, so TCPs left out are deleted and sending the same TCPs again changes
nothing. A name that is already a frame of the robot's URDF answers 422. The TCPs only name
frames for inverse kinematics; the robot's active TCP stays its `default_tcp`.

### Plan a trajectory

Three routes plan a motion with Synapse without moving any robot, one per Synapse planner. Each
takes `start`, the joints the motion starts from (usually the robot's current joints), given as
`joint_names` with matching `joint_positions` in radians like the seed, and returns the robot's
`joint_names`, the sample `times` in seconds from the start of the motion (0 first, the motion's
duration last) and the `joint_positions` in radians at every time.

| Route | Motion | Target | `speed`, `acceleration` |
|---|---|---|---|
| `plan_joint_trajectory` | All joints start and arrive together | `target`: joint positions within the joint limits | rad/s, rad/s² of the joint that moves furthest |
| `plan_cartesian_trajectory_in_joint_space` | The same joint motion, to the joints that bring `tcp` to `pose`; the TCP path is not guaranteed to be straight | `pose` of `tcp` | rad/s, rad/s² of the joint that moves furthest |
| `plan_cartesian_trajectory` | `tcp` moves along a straight line from its pose at `start` | `pose` of `tcp` | m/s, m/s² of `tcp` |

`tcp` is the `default_tcp` when omitted or `null`, or a TCP set with
`PUT /robots/{robot_id}/tcps`; any other name answers 422. `speed` and `acceleration` must be
positive and use the robot's defaults when omitted. In `plan_cartesian_trajectory_in_joint_space`,
the optional `seed` is where the search for the target joints starts, usually the joints a pose was
taught with, so the arm keeps that configuration where possible; without it the search starts
from `start`. The search start is moved just inside a joint limit it is on or past, while `start`
itself is planned from as given. `plan_cartesian_trajectory` moves a `start` position exactly on a
joint limit just inside it and answers 422 for one past a limit. A pose no joint configuration
reaches, or a straight line without a continuous joint solution, answers 422 with Synapse's
reason.

### Robot description

| Field | Meaning |
|---|---|
| `id` | Id the server assigned to the robot |
| `class_name` | Synapse robot class |
| `base_frame` | Root link of the robot's URDF; poses are expressed in this frame |
| `default_tcp` | Frame that ghost objects place: the robot's flange frame, e.g. `tool0` |
| `mount_link` | Link that tools are mounted on in Isaac Sim, or `null` |
| `flange_in_mount_link` | Pose of `default_tcp` in `mount_link`, or `null` |
| `tcps` | Every TCP by name, `default_tcp` included: its pose in `default_tcp` |

## Units

Poses are `[x, y, z, rx, ry, rz]`: metres, then extrinsic XYZ Euler angles in degrees. Joint
positions are in radians, joint speeds in rad/s and joint accelerations in rad/s². Times are in
seconds.

## Notes

- Synapse logs that it could not install a signal handler when a robot loads. This is expected.
