How to get body acceleration?

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
miker2
Posts: 3
Joined: Thu Apr 09, 2020 10:36 pm

How to get body acceleration?

Post by miker2 »

I've looked over the PyBullet user guide and can't seem to find a solution to this question. Is there an accessor for the linear acceleration of a body?

Specifically I'd like the linear acceleration of the base link.
I see the `getBasePositionAndOrientatiion` & `getBaseVelocity(model)` methods, but I see no method for accessing the acceleration of the base (or any other link).
tayalmanan
Posts: 4
Joined: Thu Apr 23, 2020 2:36 am
Location: Surat, India

Re: How to get body acceleration?

Post by tayalmanan »

Hi,
you can use while loop to accelerate the bot in a way you want.
For example,

Code: Select all

while True:
    cubePos, cubeOrn = p.getBasePositionAndOrientation(bot)
    cubeEuler = p.getEulerFromQuaternion(cubeOrn)  
    dv = k*cubeEuler[0]
   p.stepSimulation()
Hope this helps!!! :P
miker2
Posts: 3
Joined: Thu Apr 09, 2020 10:36 pm

Re: How to get body acceleration?

Post by miker2 »

Thanks for the reply, but not quite what I'm looking for. I'm controlling the robot (using joint controllers) and I want to be able to get the acceleration of the base due to the dynamics. I can take a backwards difference of the velocities from one timestep to another, but I was hoping that there was a method to access the accelerations directly.
Post Reply