PyBullet R2D2 Environment works but not PyBulletGym for the same model
Posted: Wed Aug 17, 2022 12:26 pm
I am trying to build upon the RaceCar environment provided in the PyBullet Tutorials, by replacing the racecar with a R2D2 model and also replacing the control of wheels by a simple differential steering logic, where the wheels on the right have 1 velocity and the ones on left have another.
On trying to implement this simple scenario individually as a PyBullet script pybullet_r2d2.py, I get the desired scenario where the robot is turning with some radius. The only actuation is feasible on wheels and no other joint. However, when I try to create a Gym environment with the exact same URDF and step() logic r2d2GymEnvTest.py, I see a weird behaviour where the head is swivelling and the gripper pole enters in and out of the body. Basically the 2 joints seem to be active despite giving no force/velocity input. I have tried forcefully setting it to 0, but no help. I also increased solver steps and decreased time step but no help again.
I am not able to identify where this difference arises from. I am attaching all my scripts for reference (it's not nicely written though). I am completely stuck. Please do let me know if there's something which I am missing!
It will be clearly visible that there is bare minimum modification from the tutorial script.
P.S. I did try to see if there is some force provided to the joints using p.enableJointForceTorqueSensor(), and it indeed shows the force/torque to be 0 for head and gripper. This makes me even more confused as to how the bodies are moving without any force.
On trying to implement this simple scenario individually as a PyBullet script pybullet_r2d2.py, I get the desired scenario where the robot is turning with some radius. The only actuation is feasible on wheels and no other joint. However, when I try to create a Gym environment with the exact same URDF and step() logic r2d2GymEnvTest.py, I see a weird behaviour where the head is swivelling and the gripper pole enters in and out of the body. Basically the 2 joints seem to be active despite giving no force/velocity input. I have tried forcefully setting it to 0, but no help. I also increased solver steps and decreased time step but no help again.
I am not able to identify where this difference arises from. I am attaching all my scripts for reference (it's not nicely written though). I am completely stuck. Please do let me know if there's something which I am missing!
It will be clearly visible that there is bare minimum modification from the tutorial script.
P.S. I did try to see if there is some force provided to the joints using p.enableJointForceTorqueSensor(), and it indeed shows the force/torque to be 0 for head and gripper. This makes me even more confused as to how the bodies are moving without any force.