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 
26 #include <VirtualRobot/VirtualRobot.h>
27 
30 #include <ArmarXCore/core/time.h>
32 
40 
42 {
43  struct ScanPoint
44  {
45  Eigen::Vector3f point;
46  float intensity;
47  };
48 
49  /**
50  * @brief Models decay of object localizations by decreasing the confidence
51  * the longer the object was not localized.
52  */
53  class Visu : public armarx::Logging
54  {
55  public:
56  Visu();
57 
58 
60  const std::string& prefix = "visu.");
61  void init(const wm::CoreSegment* coreSegment,
62  armem::robot_state::VirtualRobotReader* virtualRobotReader);
63  void connect(const viz::Client& arviz, DebugObserverInterfacePrx debugObserver = nullptr);
64 
65 
66  private:
67  void visualizeRun();
68  void visualizeOnce(const Time& timestamp);
69 
70 
71  viz::Client arviz;
72  std::optional<DebugObserverHelper> debugObserver;
73 
74  struct Properties
75  {
76  bool enabled = true;
77  bool uniformColor = false;
78  bool colorByIntensity = true;
79  float frequencyHz = 5;
80  int maxRobotAgeMs = 100;
81  } p;
82 
84 
85  armem::robot_state::VirtualRobotReader* virtualRobotReader;
86 
87  std::map<std::string, std::pair<VirtualRobot::RobotPtr, DateTime>> robots;
88 
89  VirtualRobot::RobotPtr getSynchronizedRobot(const std::string& name,
90  const DateTime& timestamp);
91 
92  void visualizeScan(const std::vector<ScanPoint>& points,
93  const std::string& sensorName,
94  const std::string& agentName,
95  const viz::Color& color);
96 
97  std::map<std::string, armem::laser_scans::LaserScanStamped> getCurrentLaserScans();
98 
99  const wm::CoreSegment* coreSegment;
100  };
101 
102 } // namespace armarx::armem::server::laser_scans
Client.h
armarx::armem::robot_state::VirtualRobotReader
The VirtualRobotReader class.
Definition: VirtualRobotReader.h:40
armarx::armem::server::laser_scans::Visu::Visu
Visu()
Definition: Visu.cpp:37
armarx::armem::server::laser_scans::Visu::init
void init(const wm::CoreSegment *coreSegment, armem::robot_state::VirtualRobotReader *virtualRobotReader)
Definition: Visu.cpp:57
types.h
armarx::armem::server::laser_scans
This file is part of ArmarX.
Definition: LaserScansMemory.cpp:35
armarx::armem::server::laser_scans::Visu::connect
void connect(const viz::Client &arviz, DebugObserverInterfacePrx debugObserver=nullptr)
Definition: Visu.cpp:65
memory_definitions.h
armarx::armem::server::laser_scans::ScanPoint::intensity
float intensity
Definition: Visu.h:46
armarx::armem::server::laser_scans::ScanPoint
Definition: Visu.h:43
forward_declarations.h
armarx::armem::server::laser_scans::Visu::defineProperties
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="visu.")
Definition: Visu.cpp:43
armarx::armem::server::laser_scans::Visu
Models decay of object localizations by decreasing the confidence the longer the object was not local...
Definition: Visu.h:53
types.h
armarx::viz::Color
Definition: Color.h:13
enabled
std::atomic< bool > * enabled
Definition: RemoteGuiWidgetController.cpp:75
armarx::armem::server::laser_scans::ScanPoint::point
Eigen::Vector3f point
Definition: Visu.h:45
VirtualRobotReader.h
TaskUtil.h
armarx::armem::server::wm::CoreSegment
base::CoreSegmentBase
Definition: memory_definitions.h:86
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 >
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
time.h
Logging.h
armarx::viz::Client
Definition: Client.h:109
SpecializedCoreSegment.h
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18