Skip to content

infra: add PrimitiveFrameCfg; isaaclab: support it#135

Merged
geng-haoran merged 3 commits intomainfrom
feature/coordinate_frame
Apr 22, 2025
Merged

infra: add PrimitiveFrameCfg; isaaclab: support it#135
geng-haoran merged 3 commits intomainfrom
feature/coordinate_frame

Conversation

@Fisher-Wang
Copy link
Copy Markdown
Collaborator

@Fisher-Wang Fisher-Wang commented Apr 22, 2025

This PR adds PrimitiveFrameCfg object cfg to infra to visualize the pose of specific object or body link better. Currently, isaaclab support it.

The functionality can be tested using the following script:

from __future__ import annotations

import torch

from metasim.cfg.objects import PrimitiveFrameCfg
from metasim.cfg.scenario import ScenarioCfg
from metasim.constants import SimType
from metasim.utils.setup_util import get_sim_env_class

scenario = ScenarioCfg(
    robot="franka",
    try_add_table=False,
    sim="isaaclab",
    num_envs=1,
)

scenario.objects = [
    PrimitiveFrameCfg(
        name="frame",
        base_link=("franka", "panda_hand"),
        # ! feel free to change this to the following
        # base_link="franka",
        # base_link=None,
        scale=0.1,
    ),
]
env_class = get_sim_env_class(SimType(scenario.sim))
env = env_class(scenario)

init_states = [
    {
        "objects": {},
        "robots": {
            "franka": {
                "pos": torch.tensor([0.0, 0.0, 0.0]),
                "rot": torch.tensor([1.0, 0.0, 0.0, 0.0]),
                "dof_pos": {
                    "panda_joint1": 0.0,
                    "panda_joint2": -0.785398,
                    "panda_joint3": 0.0,
                    "panda_joint4": -2.356194,
                    "panda_joint5": 0.0,
                    "panda_joint6": 1.570796,
                    "panda_joint7": 0.785398,
                    "panda_finger_joint1": 0.04,
                    "panda_finger_joint2": 0.04,
                },
            },
        },
    }
]
obs, extras = env.reset(states=init_states)
robot_joint_limits = scenario.robot.joint_limits
while True:
    actions = [
        {
            "dof_pos_target": {
                joint_name: (
                    torch.rand(1).item() * (robot_joint_limits[joint_name][1] - robot_joint_limits[joint_name][0])
                    + robot_joint_limits[joint_name][0]
                )
                for joint_name in robot_joint_limits.keys()
            }
        }
        for _ in range(scenario.num_envs)
    ]
    obs, reward, success, time_out, extras = env.step(actions)

Expected behavior:

iShot_2025-04-21_21.32.04.mp4

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 22, 2025

Deploying roboverse-release with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4f9ffa6
Status: ✅  Deploy successful!
Preview URL: https://43bf7172.roboverse-release.pages.dev
Branch Preview URL: https://feature-coordinate-frame.roboverse-release.pages.dev

View logs

@geng-haoran geng-haoran merged commit 8a33af1 into main Apr 22, 2025
4 checks passed
@Fisher-Wang Fisher-Wang deleted the feature/coordinate_frame branch April 23, 2025 04:43
boli919 pushed a commit to boli919/RoboVerse that referenced this pull request Jul 20, 2025
* infra: add PrimitiveFrameCfg; isaaclab: support it

* add frame asset to metasim/data; update path

* quickfix
cheolhong0916 pushed a commit to cheolhong0916/RoboVerse that referenced this pull request Aug 28, 2025
* infra: add PrimitiveFrameCfg; isaaclab: support it

* add frame asset to metasim/data; update path

* quickfix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants