Page 1 of 1

getting the joint force as a float or integer

Posted: 19 Mar 2024, 09:35
by jetixmen
I want to get the get the joint force as a float or integer because i will use that value on some mathematical processes. Currently it is a nonetype and i can't find a way to change it.
Help me please

force1= sim.getJointForce(joint1)

Re: getting the joint force as a float or integer

Posted: 20 Mar 2024, 23:02
by fferri
sim.getJointForce returns a float already.

Perhaps you have some error in your code.

Re: getting the joint force as a float or integer

Posted: 21 Mar 2024, 04:22
by jetixmen
no, when i am trying to compare the output with a float it says one is float and other one is nonetype, so you can't do this.

Re: getting the joint force as a float or integer

Posted: 21 Mar 2024, 15:21
by coppelia
Hello,

Please share your scene, or show us the full script that displays that problem.

Cheers

Re: getting the joint force as a float or integer

Posted: 27 Mar 2024, 01:36
by jetixmen
https://drive.google.com/file/d/1K8WUoo ... drive_link

here is the link
in the line 82 it gives that none type error.
Help me please

Re: getting the joint force as a float or integer

Posted: 27 Mar 2024, 10:01
by coppelia
Hello,

in the very first simulation step, before the physics engine is even called, there is no dynamic state. And in that case, the function will return None.

The easiest solution would be to skip the very first simulation step in your sysCall_actuation function.

Cheers

Edit: actually, we will change the behaviour for next release, and have it return 0.0 in that case, since that would be less confusing