Seems like I cannot set position for joint, while the sim is not running. The thing is that some joints in my robot are located below groung and apparently this causes robot to explode when I start the sim. How to set joint positions by “default”
You can try to use the physics inspector to change joint state position and have such changes modify transforms of your robot/articulation during authoring, outside of simulation.
Please take a look at this page:
https://docs.omniverse.nvidia.com/extensions/latest/ext_physics/support-ui.html#physics-inspector
The inspector simulates your robot (mor precisely your stage selection) in isolation.
If your robot is floating and not fixed, it will be affected by gravity, and it will start falling downwards.
Note however that if your robot is simulation is already unstable for other reasons, it will explode also when using the inspector, so I suggest saving your stage before trying it.
If your robot is an open mechanism, I suggest to (even temporarily) fix your articulation / robot before trying to change it with the physics inspector.
As an alternative, if you create some xform so that it contains both your robot and a ground plane with a collider, the ground plane will be included in the authoring simulation that is being run by inspector preventing the robot from falling down.
Thanks, I think it helped! At least, I can change the joint positions now. However, if I set the articulation root at the base link of the robot, it either stays fixed it in place or explodes with error PhysX error: Illegal BroadPhaseUpdateData
. I am not sure that I can provide .usd file for you because of NDA reasons for now and I understand that it will be very hard for you to support without the file, but can you suggest some best practices of fixing the articulation of the robot?
It’s quite complex mobile manipulator with quite a lot of joints
@scristiano But how can I set them in my python code before starting the simulation?
For example, this has worked for me fine in 2022 and robot was stable upon on sim start:
def set_joint_position(self, joint_name, position, immediate=True):
"""Control the joint position.
Args:
joint_name: (str): path to the joint from the robot such as
pcw_rear_left_steer_link/pcw_rear_left_drive
postition (float): the joint position value to set, offset
for linear joints and radians for angular joints
immediate (bool): whether the joint needs to be moved immediately,
or if Isaac control should be performed
"""
if joint_name not in self.JOINT_WHITELIST:
return
joint_prim = self.joint_prims[joint_name]
joint_position_attribute = next(
(att_name for att_name in joint_prim.GetPropertyNames()
if att_name.endswith(":physics:position")), None)
joint_target_position_attribute = next(
(att_name for att_name in joint_prim.GetPropertyNames()
if att_name.endswith(":physics:targetPosition")), None)
# for angles, the API assumes degrees and not radians
is_angular = "angular" in joint_position_attribute
if is_angular:
position = math.degrees(position) % 360
if joint_position_attribute is None or\
joint_target_position_attribute is None:
print("Joint position / targetPosition attribute does not exist!")
if immediate and not joint_prim.GetAttribute(joint_position_attribute)\
.Set(position):
print("Fail of immediate joint state setting")
return False
if not joint_prim.GetAttribute(joint_target_position_attribute)\
.Set(position):
print("Couldnt move the joint")
But in 2023 version absolutely same code - robot explodes
Hi @karavaev - the joint state API behavior should be identical between the IsaacSim versions. We did change the behavior of TGS velocity iterations however (just a wild guess from me) - what pos/vel iteration counts are you using? This would only be an issue if you use more than 4 velocity iterations and likely only in combination with joint drives - more than four vel iters were converted to position iterations silently, which we fixed. See TGS velocity iterations in this table: PhysX Limitations — Omniverse IsaacSim latest documentation
I have re-read your initial question and it’s not clear to me if you’re creating an actual articulation or not.
I find it suspect that the Joint state values stays zero, if that happens during simulation than it means that an articulation is not being created.
To debug the articulation, you could try the following:
- You need to check that an articulation is actually created. If an articulation is created you will see Joint State API data in the property panel change during runtime. If no articulation is created, the Joint State API values always stay at zero.
- Try to add a single Articulation Root API on a top level prim to let the system pick the articulation root.
- Once you’re sure that an articulation is created, disable all joints so that the simulation is stable and then try to re-enable them one by one until you find the problematic one
- You can try increasing the articulation iteration count
- To find the correct rest pose values for join state, keep in mind that joint state API flips the joint sign depending on the joint body order. Isaac Sim Articulation inspector (Articulation Inspector — Omniverse IsaacSim latest documentation) has reported in the past different signs from Physics Inspector
and Joint State API (Physics Authoring Toolbar (PhysX Support UI) — Omniverse Extensions latest documentation). In Isaac release notes for 2023.1.0 (Release Notes — Omniverse IsaacSim latest documentation) there is an entry stating “JointState Publisher sign correction when a joint’s parents are in reversed order”. So I suggest to double check all joints signs, that you could or could not see different between the two releases you’re using depending on where you’re sourcing these values from.