RobotUnitModuleRobotData.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  * @package RobotAPI::ArmarXObjects::RobotUnit
17  * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18  * @date 2018
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <VirtualRobot/Robot.h>
26 
30 
31 #include "RobotUnitModuleBase.h"
32 
33 namespace armarx
34 {
35  using RobotPoolPtr = std::shared_ptr<class RobotPool>;
36 }
37 
39 {
41  {
42  public:
44  };
45 
46  /**
47  * @ingroup Library-RobotUnit-Modules
48  * @brief This \ref ModuleBase "Module" holds all high-level data about the robot.
49  *
50  * @see ModuleBase
51  */
52  class RobotData : virtual public ModuleBase
53  {
54  friend class ModuleBase;
55 
56  public:
57  /**
58  * @brief Returns the singleton instance of this class
59  * @return The singleton instance of this class
60  */
61  static RobotData&
63  {
64  return ModuleBase::Instance<RobotData>();
65  }
66 
67  // //////////////////////////////////////////////////////////////////////////////////////// //
68  // ///////////////////////////////// RobotUnitModule hooks //////////////////////////////// //
69  // //////////////////////////////////////////////////////////////////////////////////////// //
70  private:
71  /// @see ModuleBase::_preOnInitRobotUnit
72  void _initVirtualRobot();
73  // //////////////////////////////////////////////////////////////////////////////////////// //
74  // /////////////////////////////////// Module interface /////////////////////////////////// //
75  // //////////////////////////////////////////////////////////////////////////////////////// //
76  public:
78 
79  /**
80  * @brief Returns the name of the robot's platform
81  * @return The name of the robot's platform
82  */
83  const std::string& getRobotPlatformName() const;
84 
85  /**
86  * @brief Returns the name of the robot's RobotNodeSet
87  * @return The name of the robot's RobotNodeSet
88  */
89  const std::string& getRobotNodetSeName() const;
90 
91  /**
92  * @brief Returns the name of the project containing the robot's model
93  * @return The name of the project containing the robot's model
94  */
95  const std::string& getRobotProjectName() const;
96 
97  /**
98  * @brief Returns the file name of the robot's model
99  * @return The file name of the robot's model
100  */
101  const std::string& getRobotFileName() const;
102 
103  /**
104  * @brief Returns the robot's name
105  * @return The robot's name
106  */
107  std::string getRobotName() const;
108 
109  /**
110  * @brief Returns the name of the robot platform instance. Used for the platform topic: RobotPlatformInstance + "State"
111  */
112  std::string getRobotPlatformInstanceName() const;
113 
114 
115  /**
116  * @brief Returns a clone of the robot's model
117  * @return A clone of the robot's model
118  */
119  VirtualRobot::RobotPtr cloneRobot(bool updateCollisionModel = false) const;
120  // //////////////////////////////////////////////////////////////////////////////////////// //
121  // ///////////////////////////////////////// Data ///////////////////////////////////////// //
122  // //////////////////////////////////////////////////////////////////////////////////////// //
123 
124  private:
125  /// @brief The name of the robot's RobotNodeSet
126  std::string robotNodeSetName;
127  /// @brief The name of the project containing the robot's model
128  std::string robotProjectName;
129  /// @brief The file name of the robot's model
130  std::string robotFileName;
131  /// @brief The name of the robot's platform
132  std::string robotPlatformName;
133  /// @brief Indicates whether the robot platform unit is enabled.
134  bool _arePlatformAndLocalizationUnitsEnabled = false;
135  /// @brief The name of the robot's platform instance
136  std::string robotPlatformInstanceName;
137 
138  /// @brief The robot's model.
140  RobotPoolPtr robotPool;
141  /// @brief A mutex guarding \ref robot
142  mutable std::mutex robotMutex;
143  };
144 } // namespace armarx::RobotUnitModule
armarx::RobotUnitModule::RobotData::getRobotNodetSeName
const std::string & getRobotNodetSeName() const
Returns the name of the robot's RobotNodeSet.
Definition: RobotUnitModuleRobotData.cpp:90
DebugObserver.h
armarx::RobotUnitModule::RobotDataPropertyDefinitions::RobotDataPropertyDefinitions
RobotDataPropertyDefinitions(std::string prefix)
Definition: RobotUnitModuleRobotData.cpp:37
ArmarXManager.h
RobotUnitModuleBase.h
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
armarx::RobotUnitModule::RobotDataPropertyDefinitions
Definition: RobotUnitModuleRobotData.h:40
armarx::RobotPoolPtr
std::shared_ptr< class RobotPool > RobotPoolPtr
Definition: RobotUnitModuleRobotData.h:35
armarx::RobotUnitModule::RobotData::arePlatformAndLocalizationUnitsEnabled
bool arePlatformAndLocalizationUnitsEnabled() const
Definition: RobotUnitModuleRobotData.cpp:69
TaskUtil.h
armarx::RobotUnitModule::RobotData::getRobotPlatformName
const std::string & getRobotPlatformName() const
Returns the name of the robot's platform.
Definition: RobotUnitModuleRobotData.cpp:75
armarx::RobotUnitModule::RobotData::Instance
static RobotData & Instance()
Returns the singleton instance of this class.
Definition: RobotUnitModuleRobotData.h:62
armarx::RobotUnitModule::RobotData::getRobotFileName
const std::string & getRobotFileName() const
Returns the file name of the robot's model.
Definition: RobotUnitModuleRobotData.cpp:108
armarx::RobotUnitModule::RobotData::getRobotProjectName
const std::string & getRobotProjectName() const
Returns the name of the project containing the robot's model.
Definition: RobotUnitModuleRobotData.cpp:99
armarx::RobotUnitModule
Definition: ControlDevice.h:34
armarx::RobotUnitModule::RobotData
This Module holds all high-level data about the robot.
Definition: RobotUnitModuleRobotData.h:52
armarx::RobotUnitModule::RobotData::cloneRobot
VirtualRobot::RobotPtr cloneRobot(bool updateCollisionModel=false) const
Returns a clone of the robot's model.
Definition: RobotUnitModuleRobotData.cpp:127
armarx::RobotUnitModule::ModuleBasePropertyDefinitions
Definition: RobotUnitModuleBase.h:107
armarx::RobotUnitModule::RobotData::getRobotName
std::string getRobotName() const
Returns the robot's name.
Definition: RobotUnitModuleRobotData.cpp:117
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::RobotUnitModule::ModuleBase
Base class for all RobotUnitModules.
Definition: RobotUnitModuleBase.h:183
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
armarx::RobotUnitModule::RobotData::getRobotPlatformInstanceName
std::string getRobotPlatformInstanceName() const
Returns the name of the robot platform instance.
Definition: RobotUnitModuleRobotData.cpp:84