VirtualRobotReader.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @author Fabian Reister ( fabian dot reister at kit dot edu )
17  * @date 2021
18  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19  * GNU General Public License
20  */
21 
22 #pragma once
23 
24 #include <VirtualRobot/Robot.h>
25 #include <VirtualRobot/VirtualRobot.h>
26 #include <VirtualRobot/XML/RobotIO.h>
27 
28 #include "RobotReader.h"
29 
31 {
32  /**
33  * @brief The VirtualRobotReader class.
34  *robot
35  * The aim of this class is to obtain a virtual robot instance and synchronize it
36  * with the data (joint positions, global pose, ...) stored in the working memory.
37  *
38  * This is only a lightweight wrapper of @see RobotReader for Simox's VirtualRobot class.
39  */
40  class VirtualRobotReader : virtual public RobotReader
41  {
42  public:
44 
45  ~VirtualRobotReader() override = default;
46 
47  [[nodiscard]] bool synchronizeRobot(VirtualRobot::Robot& robot,
48  const armem::Time& timestamp) const;
49 
50  [[nodiscard]] bool synchronizeRobotJoints(VirtualRobot::Robot& robot,
51  const armem::Time& timestamp) const;
52 
53  [[nodiscard]] VirtualRobot::RobotPtr
54  getRobot(const std::string& name,
55  const armem::Time& timestamp = armem::Time::Invalid(),
56  const VirtualRobot::RobotIO::RobotDescription& loadMode =
57  VirtualRobot::RobotIO::RobotDescription::eStructure);
58 
59  [[nodiscard]] VirtualRobot::RobotPtr
60  getSynchronizedRobot(const std::string& name,
61  const VirtualRobot::RobotIO::RobotDescription& loadMode =
62  VirtualRobot::RobotIO::RobotDescription::eStructure,
63  bool blocking = true);
64 
65  [[nodiscard]] VirtualRobot::RobotPtr
66  getSynchronizedRobot(const std::string& name,
67  const armem::Time& timestamp,
68  const VirtualRobot::RobotIO::RobotDescription& loadMode =
69  VirtualRobot::RobotIO::RobotDescription::eStructure,
70  bool blocking = true);
71 
72  private:
73  [[nodiscard]] VirtualRobot::RobotPtr
74  _getSynchronizedRobot(const std::string& name,
75  const armem::Time& timestamp = armem::Time::Invalid(),
76  const VirtualRobot::RobotIO::RobotDescription& loadMode =
77  VirtualRobot::RobotIO::RobotDescription::eStructure,
78  bool blocking = true);
79  };
80 
81 } // namespace armarx::armem::robot_state
armarx::armem::robot_state::VirtualRobotReader
The VirtualRobotReader class.
Definition: VirtualRobotReader.h:40
armarx::armem::robot_state::VirtualRobotReader::getRobot
VirtualRobot::RobotPtr getRobot(const std::string &name, const armem::Time &timestamp=armem::Time::Invalid(), const VirtualRobot::RobotIO::RobotDescription &loadMode=VirtualRobot::RobotIO::RobotDescription::eStructure)
Definition: VirtualRobotReader.cpp:57
armarx::armem::robot_state::VirtualRobotReader::~VirtualRobotReader
~VirtualRobotReader() override=default
armarx::armem::robot_state
Definition: RobotStatePredictionClient.cpp:42
armarx::armem::robot_state::VirtualRobotReader::synchronizeRobot
bool synchronizeRobot(VirtualRobot::Robot &robot, const armem::Time &timestamp) const
Definition: VirtualRobotReader.cpp:20
armarx::armem::human::Robot
@ Robot
Definition: util.h:14
armarx::armem::robot_state::VirtualRobotReader::synchronizeRobotJoints
bool synchronizeRobotJoints(VirtualRobot::Robot &robot, const armem::Time &timestamp) const
Definition: VirtualRobotReader.cpp:39
RobotReader.h
armarx::armem::robot_state::VirtualRobotReader::getSynchronizedRobot
VirtualRobot::RobotPtr getSynchronizedRobot(const std::string &name, const VirtualRobot::RobotIO::RobotDescription &loadMode=VirtualRobot::RobotIO::RobotDescription::eStructure, bool blocking=true)
armarx::armem::robot_state::RobotReader
The RobotReader class.
Definition: RobotReader.h:43
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::robot_state::RobotReader::RobotReader
RobotReader()=default
armarx::core::time::DateTime::Invalid
static DateTime Invalid()
Definition: DateTime.cpp:60
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18