Changing Pybullet connection from GUI to DIRECT breaks the robot control

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
srkiyengar
Posts: 3
Joined: Tue Aug 25, 2020 6:55 pm

Changing Pybullet connection from GUI to DIRECT breaks the robot control

Post by srkiyengar »

Hi Guys,

I have a working code with GUI connection where SetJointMotorControlArray() is used to change the position and orientation of the joints in position control mode. It works well and the changes can be confirmed by the position/orientation from getlinkState() and the joint state information from getJointstate().

When I change the connection to DIRECT, I suspect that SetJointMotorControlArray() is not working at all. The getJointstate() returns tuple with all 0.0. Also the getLinkstate() doesn't show any change.

Any ideas or suggestions or thoughts on what factors might influence the change in Pybullet behaviour from GUI to DIRECT.

Thanks.
srkiyengar
Posts: 3
Joined: Tue Aug 25, 2020 6:55 pm

Re: Changing Pybullet connection from GUI to DIRECT breaks the robot control

Post by srkiyengar »

The issue is resolved, an error on my part. I had the p.stepSimulation() in the wrong place..
mat
Posts: 2
Joined: Mon Jul 19, 2021 1:06 pm

Re: Changing Pybullet connection from GUI to DIRECT breaks the robot control

Post by mat »

Dear @Srkiyengar,
I have the same Problem. Everything is working fine in GUI mode but it is not controlling the robot in DIRECT mode.
Do you have an example code how you have solved your problem?
cemr
Posts: 2
Joined: Thu Mar 24, 2022 2:49 pm

Re: Changing Pybullet connection from GUI to DIRECT breaks the robot control

Post by cemr »

@mat

When using DIRECT mode, you need to manually call p.stepSimulation() in your main loop - I had the same issue, and this is what resolved it for me.

Hope this helps!
Post Reply