Revolute joint with wizard vehicle

Hello,

I am trying to integrate revolute joints into the vehicle and everything is fine but I don’t know why when I press start the vehicle shifts from the ground as shown in the video attached

can anyone help me to solve this problem

Hi,
can you please elaborate more about what you are trying to achieve? Are you trying to move the wheels using revolute joint instead of the vehicle wheel mechanics?
Regards,
Ales

@AlesBorovicka Hi,

what I want to achieve in the first step is to use revolute joint to add drivers to them and make it move without any keyboard inputs and for the next step use omnigraph or python script to control these drivers

I tried to control the rendered parts of the car directly using omnigraph but I failed so I thought about workaround to use joints and control them that’s all. The problem I am facing now is that the wheels when I press start goes up away from the collision plane and doesn’t go forward as shown in the video

Do I understand correctly that you want to control the wheels through revolute joints with a drive? If that is what you want to do, then there is not much point in using a vehicle. You would rather work with rigid bodies only.
Please note as well that you do not need the keyboard to control the vehicle. It can be done through the USD attributes. See the PhysxVehicleControllerAPI API schema and its attributes (accelerator, steer etc.). If you want more direct control over the wheels, then you can create a vehicle without a drive (choose None in the wizard). In that case every wheel will have the PhysxVehicleWheelControllerAPI API schema applied and you can set steer angle, drive and brake torque directly.

Thank you for replying to me, I will check the PhysxVehicleWheelControllerAPI and try to control it but unfortunately, I can’t find the documents for API schema as I searched a lot for it if you can mentioned for me the link will be helpful too

There is this link, for example:

http://omniverse-docs.s3-website-us-east-1.amazonaws.com/omni_usd_schema_physics/104.2/class_physx_schema_physx_vehicle_wheel_controller_a_p_i.html#ab52ad15d8a419cfba055f8e94335d580

The descriptions of the Get… methods provide some info.

In Create, you should also get a tooltip when hoovering over the attribute in the property window.

@MichaelPhysX
sorry since I am not an expert yet with omniverse, I got another question because when I tried the PhysxVehicleWheelControllerAPI I have to create everything from scratch, my question now is if I can implement this code to a customized vehicle that I modified the wizard vehicle already?

What sort of vehicle did you create through the wizard (none/basic/standard drive)? And do you really need direct control over the wheels? You might have PhysxVehicleControllerAPI applied to your vehicle prim and then you could use attributes like steer, accelerator, brake0 etc. to control the vehicle.
Currently there is no way to change the vehicle “type” after the wizard has run (except changing the USDA file by hand in a text editor).

@MichaelPhysX

Thanks for replying to me, I attached a screenshot of my code even with the PhysxVehicleWheelControllerAPI still saying it can’t attribute to GetDriveTorqueAttr

It is standard drive type

There are a few things here:
Standard and basic drive can not be combined with PhysxVehicleWheelControllerAPI. Having a drive means that the drive takes care of applying torques to the wheels. So your options are:

  • standard or basic drive and then use PhysxVehicleControllerAPI (on the vehicle prim) to control the vehicle through the attributes steer, accelerator, brake0 etc.

  • no drive and then use PhysxVehicleWheelControllerAPI (on every wheel attachment prim) to directly set steerAngle, driveTorque and brakeTorque

By the way, is your code creating a vehicle from scratch or using a USD vehicle asset that you’ve create through the wizard? It the latter, then you usually would not use code like:

vehicleControllerAPI = PhysxSchema.PhysxVehicleControllerAPI.Apply(vehiclePrim)

but

vehicleControllerAPI = PhysxSchema.PhysxVehicleControllerAPI(vehiclePrim)

since the USD asset from the wizard should already have PhysxVehicleControllerAPI applied (for standard drive)

Thank you for the great explanation i will check it out and the wizard vehicle is already created i am using only the code to control the vehicle not to create it

The error you are getting is because you are trying to apply the torque to a xform type in your code. If the api is already applied to that prim, you need to cast it to the vehiclecontrollerAPI before accessing the attribute through that method. I see that the section that fails is requesting the drivetorque in the parameter ‘Front’. Would it be that you need to use ‘vehicleControllerAPI’ since that’s the param you’re setting with the API?

@rgasoto
Yes i am trying to move the vehicle forward using API in my code but i cant access any attributes yet

some example python code (maybe that helps).

no drive vehicleWizard vehicle:
wheel0Contr = PhysxSchema.PhysxVehicleWheelControllerAPI(wheel0Prim)
wheel0Contr.GetBrakeTorqueAttr().Set(…)
wheel0Contr.GetSteerAngleAttr().Set(…)
wheel0Contr.GetDriveTorqueAttr().Set(…)
and same for other wheels you want to control

standard/basic drive vehicleWizard vehicle
vehContr = PhysxSchema.PhysxVehicleControllerAPI(vehiclePrim)
vehContr.GetSteerAttr().Set(…)
vehContr.GetAcceleratorAttr().Set(…)
vehContr.GetBrake0Attr().Set(…)
etc.

Thank you so much that’s what i needed and it works

1 Like

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