Skip to content

raisim::Rasset ​

struct · #include <raisim/Rasset.hpp>

A reusable visual asset with collision shapes in the visual's local frame. .rasset files are XML; paths are relative to the descriptor, not the process. The format is a <rasset version="1"> root with exactly one <visual file="..."/> and at least one <collision type="..." .../> element. All methods throw on invalid input.

Nested classes ​

  • struct Collider — One collision shape, posed in the asset's local frame.
  • struct InstanceOptions — Placement and physics options of one instance (see instantiate()).

Public member functions ​

save ​

cpp
void save(const std::filesystem::path &file) const

Write an editable descriptor, preserving mesh references relative to it. Throws std::invalid_argument if the asset is invalid or a mesh is missing, std::runtime_error if writing fails.

Parameters

ParameterDescription
file (in)output path with the .rasset extension

instantiate ​

cpp
std::vector<SingleBodyObject *> instantiate(
    World &world,
    const InstanceOptions &options) const

Create hidden collision bodies at a uniformly scaled instance pose. A non-static instance must have exactly one collider. Throws std::invalid_argument on invalid options.

Parameters

ParameterDescription
world (in, out)world that receives (and owns) the bodies
options (in)instance pose, scale and physics options

Returns the created bodies, in collider order

addStaticColliders ​

cpp
std::vector<SingleBodyObject *> addStaticColliders(
    World &world,
    const std::array<double, 3> &position,
    double yaw,
    double scale,
    const std::string &name={},
    const std::string &material="default") const

Add hidden static physics proxies at a uniformly scaled, Z-yawed instance pose.

Parameters

ParameterDescription
world (in, out)world that receives (and owns) the bodies
position (in)instance position in the world frame (m)
yaw (in)rotation about the world z axis (rad)
scale (in)uniform scale
name (in)name of the first body (see InstanceOptions::name)
material (in)contact material

Returns the created bodies, in collider order

Static member functions ​

isDescriptorPath static ​

cpp
static bool isDescriptorPath(const std::filesystem::path &path)

Parameters

ParameterDescription
path (in)file path

Returns true if the path has the .rasset extension

load static ​

cpp
static Rasset load(const std::filesystem::path &file)

Read a descriptor. Referenced files must exist; their paths are resolved against the descriptor's directory. Throws std::runtime_error on a malformed file.

Parameters

ParameterDescription
file (in)path to the .rasset file

Returns the loaded asset

Public attributes ​

visualMesh ​

cpp
std::filesystem::path visualMesh

Visual mesh file.

colliders ​

cpp
std::vector<Collider> colliders

Collision shapes (at least one).

RaiSim — physics for robotics and AI.