VirtualRobotWriter.cpp
Go to the documentation of this file.
1 #include "VirtualRobotWriter.h"
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
35  {
37  }
38 
40  resolvePackagePath(const std::string& filename)
41  {
42  const static auto packages = armarx::CMakePackageFinder::FindAllArmarXSourcePackages();
44  return packagePath;
45  }
46 
47  bool
49  const armem::Time& timestamp)
50  {
51  const auto filename = robot.getFilename();
52 
53  // FIXME maybe visu and info optional?
54  const description::RobotDescription desc{.name = robot.getType(),
56  .visualization = {},
57  .info = {}};
58 
59  return RobotWriter::storeDescription(desc, timestamp);
60  }
61 
62  bool
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
armarx::armem::robot_state::VirtualRobotWriter::storeState
bool storeState(const VirtualRobot::Robot &robot, const armem::Time &timestamp)
Definition: VirtualRobotWriter.cpp:63
armarx::armem::robot_state::description::RobotDescription
Definition: types.h:44
armarx::CMakePackageFinder::FindAllArmarXSourcePackages
static std::vector< std::string > FindAllArmarXSourcePackages()
Definition: CMakePackageFinder.cpp:438
armarx::armem::robot_state::RobotState
Definition: types.h:113
forward_declarations.h
constants.h
armarx::armem::robot_state
Definition: RobotStatePredictionClient.cpp:42
armarx::ArmarXDataPath::getProject
static std::string getProject(const std::vector< std::string > &projects, const std::string &relativeFilename)
Definition: ArmarXDataPath.cpp:301
armarx::armem::robot_state::constants::robotRootNodeName
const std::string robotRootNodeName
Definition: constants.h:36
armarx::armem::robot_state::RobotState::timestamp
DateTime timestamp
Definition: types.h:118
Clock.h
armarx::armem::robot_state::RobotWriter::storeState
bool storeState(const RobotState &state, const std::string &robotTypeName, const std::string &robotName, const std::string &robotRootNodeName) override
Definition: RobotWriter.cpp:179
armarx::armem::robot_state::VirtualRobotWriter::storeDescription
bool storeDescription(const VirtualRobot::Robot &robot, const armem::Time &timestamp=armem::Time::Invalid())
Definition: VirtualRobotWriter.cpp:48
armarx::armem::robot_state::RobotWriter::connect
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
Definition: RobotWriter.cpp:49
armarx::armem::human::Robot
@ Robot
Definition: util.h:14
filename
std::string filename
Definition: VisualizationRobot.cpp:83
armarx::armem::robot_state::VirtualRobotWriter::registerPropertyDefinitions
void registerPropertyDefinitions(::armarx::PropertyDefinitionsPtr &def)
Definition: VirtualRobotWriter.cpp:34
types.h
armarx::armem::robot_state::VirtualRobotWriter::~VirtualRobotWriter
~VirtualRobotWriter() override
armarx::armem::robot_state::resolvePackagePath
PackagePath resolvePackagePath(const std::string &filename)
Definition: VirtualRobotWriter.cpp:40
VirtualRobotWriter.h
armarx::armem::robot_state::RobotWriter::storeDescription
bool storeDescription(const description::RobotDescription &description, const armem::Time &timestamp=armem::Time::Invalid()) override
Definition: RobotWriter.cpp:67
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
CMakePackageFinder.h
armarx::armem::robot_state::RobotState::Pose
Eigen::Isometry3f Pose
Definition: types.h:116
armarx::armem::robot_state::description::RobotDescription::name
std::string name
Definition: types.h:48
armarx::armem::robot_state::VirtualRobotWriter::connect
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
Definition: VirtualRobotWriter.cpp:27
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:69
Logging.h
armarx::armem::robot_state::RobotWriter::registerPropertyDefinitions
void registerPropertyDefinitions(::armarx::PropertyDefinitionsPtr &def)
Definition: RobotWriter.cpp:44
ArmarXDataPath.h
armarx::PackagePath
Definition: PackagePath.h:55
PackagePath.h