Link number limit in createVisualShapeArray

Post Reply
everglow0214
Posts: 2
Joined: Thu May 19, 2022 11:36 am

Link number limit in createVisualShapeArray

Post by everglow0214 »

Hello everyone. Is there a limit of number of links in function createVisualShapeArray? I want to add some visualization of occupancy grid map in PyBullet. However, only a few grids can be shown. Here are my codes, where the variable grid_map is a 3-dimensional numpy array.

Code: Select all

ground_idxs = np.argwhere(grid_map[0:1,:] >= 50)
num_ground_idxs = ground_idxs.shape[0]
        
shapeTypes_ground = [p.GEOM_BOX for _ in range(num_ground_idxs)]
half_size = [resolution/2, resolution/2, resolution/2]
halfExtents_ground = [half_size for _ in range(num_ground_idxs)]
visualFramePositions_ground =\
    (np.flip(ground_idxs,axis=1) + 0.5) * resolution + np.array(bbx_min)
visualGroundId = p.createVisualShapeArray(
    shapeTypes = shapeTypes_ground,
    halfExtents = halfExtents_ground,
    visualFramePositions = visualFramePositions_ground.tolist()
)

mb_id = p.createMultiBody(
    baseMass = 0,
    baseVisualShapeIndex = visualGroundId,
    basePosition = [0,0,0]
)
p.changeVisualShape(mb_id, -1, rgbaColor=[0, 0.5, 0, 0.5])
The grid map is in the order of Z-Y-X. In this code, I would like to plot the grids that indicate the ground. So I used

Code: Select all

np.argwhere(grid_map[0:1,:] >= 50)
The size of ground_idxs is 563. But only less than 20 grids are shown properly.

Thanks~
everglow0214
Posts: 2
Joined: Thu May 19, 2022 11:36 am

Re: Link number limit in createVisualShapeArray

Post by everglow0214 »

Here is the result of the codes above.
Attachments
pybullet_question.png
pybullet_question.png (34 KiB) Viewed 306 times
Post Reply