Retrieve Heightfield from p.GEOM_HEIGHTFIELD

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
utkarshmishra04
Posts: 3
Joined: Wed Oct 14, 2020 11:43 am

Retrieve Heightfield from p.GEOM_HEIGHTFIELD

Post 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?
jwhitman
Posts: 4
Joined: Fri Sep 25, 2020 1:49 pm

Re: Retrieve Heightfield from p.GEOM_HEIGHTFIELD

Post by jwhitman »

I've been using rayTestBatch to get that sort of data. If you find another way, I am also interested in it.
utkarshmishra04
Posts: 3
Joined: Wed Oct 14, 2020 11:43 am

Re: Retrieve Heightfield from p.GEOM_HEIGHTFIELD

Post by utkarshmishra04 »

Hi, thanks
For now, I did the same and I am looking for further ways of doing the same
Post Reply