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
structCollider — One collision shape, posed in the asset's local frame.structInstanceOptions — Placement and physics options of one instance (see instantiate()).
Public member functions
save
void save(const std::filesystem::path &file) constWrite 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
| Parameter | Description |
|---|---|
file (in) | output path with the .rasset extension |
instantiate
std::vector<SingleBodyObject *> instantiate(
World &world,
const InstanceOptions &options) constCreate 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
| Parameter | Description |
|---|---|
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
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") constAdd hidden static physics proxies at a uniformly scaled, Z-yawed instance pose.
Parameters
| Parameter | Description |
|---|---|
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
static bool isDescriptorPath(const std::filesystem::path &path)Parameters
| Parameter | Description |
|---|---|
path (in) | file path |
Returns true if the path has the .rasset extension
load static
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
| Parameter | Description |
|---|---|
file (in) | path to the .rasset file |
Returns the loaded asset
Public attributes
visualMesh
std::filesystem::path visualMeshVisual mesh file.
colliders
std::vector<Collider> collidersCollision shapes (at least one).