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>
53 "VirtualRobotWriterExample");
70 defs->optional(p.updateFrequency,
"updateFrequency",
"Memory update frequency (write).");
71 defs->optional(p.robot.package,
"robot.package",
"");
72 defs->optional(p.robot.path,
"robot.path",
"");
80 return "VirtualRobotWriterExample";
111 VirtualRobotWriterExample::loadRobot()
const
113 auto robot = VirtualRobot::RobotIO::loadRobot(
115 VirtualRobot::RobotIO::eStructure);
122 if (robot ==
nullptr)
126 if (robot ==
nullptr)
134 ARMARX_CHECK(virtualRobotWriterPlugin->get().storeDescription(*robot));
137 const float t =
float((now - start).toSecondsDouble());
140 const float m = (1 + std::sin(t / (M_2_PI * 10))) / 2;
142 auto jointValues = robot->getJointValues();
143 for (
auto& [k, v] : jointValues)
145 const auto node = robot->getRobotNode(k);
147 if (node->isLimitless())
152 v = node->getJointLimitLow() +
153 (node->getJointLimitHigh() - node->getJointLimitLow()) * m;
156 robot->setGlobalPose(simox::math::pose(Eigen::Vector3f(1000, 0, 0)));
157 robot->setJointValues(jointValues);
#define ARMARX_REGISTER_COMPONENT_EXECUTABLE(ComponentT, applicationName)
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...
Brief description of class VirtualRobotWriterExample.
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.