diff --git a/VirtualRobot/CMakeLists.txt b/VirtualRobot/CMakeLists.txt index 936be8c1f96901536641ad781f26c35557e6f965..ed462ed9483fb5b26e09bd41be563e4ae70860e5 100644 --- a/VirtualRobot/CMakeLists.txt +++ b/VirtualRobot/CMakeLists.txt @@ -375,6 +375,7 @@ SET(SOURCES XML/RobotIO.cpp XML/SceneIO.cpp + XML/mujoco/exceptions.cpp XML/mujoco/BodySanitizer.cpp XML/mujoco/DummyMassBodySanitizer.cpp XML/mujoco/MergingBodySanitizer.cpp @@ -603,6 +604,7 @@ SET(INCLUDES XML/RobotIO.h XML/SceneIO.h + XML/mujoco/exceptions.h XML/mujoco/BodySanitizer.h XML/mujoco/DummyMassBodySanitizer.h XML/mujoco/MergingBodySanitizer.h diff --git a/VirtualRobot/XML/mujoco/exceptions.cpp b/VirtualRobot/XML/mujoco/exceptions.cpp new file mode 100644 index 0000000000000000000000000000000000000000..502e90bcc4f6c3d89d5fb3d88c3972b2e7d7a5a7 --- /dev/null +++ b/VirtualRobot/XML/mujoco/exceptions.cpp @@ -0,0 +1,22 @@ +#include "exceptions.h" + + +namespace VirtualRobot::mujoco::error +{ + +NoBodyOfRobotNode::NoBodyOfRobotNode(const std::string& nodeName) : + VirtualRobotException(makeMsg(nodeName)) +{} + +std::string NoBodyOfRobotNode::makeMsg(const std::string& nodeName) +{ + return "No body of robot node " + nodeName + ". Add a node body beforehand."; +} + + +NodeIsNoJoint::NodeIsNoJoint(const std::string& nodeName) : + VirtualRobotException("Node '" + nodeName + "' is no joint node.") +{} + + +} diff --git a/VirtualRobot/XML/mujoco/exceptions.h b/VirtualRobot/XML/mujoco/exceptions.h new file mode 100644 index 0000000000000000000000000000000000000000..b4dda1752eba8ccef2130a25b77108710055e2e1 --- /dev/null +++ b/VirtualRobot/XML/mujoco/exceptions.h @@ -0,0 +1,27 @@ +#pragma once + +#include <VirtualRobot/VirtualRobotException.h> + + +namespace VirtualRobot::mujoco::error +{ + + /// Indicates that no body exists or has been added for a robot node. + class NoBodyOfRobotNode : public VirtualRobotException + { + public: + NoBodyOfRobotNode(const std::string& nodeName); + private: + static std::string makeMsg(const std::string& nodeName); + }; + + + /// Indicates that a robot node has to be a joint node, but is not. + class NodeIsNoJoint : public VirtualRobotException + { + public: + NodeIsNoJoint(const std::string& nodeName); + }; + + +}