Visu.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 <optional>
25 
29 
34 
36 {
37 
38  /**
39  * @brief Models decay of object localizations by decreasing the confidence
40  * the longer the object was not localized.
41  */
42  class Visu : public armarx::Logging
43  {
44  public:
45  Visu(const description::Segment& descriptionSegment,
46  const proprioception::Segment& proprioceptionSegment,
47  const localization::Segment& localizationSegment);
48 
49 
51  const std::string& prefix = "visu.");
52  void init();
53  void connect(const viz::Client& arviz, DebugObserverInterfacePrx debugObserver = nullptr);
54 
55 
56  private:
57  void visualizeRun();
58  void visualizeOnce(const Time& timestamp);
59 
60 
61  static void visualizeRobots(viz::Layer& layer, const robot::Robots& robots);
62 
63  static void visualizeFrames(
64  viz::Layer& layerFrames,
65  const std::unordered_map<std::string, std::vector<Eigen::Affine3f>>& frames);
66 
67  static void visualizeFramesIndividual(
68  viz::Layer& layerFrames,
69  const std::unordered_map<std::string, std::vector<Eigen::Affine3f>>& frames);
70 
71 
72  void visualizeForceTorque(viz::Layer& layer,
73  const robot::Robot& robot,
74  const proprioception::SensorValues& sensorValues);
75 
76  private:
77  viz::Client arviz;
78  std::optional<DebugObserverHelper> debugObserver;
79 
80  const description::Segment& descriptionSegment;
81  const proprioception::Segment& proprioceptionSegment;
82  const localization::Segment& localizationSegment;
83 
84  struct RobotModel
85  {
86  RobotModel(const std::filesystem::path& robotPath);
87 
89  RobotNameHelperPtr nameHelper;
90  };
91 
92  std::map<std::string, RobotModel> models;
93 
94  struct Properties
95  {
96  bool enabled = true;
97  float frequencyHz = 25.f;
98 
99  bool framesEnabled = false;
100 
101  struct ForceTorque
102  {
103  bool enabled = true;
104  float forceScale = 1.F;
105  };
106 
107  ForceTorque forceTorque;
108  } p;
109 
111  };
112 
113 } // namespace armarx::armem::server::robot_state
Client.h
armarx::armem::robot::Robots
std::vector< Robot > Robots
Definition: types.h:80
armarx::armem::server::robot_state::Visu::init
void init()
Definition: Visu.cpp:59
robots
std::vector< VirtualRobot::RobotPtr > robots
Definition: VisualizationRobot.cpp:86
armarx::armem::robot::Robot
Definition: types.h:68
armarx::armem::server::robot_state::Visu::Properties::ForceTorque
Definition: Visu.h:101
armarx::armem::server::robot_state::proprioception::Segment
Definition: Segment.h:47
armarx::armem::server::robot_state::localization::Segment
Definition: Segment.h:43
armarx::armem::server::robot_state::description::Segment
Definition: Segment.h:43
armarx::armem::server::robot_state::Visu::Visu
Visu(const description::Segment &descriptionSegment, const proprioception::Segment &proprioceptionSegment, const localization::Segment &localizationSegment)
Definition: Visu.cpp:31
armarx::armem::server::robot_state::proprioception::SensorValues
Definition: SensorValues.h:43
armarx::armem::server::robot_state::Visu::Properties::ForceTorque::enabled
bool enabled
Definition: Visu.h:103
armarx::armem::server::robot_state
Definition: RobotStateMemory.cpp:40
armarx::armem::server::robot_state::Visu::connect
void connect(const viz::Client &arviz, DebugObserverInterfacePrx debugObserver=nullptr)
Definition: Visu.cpp:64
forward_declarations.h
armarx::RobotNameHelperPtr
std::shared_ptr< class RobotNameHelper > RobotNameHelperPtr
Definition: RobotNameHelper.h:34
types.h
enabled
std::atomic< bool > * enabled
Definition: RemoteGuiWidgetController.cpp:75
TaskUtil.h
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
DebugObserverHelper.h
armarx::Logging
Base Class for all Logging classes.
Definition: Logging.h:232
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::armem::server::robot_state::Visu
Models decay of object localizations by decreasing the confidence the longer the object was not local...
Definition: Visu.h:42
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
Logging.h
armarx::viz::Client
Definition: Client.h:109
armarx::viz::Layer
Definition: Layer.h:12
armarx::armem::server::robot_state::Visu::defineProperties
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="visu.")
Definition: Visu.cpp:42
armarx::armem::server::robot_state::Visu::Properties::ForceTorque::forceScale
float forceScale
Definition: Visu.h:104
RobotNameHelper.h
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18