You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed that PyBullet returns tuples with multiple values whenever a function provides multiple values.
For instance, in getJointState:
return key
type
jointPosition
float
jointVelocity
float
jointReactionForces
list of 6 floats
appliedJointMotorTorque
float
The returned value would be a tuple like this one:
>>>joint_state=client.getJointState(body_id, joint_index)
>>>joint_state
(0.9871899972955821, 59.030020444882304, (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), -240.0)
>>>joint_state[0] # Get the joint's position.0.9871899972955821
I wonder if this is because a specific underlying implementation decision, or if it would be worth modifying PyBullet to return a more "semantic" structure like a namedtuple.
Following the previous example, it would look something like this:
This discussion was converted from issue #3213 on April 26, 2021 03:46.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I have noticed that PyBullet returns tuples with multiple values whenever a function provides multiple values.
For instance, in
getJointState
:The returned value would be a tuple like this one:
I wonder if this is because a specific underlying implementation decision, or if it would be worth modifying PyBullet to return a more "semantic" structure like a
namedtuple
.Following the previous example, it would look something like this:
Which, in my opinion, feels more pythonic and makes code easier to read.
Cheers!
Beta Was this translation helpful? Give feedback.
All reactions