Skip to content

raisim::HeightMapVisual ​

struct · #include <raisim/server/Visuals.hpp>

Visual-only height map (no physics) streamed by RaisimServer. Create with RaisimServer::addVisualHeightMap(); the server owns it. The constructors forward their arguments to the matching raisim::HeightMap constructor.

Constructors & destructor ​

HeightMapVisual ​

cpp
HeightMapVisual(const std::string &fileName, double centerX, double centerY)

Parameters

ParameterDescription
fileName (in)raisim height-map text file
centerX (in)x coordinate of the center
centerY (in)y coordinate of the center
cpp
HeightMapVisual(
    const std::string &pngFileName,
    double centerX,
    double centerY,
    double xScale,
    double yScale,
    double heightScale,
    double heightOffset)

Parameters

ParameterDescription
pngFileName (in)png image whose pixel values define the heights
centerX (in)x coordinate of the center
centerY (in)y coordinate of the center
xScale (in)size along x
yScale (in)size along y
heightScale (in)scale from pixel value to height
heightOffset (in)height of the 0-value pixel
cpp
HeightMapVisual(
    double centerX,
    double centerY,
    TerrainProperties &terrainProperties)

Parameters

ParameterDescription
centerX (in)x coordinate of the center
centerY (in)y coordinate of the center
terrainProperties (in)procedural terrain parameters
cpp
HeightMapVisual(
    size_t xSamples,
    size_t ysamples,
    double xSize,
    double ySize,
    double centerX,
    double centerY,
    const std::vector<double> &heightIn)

Parameters

ParameterDescription
xSamples (in)number of samples along x
ysamples (in)number of samples along y
xSize (in)size along x
ySize (in)size along y
centerX (in)x coordinate of the center
centerY (in)y coordinate of the center
heightIn (in)heights, xSamples * ysamples values

~HeightMapVisual ​

cpp
~HeightMapVisual() = default

Public member functions ​

setColor ​

cpp
void setColor(double r, double g, double b, double a)

Parameters

ParameterDescription
r (in)red value (max=1)
g (in)green value (max=1)
b (in)blue value (max=1)
a (in)alpha value (max=1) Store an RGBA color in color. Note: the server currently does not transmit color for height maps, so this has no visible effect; use the per-vertex overload instead.
cpp
void setColor(const std::vector<raisim::ColorRGB> &color)

Set per-vertex colors (forwards to HeightMap::setColor()). An empty vector disables them.

Parameters

ParameterDescription
color (in)one color per height sample, or empty

update ​

cpp
void update(
    double centerX,
    double centerY,
    double sizeX,
    double sizeY,
    const std::vector<double> &height)

Replace the heights and placement (forwards to HeightMap::update()). The sample counts must not change.

Parameters

ParameterDescription
centerX (in)x coordinate of the center
centerY (in)y coordinate of the center
sizeX (in)size along x
sizeY (in)size along y
height (in)new heights (row-major), same count as before

lockMutex ​

cpp
void lockMutex()

Lock this height map's mutex. The server holds it while serializing this height map, so lock it while modifying the height map from another thread. Same as lock().

lock ​

cpp
void lock()

Lock the mutex (BasicLockable interface for std::lock_guard / std::unique_lock).

try_lock ​

cpp
bool try_lock()

Returns true if the mutex was acquired without blocking (Lockable interface).

unlockMutex ​

cpp
void unlockMutex()

Unlock the mutex locked by lockMutex(). Same as unlock().

unlock ​

cpp
void unlock()

Unlock the mutex (BasicLockable interface).

Public attributes ​

color ​

cpp
raisim::Vec<4> color

RGBA color set by addVisualHeightMap()/setColor(). Currently not transmitted to the visualizer.

obj ​

cpp
raisim::HeightMap obj

Height map object used for visualization.

RaiSim — physics for robotics and AI.