[Question] How to get the local pose or world pose of an object in IsaacLab?
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!
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
Hi,
You can the rigid body transforms in different ways:
- Through the asset class, you can obtain the body poses in the world frame. For instance, ArticulationData.body_state_w and RigidBodyData.body_state_w
- Through the
FrameTransformersensor, you can obtain poses between different frames. For an example, you can check the tutorial
Hello everyone.
Can I directly obtain the local quaternion of an object in Isaac Lab? I have already retrieved the world quaternion.
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.
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, @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?
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.
Thank you @cjoattesollo and @Mayankm96 for your replies! It helped me a lot to do what I was looking for!
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
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?
Weird question:
In my simulation,
body_state_w/body_link_state_w and body_com_state_mstay constant, while attributes likejoint_posupdate 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?
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).
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 theCartpoleEnvat line 69:self.body_state = self.cartpole.data.body_state_wHowever, if you access
self.body_statein functions like_get_observations/_get_donesor_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_wThis 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