Skip to content
Snippets Groups Projects
Commit ac8962d7 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Add reset()

parent 3fa9a1e7
No related branches found
No related tags found
No related merge requests found
......@@ -54,10 +54,25 @@ ActuatorType toActuatorType(const std::string& string)
RobotMjcf::RobotMjcf(RobotPtr robot) : robot(robot)
{
reset();
}
void RobotMjcf::reset()
{
document.reset(new mjcf::Document());
robotBody = mjcf::Body();
nodeBodies.clear();
// Set model name.
document->setModelName(robot->getName());
const std::string className = robot->getName();
// Add robot defaults class.
document->default_().addClass(className);
// Add robot body.
robotBody = document->worldbody().addBody(robot->getName(), robot->getName());
robotBody = document->worldbody().addBody(robot->getName(), className);
nodeBodies[robot->getName()] = robotBody;
}
......
......@@ -31,6 +31,9 @@ namespace VirtualRobot::mujoco
RobotMjcf(RobotPtr robot);
/// Reset the document and related data.
void reset();
/// Get the document.
mjcf::Document& getDocument();
const mjcf::Document& getDocument() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment