Skip to content
Snippets Groups Projects
Commit a9674159 authored by Fabian Reister's avatar Fabian Reister
Browse files

virtual robot reader example: updating to latest version

parent 72481ec0
No related branches found
No related tags found
No related merge requests found
......@@ -10,11 +10,7 @@
namespace armarx::robot_state
{
VirtualRobotReaderExampleClient::VirtualRobotReaderExampleClient() :
virtualRobotReader(this->memoryNameSystem())
{
}
VirtualRobotReaderExampleClient::VirtualRobotReaderExampleClient() = default;
armarx::PropertyDefinitionsPtr VirtualRobotReaderExampleClient::createPropertyDefinitions()
{
......@@ -28,8 +24,6 @@ namespace armarx::robot_state
defs->optional(properties.updateFrequency, "p.updateFrequency [Hz]",
"The frequency of the running loop.");
virtualRobotReader.registerPropertyDefinitions(defs);
return defs;
}
......@@ -47,8 +41,6 @@ namespace armarx::robot_state
void VirtualRobotReaderExampleClient::onConnectComponent()
{
virtualRobotReader.connect();
ARMARX_IMPORTANT << "Running virtual robot synchronization example.";
task = new SimpleRunningTask<>([this]()
......@@ -83,7 +75,7 @@ namespace armarx::robot_state
// The TIMING_* macros are optional, you do not need them.
TIMING_START(getRobot);
robot = virtualRobotReader.getRobot(properties.robotName, now);
robot = virtualRobotReaderPlugin->get().getRobot(properties.robotName, now);
if (robot)
{
// Only print timing once the robot is loadable & loaded.
......@@ -99,7 +91,7 @@ namespace armarx::robot_state
ARMARX_INFO << deactivateSpam(60) << "Synchronizing robot.";
TIMING_START(synchronizeRobot);
ARMARX_CHECK(virtualRobotReader.synchronizeRobot(*robot, now));
ARMARX_CHECK(virtualRobotReaderPlugin->get().synchronizeRobot(*robot, now));
TIMING_END_STREAM(synchronizeRobot, ARMARX_INFO);
......
......@@ -26,8 +26,8 @@
#include <ArmarXCore/core/Component.h>
#include <ArmarXCore/core/services/tasks/TaskUtil.h>
#include <RobotAPI/libraries/armem/client/plugins/ReaderWriterPlugin.h>
#include <RobotAPI/libraries/armem/client/plugins.h>
#include <RobotAPI/libraries/armem_robot_state/client/common/VirtualRobotReader.h>
......@@ -84,7 +84,11 @@ namespace armarx::robot_state
armarx::SimpleRunningTask<>::pointer_type task;
// The reader used to get the robot state.
armem::robot_state::VirtualRobotReader virtualRobotReader;
template <typename T>
using ReaderWriterPlugin = armem::client::plugins::ReaderWriterPlugin<T>;
ReaderWriterPlugin<armem::robot_state::VirtualRobotReader>* virtualRobotReaderPlugin =
nullptr;
// The Simox robot model.
VirtualRobot::RobotPtr robot = nullptr;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment