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
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
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
std::string timestamp()
Base Class for all Logging classes.
Definition Logging.h:240
IceUtil::Handle< RunningTask< T > > pointer_type
Shared pointer type for convenience.
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="visu.")
Definition Visu.cpp:43
void connect(const viz::Client &arviz, DebugObserverInterfacePrx debugObserver=nullptr)
Definition Visu.cpp:65
void init(const wm::CoreSegment *coreSegment, armem::robot_state::VirtualRobotReader *virtualRobotReader)
Definition Visu.cpp:57
Represents a point in time.
Definition DateTime.h:25
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
This file is part of ArmarX.
armarx::core::time::DateTime Time
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface > DebugObserverInterfacePrx
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.