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);
static DateTime Now()
Current time on the virtual clock.
Default component property definition container.
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
PluginT * addPlugin(const std::string prefix="", ParamsT &&... params)
static std::filesystem::path toSystemPath(const data::PackagePath &pp)
The periodic task executes one thread method repeatedly using the time period specified in the constr...
void onInitComponent() override
Pure virtual hook for the subclass.
void onDisconnectComponent() override
Hook for subclass.
VirtualRobotWriterExample()
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onConnectComponent() override
Pure virtual hook for the subclass.
void onExitComponent() override
Hook for subclass.
std::string getDefaultName() const override
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
std::shared_ptr< class Robot > RobotPtr
armarx::core::time::DateTime Time
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.