# Motion Data Service

> Teach poses once in NVIDIA Isaac Sim and use them in every Wandelbots NOVA program as a versioned dataset. Learn how to publish a dataset, program with it in Visual Studio Code and bring the next version back into the scene.

The Motion Data Service keeps motion data in Wandelbots NOVA as datasets.
A dataset holds poses, the frames they are expressed in and the command routines that move to them.
Every publish creates a new version, so earlier versions stay available.

In NVIDIA Isaac Sim, the `Motion Data Service` window publishes the poses of the scene as a dataset. Then it imports a dataset back into the scene.
The same dataset is open to every other tool of Wandelbots NOVA, such as Python programs and the Robot Interface in Visual Studio Code.

> **Info:** The Motion Data Service needs Wandelbots NOVA 26.7 or newer and a version of the Isaac Sim extension that includes the `Motion Data Service` window.
> From NOVA 26.9 on, every pose of a dataset states its frame, its TCP and its robot configuration.
> NOVA 26.7 and 26.8 have no field for the TCP, so the window keeps the TCP of a pose in its metadata under `isaacsim/tcp` there.

## Follow one dataset from the scene to the robot program

This page follows one example from start to finish: the `Stacking demo`, a KUKA KR10 R900-2 that picks three workpieces.

1. [Publish](#publish-poses-as-a-dataset) the three pick poses you taught in Isaac Sim as version 1 of the dataset.
2. [Program with the dataset in Visual Studio Code](#program-with-the-dataset-in-visual-studio-code): move to the poses from Python and build a command routine in the Robot Interface. Publishing it creates version 2.
3. [Import version 2 into the scene](#import-a-dataset-into-the-scene). The routine and any pose you touched up come back to Isaac Sim, and the imported poses replace the ones you taught.
4. [Publish a new version](#publish-a-new-version) after you change the scene. The routine from Visual Studio Code goes with it.

Every step reads and writes the same poses, frames and command routines, so nothing is copied by hand.

## Prerequisites

1. [Set up a scene](/simulation/quickstart) with a robot and a tool.
2. Connect the robot to a [virtual controller](/simulation/installation#create-a-virtual-controller-for-a-robot-in-the-scene).
3. Teach poses as [ghost objects](/simulation/ghost-teaching) and choose a robot configuration for each of them in the `Ghost Teaching tool bar`.\
   A ghost object without a chosen configuration is published as a plain pose, and the import brings it back without a robot configuration.
4. For the part in Visual Studio Code: set up the Wandelbots NOVA extension as described in [Work with datasets in Visual Studio Code](/developer/datasets#prerequisites).\
   The Python SDK `wandelbots-nova` 6.1.0 from those prerequisites is verified against NOVA 26.7 and 26.8. On NOVA 26.9, fetching a dataset from Python can fail. Wait for a newer SDK release verified against 26.9 before following the Visual Studio Code steps on a 26.9 instance.

## Publish poses as a dataset

> **Warning:** Place poses beside the robot, never inside it.
> Keep ghost objects and pose prims in a prim next to the robot prim, on the same level, for example `/World/cell/poses` next to `/World/cell/KUKA_KR10_R900_2`.
> The robot prim and everything below it belong to the robot asset.
> The import never creates anything inside a robot. It builds the frames of a robot next to it instead.
> If you publish poses that sit inside a robot, `Logs` warns about each of them and asks you to move them beside the robot.

Open `Tools` → `Wandelbots NOVA` → `Motion Data Service` and select the `Export Data` tab.

![Screenshot of the Export Data tab with a new dataset named Stacking demo and three ghost objects under the robot frame](/assets/nova/omniservice/motion_data_service/motion-data-service-export.webp)

![Screenshot of the Export Data tab after the upload, with the message Upload succeeded](/assets/nova/omniservice/motion_data_service/motion-data-service-published.webp)

### Step 1: Choose the target

1. Select the `Instance` and the `Cell`.\
   With a single instance or cell, the window selects it for you.
2. In `Dataset Name`, keep `new dataset`.
3. Enter a `Name` and a `Description`.\
   The name also gives the identifier Wandelbots NOVA addresses the dataset by, for example `stacking-demo` for `Stacking demo`.\
   If a dataset with that identifier already exists in the cell, the window does not publish and asks you to select that dataset or choose another name.

### Step 2: Check what gets published

The `Poses` card lists every ghost object and pose of the scene, grouped by robot.
Clear the checkbox of a frame to leave its poses out.

- Each pose is stored under its prim name, with `_` written as `-`: `pick_01` becomes `pick-01`.
  Poses with the same name get a number, for example `weld` and `weld-2`.
- Each robot becomes a frame at its base (`link_0`). The frame stores the prim path of the robot.
- Poses that belong to no robot are stored in the frame `world`.
- Ghost objects and poses keep their robot configuration. The joint values are not stored, they only select the configuration. A pose without one is stored as `unspecified`, and the planner chooses the configuration.
- Each pose names the TCP it was taught with. A ghost object names the TCP it was cloned on, a pose the TCP the [Trajectory planner](/simulation/trajectory-planner) or an import stored on it.
  A pose without one keeps the TCP it had in the version you publish onto. A pose without any TCP is published with `Flange` on NOVA 26.9 and without a TCP on 26.7 and 26.8.

Hover a pose to see its position, TCP and robot configuration.

### Step 3: Publish the dataset

Click `Publish As New Dataset`.\
→ The window shows `Upload succeeded!` and folds the cards away. `Logs` lists the upload and any warning.

Closing the window stops an upload that is still running.
If Wandelbots NOVA already received it, the new version exists anyway, so check the versions of the dataset before you publish again.

In the example, the cell now holds the dataset `stacking-demo`, version 1, with the poses `pick-01`, `pick-02` and `pick-03` in the frame of the robot.

## Program with the dataset in Visual Studio Code

The published dataset is a regular Wandelbots NOVA dataset.
The Wandelbots NOVA extension for Visual Studio Code lists it, loads it into Python programs and edits it in the Robot Interface.
[Work with datasets in Visual Studio Code](/developer/datasets) describes every feature. This section only follows the example.

### Step 1: Find the dataset

1. Open the `Data Sharing Service` from the `Wandelbots NOVA` view, or run `Wandelbots NOVA: Open Data Sharing Service` from the command palette.
2. Click the card `Stacking demo`.\
   → The tab lists its revisions. Revision 1 is the version you published from Isaac Sim.

The card shows the name of the dataset. Your program needs its identifier, `stacking-demo`, which Isaac Sim derived from the name.

### Step 2: Move to the poses from Python

Bind the dataset to a program in its preconditions and move to the poses.
This excerpt shows the lines that use the dataset:

```python
@nova.program(
    id="stacking_demo",
    preconditions=nova.ProgramPreconditions(
        controllers=[...],
        dataset=ds.remote_dataset("stacking-demo", revision=1),
    ),
)
async def stacking_demo(ctx: nova.ProgramContext):
    pick = ctx.dataset.poses["pick-01"].as_world()
```

The poses keep the identifiers the window gave them, so `pick_01` from the scene is `pick-01` here.
Isaac Sim stores them relative to the base of the robot. Call `as_world()` before you move to them.
See [Bind a dataset to a program](/developer/datasets#bind-a-dataset-to-a-program) for the complete program.

### Step 3: Build a command routine

1. Click `Robot Interface` above the program, or select `Open in Robot Interface` in the menu of the version.
2. Select the `Command Routines` tab. In the routine dropdown, select `Add a new command routine`.
3. Add a motion command for each pick pose.
4. Optional: Touch up a pose. Right-click it in the `Poses` tab, select `Edit Pose`, jog the robot, click `Get` and then `Save Changes`.
5. Click `Publish` in the header of the dataset panel.\
   → The dataset has version 2 with the routine and the touched-up pose.

See [Using command routines](/developer/datasets#using-command-routines) for running and editing routines.

## Import a dataset into the scene

Select the `Import Data` tab.

![Screenshot of the General Setup card of the Import Data tab with Parent /World and an orange Data Targets summary with 2 warnings](/assets/nova/omniservice/motion_data_service/motion-data-service-import.webp)

### Step 1: Choose the dataset

1. Select the `Instance` and the `Cell`.
2. Select the dataset in `Dataset Name`.\
   → `Version` shows the newest version, and the cards preview its poses and command routines.
3. Optional: Select an older `Version`.
4. Optional: Change `Parent`, the prim the dataset is rebuilt under. The default is `/World`.\
   Click the pencil button next to it and select the prim. The selection does not offer prims inside a robot, since the import creates nothing there.
5. Check `Data Targets`. It names the prim each frame of the dataset sits on.\
   If a chosen prim changes where the poses end up, the summary turns orange and counts the warnings. Hover it to read them.\
   To change the prims, see [Choose where the frames sit](#choose-where-the-frames-sit).
6. Optional: Clear the checkboxes of the frames or routines you do not need.

### Step 2: Import the dataset

Click `Import Dataset into Scene`.\
→ The window shows `Import succeeded!`. A prim named after the dataset and its version, for example `Stacking_demo_v2`, appears under `Parent`.

Click `Cancel` instead to clear the selection without importing.

Publishing does not count as an import: the poses you taught stay where they are, and the first import of the dataset creates a second copy of them.
In the example, import version 2 and then delete the ghost objects you taught for version 1.
The imported poses keep the identifiers of the dataset, so the next publish updates them instead of adding new ones, and every later version [merges into this import](#merge-a-version-into-an-earlier-import).

### Choose where the frames sit

`Data Targets` starts with the prims the import finds on its own, see [Import datasets from other sources](#import-datasets-from-other-sources).
Change them when the scene is not the one the dataset was published from.

![Screenshot of the Select Data Targets dialog with the robot and a fixture as prims, one frame in orange and two warnings](/assets/nova/omniservice/motion_data_service/motion-data-service-data-targets.webp)

### Step 1: Open the dialog

Click the arrow button next to `Data Targets`, or click the summary itself.\
→ The dialog `Select Data Targets` opens. It shows the frames and poses of the dataset in the same tree as the `Poses` card.

### Step 2: Pick the prims

1. In the row of a frame, click the pencil button and select the prim the frame sits on.\
   The selection offers robots and prims outside any robot.
2. Optional: Click the `X` button next to a prim path to remove it.\
   A frame without a prim follows the frame it hangs from. Its row shows the prim path it gets, for example `Follows $WORLD: /World/cell/_import__Stacking_demo_v2_1c9e04d2/_frame__base_0/_frame__base_1`.\
   A frame that hangs from no other frame shows `Rebuilt under Parent:`. It is placed below `Parent`, at the pose the dataset stores.

### Step 3: Check the warnings

A frame placed on a prim takes its poses along: every pose keeps its offset to the frame.
The dialog marks a frame in orange when that changes what its poses mean, and lists the reason below the tree:

- The poses move away from where they were taught, for example `Its poses move 1.803 m from where they were taught.`
- The joints of the poses are solved again for their robot, and some may be out of reach.
- The poses are solved for another robot, or come back as plain poses without joints because no robot holds them there.

Hover a frame to read its warnings.

`Data Targets` never places a frame on a prim inside a robot.
A frame that names such a prim, for example from an earlier import, follows the frame it hangs from instead, next to the robot.

### Step 4: Apply the prims

Click `Apply`.\
→ `Data Targets` names the first frame and its prim and counts the frames that follow, for example `$WORLD on robot_base, 8 follow`. With warnings, it turns orange and ends with their number, for example ` - 5 warnings`.

The import writes the same warnings to `Logs`.

### Where the poses appear

Each frame is placed on the prim `Data Targets` names for it.
Frames that hang from another frame follow it.
Frames that no pose uses are placed too.
The import creates nothing inside a robot.
A frame that sits on a robot is built next to the robot, in a group named after the import under the parent of the robot prim, for example `/World/cell/MIR/mounting/_import__Stacking_demo_v1_51920a7e`.
Its poses and the frames that hang from it go there too.
The frame stands where the robot frame is at the import. It does not follow the robot when you move the robot later.
A frame that sits on another prim of the scene, such as a fixture, gets such a group below that prim and moves with it.
The group undoes a scale, a shear or a mirror of that prim, so the poses keep the distances in millimeters that the dataset stores.
Datasets imported next to the same robot or onto the same prim stay apart.
Each pose prim is named after the identifier of the pose, with `-` written as `_`: `up1-p3` becomes `up1_p3`.

Poses with a robot configuration come back as ghost objects when their robot is in the scene and has a tool.
The robot configuration is solved for the TCP the pose names, found on the tools of the robot as `tcp_<name>` or `<name>`. `Flange` is the flange of the robot.
On NOVA 26.7 and 26.8, a pose that names no TCP takes it from a command routine that moves to it: the TCP offset of the routine, else its TCP name. Without such a routine, the pose is solved for the TCP of the tool on its robot.
If no tool of the robot has that TCP, or the robot is missing, the pose comes back as a plain pose, and `Logs` says why.
A pose whose robot configuration is `unspecified` comes back as a plain pose too.
A plain pose keeps the robot configuration of the dataset, so the next publish sends it back.
Its joint values are solved again from the pose and the configuration when its robot is in the scene.

The dataset stores the poses of a robot relative to its base, `link_0`.
The import places them relative to `link_0` too, also when `link_0` does not sit at the origin of the robot prim.

![Screenshot of the viewport with three imported ghost objects on the workpieces and the Stage panel with the ghost objects in the import group next to the robot prim](/assets/nova/omniservice/motion_data_service/motion-data-service-imported-ghosts.webp)

## Merge a version into an earlier import

When importing a dataset already in the scene from the same instance and cell, such as a newer version, the dialog `Merge dataset version` opens instead of creating a second copy.
In the example, a version 4 that someone touches up in Visual Studio Code merges into the import of version 2: the touched-up pose shows as `Changed`, and the `Command Routines` card lists any new routine.
It compares the version with the poses in the scene:

- `Added`: The pose is in the dataset but not in the scene.
- `Changed`: The pose is in both, at a different place or with another robot configuration. The change in position and orientation, or `posture`, is shown on the right.
- `Removed`: The pose is in the scene but no longer in the dataset.
- `Unchanged`: The pose is the same in both. The comparison does not cover the TCP, so a pose whose only change is its TCP is reported `Unchanged`. It has no checkbox, and `Apply merge` cannot bring the new TCP into the scene.

`Data Targets` starts with the prims of the earlier import. The merge places the frames on the prims it shows, so change them before you click `Import Dataset into Scene` if the frames should move.
Frames that the newer version moved move with their poses. Poses you leave out of the merge stay where they are.
Added and changed poses start checked, removed poses start cleared.
Check the changes you want and click `Apply merge`.\
→ `Logs` lists how many poses were added, updated and removed.

![Screenshot of the Merge dataset version dialog with one changed, one unchanged and one added pose](/assets/nova/omniservice/motion_data_service/motion-data-service-merge.webp)

## Publish a new version

To update a dataset, select it in `Dataset Name` instead of `new dataset`.
The dataset keeps its name and description, and the button names the next version number, for example `Publish New Dataset Version (v3)`.

A version replaces the whole content of the dataset.
The window therefore carries the command routines of the dataset over into the new version.
The `Command Routines` card lists them. Clear the checkbox of a routine to drop it.
In the example, the routine from Visual Studio Code goes into version 3 with the poses you changed in the scene.

Poses that came from an import keep their identifier, name and frame, so the routines that move to them stay valid in the new version.
A published pose also keeps its identifier when poses with the same name are added or removed.
A pose you delete does not give up its identifier to the version you publish next: a new pose with the same name gets a new one, and routines that move to the deleted pose are dropped with a warning in `Logs`.
Only the identifiers of the version you publish onto are kept. Once the deletion is published, a later version can give the identifier to a new pose.
Renaming a pose prim gives the pose a new identifier, and routines that move to the old one are dropped.

Frames that the import built, rather than placed on a prim of the scene, are published where they stand, below the frame they hang from in the scene. Move such a frame, and its poses move in the new version too. A built frame that hangs from no frame of the dataset is published at its place in the world.
If the dataset you publish to does not have the frame of an imported pose, for example a new dataset, the pose is published without it, at the same place in the world. `Logs` warns about it.
A robot of the scene can now use a frame identifier that the earlier version gave another prim.
The poses in that frame, and in the frames below it, are then published in the frame of the prim they sit under. They stay where they are, and `Logs` warns about it.
An imported pose that you convert to a ghost object or back stays part of its import, with its identifier, name and frame.

![Screenshot of the Export Data tab with the existing dataset Stacking demo selected and the button Publish New Dataset Version (v2)](/assets/nova/omniservice/motion_data_service/motion-data-service-new-version.webp)

## Import datasets from other sources

Datasets do not have to come from Isaac Sim. One example is a dataset converted from KUKA robot programs.
Such a dataset rarely names the prims of your scene, so check `Data Targets` before the import.

`Data Targets` starts with these prims:

1. A frame with the metadata key `isaacsim/prim_path` sits on the prim it names, unless that prim lies inside a robot.
2. A frame without it sits on a robot of the scene whose frame identifier matches, for example `mg-0-kuka-kr10-r900-2-base` for the motion group `0@kuka-kr10-r900-2`.

A frame without a prim is placed like this:

1. A frame with a `reference_frame` hangs from that frame, for example a KUKA base from the robot base.
2. A frame that hangs from no frame is placed below `Parent`, at the pose stored in the dataset. It does not follow a robot, and `Logs` reports it.

The robot model and the mounting for the robot configurations come from the `motion_group_setup` of the command routines that move to the poses. On NOVA 26.7 and 26.8, a TCP offset there gives the TCP of a pose that names none.
With the mounting, the poses of a robot that hangs upside down land in the right place.
A dataset published from Isaac Sim keeps its robot poses relative to `link_0`, with or without a mounting.
