Save/restore object State with Planar Joint?

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
dr_innovation
Posts: 2
Joined: Mon Oct 04, 2021 7:41 pm

Save/restore object State with Planar Joint?

Post by dr_innovation »

We are struggling to save/restore an object state. I've read many threads here and can save restorte everything prperly except for one key joint. It is a planar joint and the code provided to us get its state with pos,vel, jrf, aJMT = p.getJointStateMultiDof(self.cartpole, 0) but when we try to reset it with
p.resetJointStateMultiDof(self.cartpole, 0, targetValue=cart_pos, targetVelocity=cart_vel)
it does not change. I've tried many other ways to reset it but so far nothing worked.

The project is using a variation of cartpole plus plus. The cart is connected to the ground plane via this planar joint, and the documentation says very little about how planar joints work or are used. When I asked about it the project designers said they could not get the above reset to work but since they just wanted a random start state used a hack of applying a random initial force. But we need to reset it back to an known given state so cannot use that hack.

In this rather old thread,
viewtopic.php?f=24&t=12828&p=42540&hili ... int#p42540
It says planar joints are not supported. Is that still the case? they clearly work somewhat (the cart moves and the joint positions update), so anyone know how to reset a a planar joint to a specific setting? (Edit: I know this destroys the simulation but that is fine, we want to restart it from that known state).


If I have to hack the pybullet.c to make it work any hints?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Save/restore object State with Planar Joint?

Post by Erwin Coumans »

I've never used planar joint, do you have a small example urdf and little pybullet script (attach a zip file).
dr_innovation
Posts: 2
Joined: Mon Oct 04, 2021 7:41 pm

Re: Save/restore object State with Planar Joint?

Post by dr_innovation »

Erwin Coumans wrote: Wed Oct 06, 2021 4:02 pm I've never used planar joint, do you have a small example urdf and little pybullet script (attach a zip file).
I can make one up, but I've already done a fork and have fixed many of the issues in the c/c++ code, at least to get my examples working. In many places ePlanar is in a switch with nothing or not even considered in aspects of the code so I added code based on other cases. In other places it was just not right so I tried to fix it but made it very specific to our problem figuring someone that knows more about the overall structure would be better suited to see if they were general fixes or just a hack. After I get it all working Will do some more testing and then post the results/changes I needed for feedback.
Post Reply