How to set the positions of fixed rigid bodies?

The use case is to place fixed obstacles in RL environments where the positions of the obstacles vary in different episodes. I fixed the rigid body by adding a fixed joint. However, RigidPrimView.set_world_poses raises no error/warning but has no effect here.

I think it is because the fixed joint would pull the object back to where it was created. Is there any solution to this?

do you need a fixed joint? Would not creating just a static body work in your case?
Using directly USD python API it would look like this:

        wallGeom = UsdGeom.Cube.Define(stage, wallActorPath)
        wallGeom.CreateSizeAttr(wall_size * 2.0)
        wallGeom.AddTranslateOp().Set(Gf.Vec3f(800.0, 0.0, wall_z))
        wallGeom.AddScaleOp().Set(Gf.Vec3f(1.0, 16.0, 1.0))

You can do that even from the GUI, right click on a mesh add->physics->collider.

If you really need the FixedJoint, you can modify the joint local pose, example:

        # fixed root joint
        fixedJoint = UsdPhysics.FixedJoint.Define(stage, articulationPath + "/rootJoint")
        fixedJoint.CreateBody1Rel().SetTargets( [Sdf.Path(articulationPath + "/box0")])

        fixedJoint.CreateLocalPos0Attr().Set(Gf.Vec3f(0.0, 0.0, 0.0))

        fixedJoint.CreateLocalPos1Attr().Set(Gf.Vec3f(0.0, 0.0, 0.0))

Here you could get the localpos0/1 attributes and change the positions, this is something that you can do in the runtime and it would move the cube to the desired position.

However if you dont really need a dynamic actor, I would suggest to create a static body and move it around. If its something you want to move around with say animation, then I would recommend to create a dynamic body and raise the kinematic enabled flag. Then just update the position of the body.


It seems that we cannot create RigidPrimView for bodies with only ColliderAPI. Creating the view is necessary for a large-scale RL setting since we can not use a for loop to set their positions.

Then add even RigidBodyAPI and set the kinematic body bool to true, this way the body is a dynamic body and should be visible by the RigidPrimView.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.