getting the joint force as a float or integer

Typically: "How do I... ", "How can I... " questions
Post Reply
jetixmen
Posts: 14
Joined: 03 Oct 2023, 08:45

getting the joint force as a float or integer

Post 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)

fferri
Posts: 1230
Joined: 09 Sep 2013, 19:28

Re: getting the joint force as a float or integer

Post by fferri »

sim.getJointForce returns a float already.

Perhaps you have some error in your code.

jetixmen
Posts: 14
Joined: 03 Oct 2023, 08:45

Re: getting the joint force as a float or integer

Post 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.

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: getting the joint force as a float or integer

Post by coppelia »

Hello,

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

Cheers

jetixmen
Posts: 14
Joined: 03 Oct 2023, 08:45

Re: getting the joint force as a float or integer

Post 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

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: getting the joint force as a float or integer

Post 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

Post Reply