Unverified Commit 0ef582ba authored by James Smith's avatar James Smith Committed by GitHub

Expands functionality of FrameTransformer to allow multi-body transforms (#858)

# Description

Update FrameTransformer to handle 2 new functionalities:
* Target frames that aren't children of the source frame prim_path
* Target frames that are based upon the source frame prim_path

These new changes mean that the frame names will most likely be
different than the configured order - but this was always a possibility
to the way the regex is parsed. To be safe, users need to use
`frame_names` to determine indexing into `FrameTransformerData`.

Test cases have been added for both of these new functionalities -
thanks @Mayankm96!

Also, the run script has been updated slightly as the previous indexing
was off by 1.


Fixes #857 #294

## Type of change

- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
parent 2a9198c8
[package]
# Note: Semantic Versioning is used: https://semver.org/
version = "0.24.18"
version = "0.24.19"
# Description
title = "Isaac Lab framework for Robot Learning"
......
Changelog
---------
0.24.19 (2024-10-05)
~~~~~~~~~~~~~~~~~~~~
Added
^^^^^
* Added new functionalities to the FrameTransformer to make it more general. It is now possible to track:
* Target frames that aren't children of the source frame prim_path
* Target frames that are based upon the source frame prim_path
0.24.18 (2024-10-04)
~~~~~~~~~~~~~~~~~~~~
......
......@@ -31,10 +31,15 @@ class FrameTransformerCfg(SensorBaseCfg):
"""Information specific to a coordinate frame."""
prim_path: str = MISSING
"""The prim path corresponding to the parent rigid body.
"""The prim path corresponding to a rigid body.
This prim should be part of the same articulation as :attr:`FrameTransformerCfg.prim_path`.
This can be a regex pattern to match multiple prims. For example, "/Robot/.*" will match all prims under "/Robot".
This means that if the source :attr:`FrameTransformerCfg.prim_path` is "/Robot/base", and the target :attr:`FrameTransformerCfg.FrameCfg.prim_path` is "/Robot/.*",
then the frame transformer will track the poses of all the prims under "/Robot",
including "/Robot/base" (even though this will result in an identity pose w.r.t. the source frame).
"""
name: str | None = None
"""User-defined name for the new coordinate frame. Defaults to None.
......
......@@ -15,8 +15,8 @@ class FrameTransformerData:
"""Target frame names (this denotes the order in which that frame data is ordered).
The frame names are resolved from the :attr:`FrameTransformerCfg.FrameCfg.name` field.
This usually follows the order in which the frames are defined in the config. However, in
the case of regex matching, the order may be different.
This does not necessarily follow the order in which the frames are defined in the config due to
the regex matching.
"""
target_pos_source: torch.Tensor = None
......
......@@ -139,10 +139,10 @@ def run_simulator(sim: sim_utils.SimulationContext, scene_entities: dict):
if count % 50 == 0:
# get frame names
frame_names = frame_transformer.data.target_frame_names
print(f"Displaying Frame ID {frame_index}: {frame_names[frame_index]}")
# increment frame index
frame_index += 1
frame_index = frame_index % len(frame_names)
print(f"Displaying Frame ID {frame_index}: {frame_names[frame_index]}")
# visualize frame
source_pos = frame_transformer.data.source_pos_w
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment