24 #include <SimoxUtility/json/json.hpp>
25 #include <VirtualRobot/Robot.h>
26 #include <VirtualRobot/XML/RobotIO.h>
50 properties.oneShot,
"p.oneShot",
"If true, commit once after connecting, then stop.");
52 properties.updateFrequency,
"p.updateFrequency",
"Memory update frequency (write).");
54 defs->optional(properties.robot.name,
56 "Optional override for the robot name. If not set, the default name from "
57 "the robot model is used.");
59 properties.robot.package,
"p.robot.package",
"Package of the Simox robot XML.");
60 defs->optional(properties.robot.path,
"p.robot.path",
"Local path of the Simox robot XML.");
62 defs->optional(properties.robot.jointValues,
63 "p.robot.jointValues",
64 "Specify a certain joint configuration.");
66 defs->optional(properties.robot.globalPositionX,
"p.robot.globalPositionX",
"");
67 defs->optional(properties.robot.globalPositionY,
"p.robot.globalPositionY",
"");
68 defs->optional(properties.robot.globalPositionYaw,
"p.robot.globalPositionYaw",
"");
76 return "SimpleVirtualRobot";
105 if (p.package.empty() or p.path.empty())
108 <<
"Please specify the Simox robot XMl file in the properties.";
116 path.toSystemPath(), VirtualRobot::RobotIO::eStructure);
120 if (not p.jointValues.empty())
124 const nlohmann::json j = nlohmann::json::parse(p.jointValues);
127 std::map<std::string, float> jointValues;
130 ARMARX_VERBOSE <<
"The following joint values are given by the user: " << jointValues;
131 robot->setJointValues(jointValues);
134 const Eigen::Isometry3f global_T_robot =
135 Eigen::Translation3f{
136 properties.robot.globalPositionX, properties.robot.globalPositionY, 0} *
137 Eigen::AngleAxisf{properties.robot.globalPositionYaw, Eigen::Vector3f::UnitZ()};
138 robot->setGlobalPose(global_T_robot.matrix());
140 if (not p.name.empty())
142 robot->setName(p.name);
153 while (task and not task->isStopped())
155 if (robot ==
nullptr)
157 robot = loadRobot(properties.robot);
160 ARMARX_INFO <<
"Start to commit robot '" << robot->getName()
161 <<
"' to the robot state memory.";
173 bool success = virtualRobotWriterPlugin->get().storeDescription(*robot, now);
176 success = virtualRobotWriterPlugin->get().storeState(*robot, now);
181 if (properties.oneShot)