Page 1 of 1

Defining a Kinematic Object

Posted: Thu Oct 11, 2018 11:08 pm
by zhsh
I'd like to use PyBullet to explore a toy problem with a point robot interacting with a ball.
The input to the point robot would be (dx,dy) - a direct change in its position.
When the robot hits the ball, the robot should not react, but the ball should bounce away.
Reading from other posts, the way to do this seems to be to make the robot a kinematic object and the ball a dynamic object (by default).
How can I do this in PyBullet? None of the documentation mentions creating kinematic objects.
Once I have a kinematic object, how can I adjust its position directly? (currently using constraints)

I'm currently creating the robot and ball by loading URDF files - as far as I know nothing in there can specify that the object is kinematic.
Making the robot mass infinite might accomplish what I described, but can lead to a lot of other problems (including the ball flying off to infinity).

Re: Defining a Kinematic Object

Posted: Sun Oct 14, 2018 4:05 pm
by richardbloemenkamp
I'm not sure, but I noticed that setting an objects mass to zero results in the object staying fixed to its environment. You can still change its position but apparently according to some other post if you use "resetBasePositionAndOrientation" for that it will be a none physical change: https://pybullet.org/Bullet/phpBB3/vie ... 4&t=12114

Re: Defining a Kinematic Object

Posted: Mon Oct 15, 2018 11:03 pm
by Erwin Coumans
It is recommended to use a fixed constraint and move the parent location of the fixed constraint. (Kinematic bodies are not supported in PyBullet)

Code: Select all

relativeChildPosition=[0,0,1]
relativeChildOrientation=[0,0,0,1]
hand_cid = p.createConstraint(hand,-1,-1,-1,p.JOINT_FIXED,[0,0,0],[0,0,0],relativeChildPosition,relativeChildOrientation)
Then change the position like this:

Code: Select all

p.changeConstraint(hand_cid,updatedChildPosition,updatedChildOrientation)
(optionally provide the maxForce=... in the changeConstraint to limit the maximum force by the fixed constraint.