Setting initial velocity & angular velocity in pybullet?

Post Reply
rebcabin
Posts: 3
Joined: Thu Jul 27, 2017 7:45 pm

Setting initial velocity & angular velocity in pybullet?

Post by rebcabin » Thu Jul 27, 2017 7:58 pm

Please consider the sample "restitution.py" in the distribution folder "examples/pybullet/examples." In this example, the ball drops from an initial height 2, over dead center [0, 0], which we set with the python code

sphere = p.loadURDF("sphere_with_restitution", [0, 0, 2])

The ball starts with no initial velocity or initial angular velocity. I would like to add those at the script level or in the URDF file, but I am having a devil of a time finding documentation or examples of how to add them. I know I can input velocity and angular velocity from the GUI by grabbing the object with the mouse and throwing it, but I need to add velocity and angular velocity inputs FROM THE SCRIPT so that I can develop controllers, for example.

I went through a lot of examples, and could not find one that gave the object an initial velocity or angular velocity.

I *am* willing to go to the C++ level, or even the TCP / UDP level, if that's what's necessary to "programmatically" inject velocities and angular velocities, but surely this must be possible from the Python level?

This is my first time using Bullet, so please excuse my ignorance and do help me!

Post Reply