Orientation of a freejoint's body with angular velocities and enabling spin on a (table) tennis ball #3127
Unanswered
xSpaceCoder
asked this question in
Asking for Help
Replies: 1 comment
-
|
Lets see if I can get this right this time 😄 For freejoints, position, linear velocity and orientation are defined in world space. Angular velocity, angular acceleration and torque, however, is in the local body frame. So if you want topspin/backspin to have the same sign when the ball is travelling in + or - directions, you should flip the body frame around. See #691 (comment) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Intro
Hi!
I am a graduate student at University Augsburg, I use MuJoCo for my research on simulating tennis traejctories for my deep neural nentwork.
My setup
MuJoCo: 3.4.0
Python: 3.10.12
My question
Overall goal
I am trying to simulate a ball trajectory for tennis including the magnus effect based on the spin. I am simulating trajectories starting on both sides of the field and then crossing the net to and on the opponents side. I have seen that @yuvaltassa has done something similar but i didn't found how he assigned the spin values.
Current situation
When I am simulating my topspin/backspin balls from one side to the other I see the expected behaviour: The backspin ball travels further than the topspin ball.
intial angular velocity topspin (orange): [ 0 -200 0] in rad/s
intial angular velocity backspin (purple): [ 0 200 0] in rad/s
Now I am flipping the set up in order to simulate the trajectory starting from the opposide field:
I now see this result:
intial angular velocity topspin (orange): [ 0 -200 0] in rad/s
intial angular velocity backspin (purple): [ 0 200 0] in rad/s
My conclusion
Until now I thought the x-axis of the ball is the same as the direction of flight. But seeing the results I have the feeling that the coordinate system has the same orientation that the world coodinate frame but is only transposed to the center of my tennis ball.
My question
Can you explain me how the coordinate system of a freejoint geom is behaving, so that I can assign the spin (=angular velocities) correctly?
Minimal model and/or code that explain my question
This is how i assign my ngular velocities:
INIT_X_ANG_VEL_RANGE = (-50.0, 50.0)
INIT_Y_ANG_VEL_RANGE = (-500, 500.0)
INIT_Z_ANG_VEL_RANGE = (-50.0, 50.0)
w = np.zeros(3, dtype=np.float64)
w[0] = rng_py.uniform(*INIT_X_ANG_VEL_RANGE)
w[1] = rng_py.uniform(*INIT_Y_ANG_VEL_RANGE)
w[2] = rng_py.uniform(*INIT_Z_ANG_VEL_RANGE)
data.qvel[3:6] = w
XML = f"""
"""Confirmations
Beta Was this translation helpful? Give feedback.
All reactions