bulletphysics / bullet3

Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.
http://bulletphysics.org
Other
12.36k stars 2.85k forks source link

Pybullet - Segfault in p.calculateJacobian() #4396

Closed DanSJohnson closed 1 year ago

DanSJohnson commented 1 year ago

Hi everyone,

I'm having issues where my calls to p.calculateJacobian() result in a segmentation fault. The code to recreate this is:

import pybullet as p
import numpy as np

phyID=p.connect(p.DIRECT)

robot_path='/basics/models/robot.urdf'
robotId = p.loadURDF(robot_path, flags=p.URDF_USE_SELF_COLLISION, physicsClientId=phyID)
p.stepSimulation()

jacobian=p.calculateJacobian(robotId, 7, [0, 0, 0], np.zeros(18) ,np.zeros(18),np.zeros(18), physicsClientId=phyID)

This results in the terminal output:

pybullet build time: May 20 2022 19:41:54
Segmentation fault (core dumped)

with no further information.

I am using pybullet version 3.17, python version 3.6.9 and im running the whole thing via a WSL install of Ubuntu 18.04.5 LTS.

Any assistance would be greatly appreciated!

DanSJohnson commented 1 year ago

Ok, I think i've found the source of the problem, it seems that using numpy arrays has somehow caused the seg fault?

When i replace the line: jacobian=p.calculateJacobian(robotId, 7, [0, 0, 0], np.zeros(18) ,np.zeros(18),np.zeros(18), physicsClientId=phyID) with: jacobian =p.calculateJacobian(robotId, 7, [0, 0, 0], np.zeros(18).tolist(), np.zeros(18).tolist(), np.zeros(18).tolist(), physicsClientId=phyID) I dont get a fault, and I am assuming that the result is indeed the correct jacobian.