(Error) None.SetRotate(XformCommonAPI, Vec3d) did not match C++ signature:

I try to use pxr.UsdGeom.XformCommonAPI to set the rotation of a prim.
I call
pxr.UsdGeom.XformCommonAPI(_target_prim).SetRotate(Gf.Vec3d(0, 10, 0))

but it show me the error

[ERROR] [1629356833.447002]: Error processing request: Python argument types in
None.SetRotate(XformCommonAPI, Vec3d)
did not match C++ signature:
SetRotate(pxrInternal_v0_20__pxrReserved__::UsdGeomXformCommonAPI {lvalue}, pxrInternal_v0_20__pxrReserved__::GfVec3f rotation, pxrInternal_v0_20__pxrReserved__::UsdGeomXformCommonAPI::RotationOrder rotationOrder=UsdGeom.XformCommonAPI.RotationOrderXYZ, pxrInternal_v0_20__pxrReserved__::UsdTimeCode time=Usd.TimeCode.Default())
[‘Traceback (most recent call last):\n’, ’ File “/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py”, line 632, in handle_request\n response = convert_return_to_response(self.handler(request), self.response_class)\n’, ’ File “/home/hong.yi.chen/isaac-sim/scripts/env/assembly/ur5e_env.py”, line 75, in reset_env_srv\n pxr.UsdGeom.XformCommonAPI(target_prim).SetRotate(Gf.Vec3d(0, 10, 0))\n’, 'Boost.Python.ArgumentError: Python argument types in\n None.SetRotate(XformCommonAPI, Vec3d)\ndid not match C++ signature:\n SetRotate(pxrInternal_v0_20__pxrReserved::UsdGeomXformCommonAPI {lvalue}, pxrInternal_v0_20__pxrReserved__::GfVec3f rotation, pxrInternal_v0_20__pxrReserved__::UsdGeomXformCommonAPI::RotationOrder rotationOrder=UsdGeom.XformCommonAPI.RotationOrderXYZ, pxrInternal_v0_20__pxrReserved__::UsdTimeCode time=Usd.TimeCode.Default())\n’]

The transform setting of prim is:
image

By the way, setTranslate works properly.
pxr.UsdGeom.XformCommonAPI(_target_prim).SetTranslate(Gf.Vec3d(0, 0, 0))

Hi @q199493422

It seems to be SetRotate method uses Gf.Vec3f vector type instead of Gf.Vec3d type

Try with it

pxr.UsdGeom.XformCommonAPI(_target_prim).SetRotate(Gf.Vec3f(0, 10, 0))

Hi @toni.sm

I am experiencing the same issue and when I change from using Gf.Vec3d to Gf.Vec3f I get the following error:

USD/pxr/usd/usd/stage.cpp: 'Type mismatch for </Lidar.xformOp:rotateXYZ>: expected 'GfVec3d', got 'GfVec3f'

I am trying to rotate a LiDAR sensor created with RangeSensorCreateLidar command.

Thanks in advance

Hi @ceteke13

It seems to be in this case a vector of 3 double components is expected. Then, you can create it using

from pxr import Gf
Gf.Vec3d(0, 0, 90)

You can see an example in PATH_TO_ISAAC_SIM/exts/omni.isaac.range_sensor/omni/isaac/range_sensor/tests/test_ultrasonic.py file, line 768

Hi again @toni.sm,

Thank you for the quick reply. If I use Vec3d then we have the problem stated initially by @q199493422 . Nevertheless, I have managed to make it work with the following workaround:

import omni
stage = omni.usd.get_context().get_stage()

rot_att = stage.GetPrimAtPath("/Lidar").GetAttribute("xformOp:rotateXYZ")
rot_att.Set(Gf.Vec3f(270, 0, 45))

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