24 #include <SimoxUtility/json/json.hpp>
25 #include <VirtualRobot/Robot.h>
26 #include <VirtualRobot/XML/RobotIO.h>
49 defs->optional(properties.oneShot,
"p.oneShot",
"If true, commit once after connecting, then stop.");
50 defs->optional(properties.updateFrequency,
"p.updateFrequency",
"Memory update frequency (write).");
52 defs->optional(properties.robot.name,
"p.robot.name",
53 "Optional override for the robot name. If not set, the default name from the robot model is used.");
54 defs->optional(properties.robot.package,
"p.robot.package",
"Package of the Simox robot XML.");
55 defs->optional(properties.robot.path,
"p.robot.path",
"Local path of the Simox robot XML.");
57 defs->optional(properties.robot.jointValues,
"p.robot.jointValues",
"Specify a certain joint configuration.");
59 defs->optional(properties.robot.globalPositionX,
"p.robot.globalPositionX",
"");
60 defs->optional(properties.robot.globalPositionY,
"p.robot.globalPositionY",
"");
61 defs->optional(properties.robot.globalPositionYaw,
"p.robot.globalPositionYaw",
"");
69 return "SimpleVirtualRobot";
103 if (p.package.empty() or p.path.empty())
106 <<
"Please specify the Simox robot XMl file in the properties.";
114 VirtualRobot::RobotIO::loadRobot(path.toSystemPath(), VirtualRobot::RobotIO::eStructure);
118 if(not p.jointValues.empty())
122 const nlohmann::json j = nlohmann::json::parse(p.jointValues);
125 std::map<std::string, float> jointValues;
128 ARMARX_VERBOSE <<
"The following joint values are given by the user: " << jointValues;
129 robot->setJointValues(jointValues);
132 const Eigen::Isometry3f global_T_robot = Eigen::Translation3f{properties.robot.globalPositionX, properties.robot.globalPositionY, 0} * Eigen::AngleAxisf{properties.robot.globalPositionYaw, Eigen::Vector3f::UnitZ()};
133 robot->setGlobalPose(global_T_robot.matrix());
135 if (not p.name.empty())
137 robot->setName(p.name);
149 while (task and not task->isStopped())
151 if (robot ==
nullptr)
153 robot = loadRobot(properties.robot);
156 ARMARX_INFO <<
"Start to commit robot '" << robot->getName()
157 <<
"' to the robot state memory.";
169 bool success = virtualRobotWriterPlugin->get().storeDescription(*robot, now);
172 success = virtualRobotWriterPlugin->get().storeState(*robot, now);
177 if (properties.oneShot)