Page 1 of 1

Retrieve Heightfield from p.GEOM_HEIGHTFIELD

Posted: Wed Oct 14, 2020 8:26 pm
by utkarshmishra04
Hi,
I am quite new to pybullet and I was wondering if I could retrieve the heightfield data which I used to generate the p.createCollisionShape() object.

Code: Select all

if heightfieldSource==useTerrainFromPNG:
  terrainShape = p.createCollisionShape(shapeType = p.GEOM_HEIGHTFIELD, meshScale=[.02,.02,2.4],fileName = "heightmaps/wm_height_out.png")
  textureId = p.loadTexture("heightmaps/gimp_overlay_out.png")
  terrain  = p.createMultiBody(0, terrainShape)
  p.changeVisualShape(terrain, -1, textureUniqueId = textureId)
  p.resetBasePositionAndOrientation(terrain,[0.2,0.5,0.12], [0,0,0,1])
  p.changeVisualShape(terrain, -1, rgbaColor=[1,1,1,1])
This is a code from the heightfield pybullet tutorial,
I wanted a matrix of heights with respect to my robot's current position and orientation.
Will that be possible anyhow?

Re: Retrieve Heightfield from p.GEOM_HEIGHTFIELD

Posted: Thu Oct 15, 2020 2:00 pm
by jwhitman
I've been using rayTestBatch to get that sort of data. If you find another way, I am also interested in it.

Re: Retrieve Heightfield from p.GEOM_HEIGHTFIELD

Posted: Thu Oct 15, 2020 4:04 pm
by utkarshmishra04
Hi, thanks
For now, I did the same and I am looking for further ways of doing the same