XML Example: World Loader
Overview
Loads a world XML file and publishes it through RaisimServer. With no argument it loads objects/SingleBodies.xml; pass another file to load it instead. See World Configuration File for the XML format.
Screenshot
The screenshot shows heightMaps/heightMapUsingPng.xml.
Target
CMake target: xml_world_loader.
Run
Run the build-tree executable, optionally with an XML file:
bash
./build-examples/examples/xml_world_loader
./build-examples/examples/xml_world_loader heightMaps/heightMapUsingPng.xml
./build-examples/examples/xml_world_loader /absolute/path/to/world.xmlOn Windows, run xml_world_loader.exe instead. This example uses RaisimServer. Start rayrai_tcp_viewer and connect to port 8080. --help prints the usage.
Details
- Uses the argument as given if that file exists; otherwise looks for it under the
rsc/xmlScriptscopy next to the executable. It exits with an error if neither exists. - The bundled worlds under
rsc/xmlScriptsincludeobjects/,heightMaps/,material/,templatedWorld/, andwire/examples. - Constructs
raisim::Worldfrom the resolved path and publishes it throughRaisimServer.
For application code that already has a path, construct the world directly:
cpp
raisim::World world("/absolute/path/to/world.xml");