26 #include <Eigen/Geometry>
28 #include <IceUtil/Time.h>
30 #include <SimoxUtility/math/pose/pose.h>
31 #include <VirtualRobot/Robot.h>
32 #include <VirtualRobot/VirtualRobot.h>
33 #include <VirtualRobot/XML/RobotIO.h>
65 defs->optional(p.updateFrequency,
"updateFrequency",
"Memory update frequency (write).");
66 defs->optional(p.robot.package,
"robot.package",
"");
67 defs->optional(p.robot.path,
"robot.path",
"");
75 return "VirtualRobotWriterExample";
106 VirtualRobotWriterExample::loadRobot()
const
108 auto robot = VirtualRobot::RobotIO::loadRobot(
110 VirtualRobot::RobotIO::eStructure);
117 if (robot ==
nullptr)
121 if (robot ==
nullptr)
129 ARMARX_CHECK(virtualRobotWriterPlugin->get().storeDescription(*robot));
132 const float t =
float((now - start).toSecondsDouble());
135 const float m = (1 + std::sin(t / (M_2_PI * 10))) / 2;
137 auto jointValues = robot->getJointValues();
138 for (
auto& [k,
v] : jointValues)
140 const auto node = robot->getRobotNode(k);
142 if (node->isLimitless())
147 v = node->getJointLimitLow() +
148 (node->getJointLimitHigh() - node->getJointLimitLow()) * m;
151 robot->setGlobalPose(simox::math::pose(Eigen::Vector3f(1000, 0, 0)));
152 robot->setJointValues(jointValues);