When will the code of create be published

Our program seems facing a problem that should be solved by coding. I heard that the code will be published in Aug. Could someone tell me the time?

Hello @1031521414! Could you provide me with more details on what you are trying to do?

I recommend installing our IDE Omniverse Code from the Omniverse Launcher. In Omniverse Code, you can view the API Documentation as well as many other cool developer features!

Here is a video to help get you started.

Also, check out our discord server here: discord.gg/nvidiaomniverse where you can chat with other developers such as yourself!

We are going to build a digital twin mining hydraulic support. The problem we are facing is that we can’t imitate the action of it exactly by create, such as the change of force during the process of applying force . So we think maybe we should deal with it by coding.

Ok @1031521414! Let me see if I can get you some help from the Physics team!

Hi,
you can currently apply forces to rigid bodies through a python script,

        force = carb.Float3(1000.0, 1000.0, 1000.0)
        get_physx_interface().apply_force_at_pos("/xform", force, position)

What else would you need? We aim to expose all in python, for next release 104.0 forces are even part of the schema, so you can apply forces/torques through them.

What special code would you need here maybe we miss something? (for sure we currently miss apply_torque there is TODO for that on our list)

Thank you for sharing the code , and how can I apply the code to my USD file? Via Omniverse Code or other app in Omniverse Launcher?

You need to create your own python extension, use for example Omniverse Code for that. In the extension python code, you should be able to import the omni physx interface and apply forces.

Sorry for bothering you . Now I have solved all mathematical problems in my extension . My latest problem is how to read values like translate or rotate in real time while running.
For example ,after I clicked the play button ,an object moved because of force. How to get the current value of translate and rotation(or orient).
We will apply force at a column which will rotate around a certain point while running ,so reading real-time value of translate and rotation can help us render the direction and position of the force applied.

Hi,
you can query the transformation from the rigid body using this helper snippet:

    def _get_rigid_body_pos_rot(self, path: Sdf.Path) -> Tuple[Gf.Vec3d, Gf.Quatd]:
        """get current transform of the rigid body on path from physx and return pos and rot"""
        curr_pos = Gf.Vec3d(0, 0, 0)
        curr_rot_quat = Gf.Quatd()
        curr_transform = get_physx_interface().get_rigidbody_transformation(str(path))
        rv_success = curr_transform["ret_val"]
        if rv_success:
            curr_pos_f3 = curr_transform["position"]
            curr_pos = Gf.Vec3d(curr_pos_f3[0], curr_pos_f3[1], curr_pos_f3[2])
            curr_rot_f4 = curr_transform["rotation"]
            curr_rot_quat = Gf.Quatd(curr_rot_f4[3], curr_rot_f4[0], curr_rot_f4[1], curr_rot_f4[2])
        return curr_pos, curr_rot_quat

Hope that works for you!
Regards,
Ales

Hello, in this code ,I noticed that the path should be a Class.
My extension can read path string by
ui.Label(“Path”, width=100, height=30)
PathString = ui.StringField(width=200, height=0)
PathString.model.add_end_edit_fn(……)

How can I change the string like “/world/cone” into Class Path in the code you provided

This is the function that you need and that one is already taking a string, so you dont need anything else. The rest will show you how to get the position and rotation.

I have tried run the extension by just import the string in this code . It seems that rv_success = false
I get the string by
with ui.HStack(height=30):
ui.Label(“Path”, width=100, height=30)
PathString = ui.StringField(width=200, height=0)
PathString.model.add_end_edit_fn(lambda m, : self.unit.setpath(m.get_value_as_string()))
In this code function setpath is:
def setpath(self, unitpath):
self.path = unitpath
self.curr_pos, self.curr_rot = self.get_rigid_body_pos_rot(self.path)
And I just changed the “path: Sdf.Path” in the code you provide to “path: str”
My situation is that in your code path is a class imported form pxr.Sdf , but what I can get via my code is a String like “/World/Xform/Cone” shown in Omniverse Code UI
Or maybe I shall create a interface which always appears in official extensions such as the one shows up when I want to add body 0 for a prismatic joint?
Like this interface:
QQ浏览器截图20220928153308

The function takes string as an input parameter, so the String like you show should work, if the rigid body is on the Cone prim.
Note that the rigid body transformation is available only in runtime, so play must be pressed and rigid body must be on the cone prim, not on the xform above for example.

Finally solved. Thank you for helping.