IsaacLab icon indicating copy to clipboard operation
IsaacLab copied to clipboard

[Question] How to get the local pose or world pose of an object in IsaacLab?

Open SantiDiazC opened this issue 1 year ago • 13 comments

Hi, I was wondering how to get the pose of an object while the simulation is running (may be used as observation data: position and orientation), for example some links of an articulation (robot arm. gripper etc.) or any other spawn object inside the environment?

Thank you in advance!

SantiDiazC avatar Aug 05 '24 11:08 SantiDiazC

Hi, @SantiDiazC

Did you check the code below if you make the object by RigidObjectCfg?

  • ./IsaacLab/source/extensions/omni.isaac.lab/omni/isaac/lab/assets/rigid_object/rigid_object_data.py

And,

  • ./IsaacLab/source/extensions/omni.isaac.lab/omni/isaac/lab/assets/articulation/articulation_data.py for robot arm and gripper

jo-choi avatar Aug 06 '24 01:08 jo-choi

Hi,

You can the rigid body transforms in different ways:

Mayankm96 avatar Aug 06 '24 08:08 Mayankm96

Hello everyone.

Can I directly obtain the local quaternion of an object in Isaac Lab? I have already retrieved the world quaternion.

H-Hisamichi avatar Aug 06 '24 10:08 H-Hisamichi

Local quaternion w.r.t. what? If you mean by the environment frame, the orientation of the world frame and the environment frame coincide, so you don't need to do that.

If something else, then you should consider using the FrameTransformer or do the necessary operation yourself. We provide everything in world frame from the asset classes since that's the most general case.

Mayankm96 avatar Aug 06 '24 10:08 Mayankm96

Hi, @Mayankm96

Apologies for the complex wording. The term 'local quaternion' refers to the orientation in the object's coordinate system (local frame). Is it correct to assume that the local environment frame and the simulated world frame are the same in Isaac Lab?

I'm trying to use the rotation information of a rolling robot (which axis and how many degrees it has rotated) in reinforcement learning, but I'm having trouble because only the simulation world frame is available in omni.isaac.lab.assets.

H-Hisamichi avatar Aug 06 '24 11:08 H-Hisamichi

Hi, @Mayankm96

Apologies for the complex wording. The term 'local quaternion' refers to the orientation in the object's coordinate system (local frame). Is it correct to assume that the local environment frame and the simulated world frame are the same in Isaac Lab?

I'm trying to use the rotation information of a rolling robot (which axis and how many degrees it has rotated) in reinforcement learning, but I'm having trouble because only the simulation world frame is available in omni.isaac.lab.assets.

Hi @H-Hisamichi Any updates?

AshinTheAnvil avatar Aug 14 '24 15:08 AshinTheAnvil

Hi, @AshinTheAnvil

Apologies for the delayed response. After that, it seems that the return value of body_quat_w from omni.isaac.lab.assets corresponds to observations from the local coordinate system, as in CAD, so I am using that value.

H-Hisamichi avatar Aug 16 '24 05:08 H-Hisamichi

Thank you @cjoattesollo and @Mayankm96 for your replies! It helped me a lot to do what I was looking for!

SantiDiazC avatar Aug 22 '24 06:08 SantiDiazC

Related to this issue, I have checked the rigid_object_data.py and I all the functions to get the object position are wrt to the world frame. I wonder if I could get the position of my object wrt to his own frame in the last iteration.

Thank you

mikelasa avatar Oct 09 '24 11:10 mikelasa

Weird question:

In my simulation, body_state_w/body_link_state_w and body_com_state_m stay constant, while attributes like joint_pos update every step. (While watching the simuation you can clearly see that the bodies of my robot are moving)

Does somebody have an idea for a direction he/she can point me for solving this?

KnuniK avatar Apr 03 '25 12:04 KnuniK

Weird question:

In my simulation, body_state_w/body_link_state_w and body_com_state_m stay constant, while attributes like joint_pos update every step. (While watching the simuation you can clearly see that the bodies of my robot are moving)

Does somebody have an idea for a direction he/she can point me for solving this?

Hi, did you solve this problem?

Shuaikang-Wang avatar Apr 15 '25 10:04 Shuaikang-Wang

Hi, did you solve this problem?

Yes, I did!

My Script is based on the Direct Workflow RL Tutorial. I added a variable in the __int__ method of the CartpoleEnv at line 69: self.body_state = self.cartpole.data.body_state_w

However, if you access self.body_state in functions like _get_observations/_get_dones or _get_rewards, it always returns the initial state and is never updated.

To get the current values, you need to reassign the variable inside each of those functions: self.body_state = self.cartpole.data.body_state_w This ensures you always work with the updated state.

I'm not sure if this is intended behavior or a bug (tested on Isaac Sim version 4.5.0).

KnuniK avatar Apr 15 '25 10:04 KnuniK

Hi, did you solve this problem?

Yes, I did!

My Script is based on the Direct Workflow RL Tutorial. I added a variable in the __int__ method of the CartpoleEnv at line 69: self.body_state = self.cartpole.data.body_state_w

However, if you access self.body_state in functions like _get_observations/_get_dones or _get_rewards, it always returns the initial state and is never updated.

To get the current values, you need to reassign the variable inside each of those functions: self.body_state = self.cartpole.data.body_state_w This ensures you always work with the updated state.

I'm not sure if this is intended behavior or a bug (tested on Isaac Sim version 4.5.0).

That works! Thank you

Shuaikang-Wang avatar Apr 15 '25 11:04 Shuaikang-Wang