VirtualRobotWriter.cpp
Go to the documentation of this file.
2
3#include <optional>
4#include <thread>
5
6#include <VirtualRobot/Robot.h>
7#include <VirtualRobot/VirtualRobot.h>
8#include <VirtualRobot/XML/RobotIO.h>
9
15
18
19#include "constants.h"
20
22{
23
25
26 void
28 {
29 RobotWriter::connect(memoryNameSystem);
30 }
31
32 // TODO(fabian.reister): register property defs
33 void
38
40 resolvePackagePath(const std::string& filename)
41 {
43 PackagePath packagePath(armarx::ArmarXDataPath::getProject(packages, filename), filename);
44 return packagePath;
45 }
46
47 bool
48 VirtualRobotWriter::storeDescription(const VirtualRobot::Robot& robot,
50 {
51 const auto filename = robot.getFilename();
52
53 // FIXME maybe visu and info optional?
54 const description::RobotDescription desc{.name = robot.getType(),
55 .xml = resolvePackagePath(filename),
56 .visualization = {},
57 .info = {}};
58
60 }
61
62 bool
63 VirtualRobotWriter::storeState(const VirtualRobot::Robot& robot, const armem::Time& timestamp)
64 {
65 const RobotState robotState{.timestamp = timestamp,
66 .globalPose = RobotState::Pose(robot.getGlobalPose()),
67 .jointMap = robot.getJointValues(),
68 .proprioception = std::nullopt};
69
71 robotState,
72 robot.getType(),
73 robot.getName(),
74 constants::robotRootNodeName /*robot.getRootNode()->getName()*/);
75 }
76
77
78} // namespace armarx::armem::robot_state
std::string timestamp()
static std::string getProject(const std::vector< std::string > &projects, const std::string &relativeFilename)
static std::vector< std::string > FindAllArmarXSourcePackages()
The memory name system (MNS) client.
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
void registerPropertyDefinitions(::armarx::PropertyDefinitionsPtr &def)
bool storeDescription(const description::RobotDescription &description, const armem::Time &timestamp=armem::Time::Invalid()) override
bool storeState(const RobotState &state, const std::string &robotTypeName, const std::string &robotName, const std::string &robotRootNodeName) override
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
void registerPropertyDefinitions(::armarx::PropertyDefinitionsPtr &def)
bool storeState(const VirtualRobot::Robot &robot, const armem::Time &timestamp)
bool storeDescription(const VirtualRobot::Robot &robot, const armem::Time &timestamp=armem::Time::Invalid())
PackagePath resolvePackagePath(const std::string &filename)
armarx::core::time::DateTime Time
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.