Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Strange values returned from rotationValue()

1 REPLY 1
Reply
Message 1 of 2
RogerInHawaii
174 Views, 1 Reply

Strange values returned from rotationValue()

I'm trying to control a revolute joint.

 

I have a function that finds and returns the Revolute Motion of the desired Joint, called like this:

Ptr<RevoluteJointMotion> desiredJointsRevoluteMotion = GetRevoluteJointMotionByRevoluteJointName("The Joint Name");

 

I can successfully set that Revolute Motion's RotationValue like this:

desiredJointsRevoluteMotion->rotationValue(0.0); // The parameter is in radians

 

and the object really does move in the model as expected.

 

But if I (even immediately) go to retrieve the rotationValue, with ...

 

double resultantRotationValueInRadians = desiredJointsRevoluteMotion->rotationValue();

 

what I get back is, NOT 0.0, but 62.831853.

 

Now, it turns out that 62.831853 radians is actually EQUIVALENT to 0.0 radians, in much the same way that 360 degrees is equivalent to 0 degrees, or actually more in much the same way that 20 * 360 degrees is equivalent to 0 degrees (i.e. 62.831853 = 20 * 2Pi radians).

BUT WHY? Why, when I pass in a value of 0.0 to the rotationValue(0.0) method, expecting it to set it to exactly 0.0, does it ACTUALLY set it to 62.831853? Or at least it RETURNS that value when I inquire as to what the current rotationValue of the RevoluteJointMotion is?

And I get similar results with other values of setting the rotationValue. The returned value is always (I think) "equivalent" to the set value, but why not EQUAL to the set value? And why, sometimes, it's a huge multiple of an equivalent value? I could see, maybe that setting it to 0.0 MIGHT return 6.28318 (ie. 2*Pi), but why TWENTY TIMES 2Pi?

 

In fact, even if I don't actually try to set the JointMotion value and simply access it, returning whatever it is as the default (which I would reasonably expect to be 0.0), it also returns that 62.831853. Why is the default value so strange? Why not simply 0.0?

 

I'm just baffled. Any insights would be appreciated.

1 REPLY 1
Message 2 of 2
goyals
in reply to: RogerInHawaii

I tried that and it is working fine. I would appreciate if you can share full script to help me reproduce it.



Shyam Goyal
Sr. Software Dev. Manager

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report