How to clone a vehicle's state?

I want to create a bullet vehicle node which has the same states of a given bullet vehicle. The states include position, speed and so on. They are nearly the same, except mask bit (I don’t want them to collide with each other of course).
I found that I can only set position but not speed given bullet vehicle’s API. I also tried ‘copy.deepcopy()’ but the object can not be pickled. Is there any possible solution?

Yes, it seems a weird requirement. Actually, I am using Model Predictive Control to implement modular auto-driving in bullet and panda3d. I have to have a ‘virtual’ car that share the same state at time t as the ego vehicle. So that I can search for the optimal control based on the virtual car.

It looks like Bullet sets the current speed value to the linear velocity of the chassis:


This is the only place where it is set. Bullet offers no way to override this value directly.

Thx for the reply. It is easy to get the status (e.g. speed) of a vehicle, but I want to set the speed of a vehicle.
For example, I use the API you have shown and get vehicle A’s speed. Then I want to set vehicle B’s speed the same as A. Do you know any API that can do this thing?

As shown above you need to copy the linear velocity of the rigid body directly since that is where the speed is derived from.