Segment.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  * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18  * @date 2021
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 // STD / STL
26 #include <map>
27 #include <optional>
28 #include <string>
29 
30 // ArmarX
31 #include <RobotAPI/interface/units/RobotUnit/RobotUnitInterface.h>
32 
33 // RobotAPI
39 
40 namespace armarx
41 {
42  class DebugObserverHelper;
43 }
44 
46 {
48  {
50 
51  public:
53  virtual ~Segment() override;
54 
56  const std::string& prefix = "") override;
57 
58  void init() override;
59 
60  void onConnect(RobotUnitInterfacePrx robotUnitPrx);
61 
62 
64  DebugObserverHelper* debugObserver = nullptr) const;
66  DebugObserverHelper* debugObserver = nullptr) const;
67 
69 
71 
72 
73  private:
74  static SensorValues readSensorValues(const wm::EntityInstanceData& data);
75 
76 
77  private:
78  RobotUnitInterfacePrx robotUnit;
79  armem::MemoryID robotUnitProviderID;
80 
81  struct Properties
82  {
83  double predictionTimeWindow = 2;
84  };
85 
86  Properties properties;
87 
88  // Debug Observer prefix
89  const std::string dp = "Proprioception::getRobotJointPositions() | ";
90  };
91 
92 } // namespace armarx::armem::server::robot_state::proprioception
armarx::armem::PredictionRequest
Definition: Prediction.h:48
armarx::armem::server::segment::SpecializedCoreSegment
A base class for core segments.
Definition: SpecializedCoreSegment.h:19
armarx::armem::server::robot_state::proprioception::Segment::getSensorValues
SensorValuesMap getSensorValues(const armem::Time &timestamp, DebugObserverHelper *debugObserver=nullptr) const
Definition: Segment.cpp:96
armarx::armem::server::MemoryToIceAdapter
Helps connecting a Memory server to the Ice interface.
Definition: MemoryToIceAdapter.h:19
MemoryID.h
armarx::armem::server::robot_state::proprioception::Segment
Definition: Segment.h:47
Prediction.h
armarx::armem::server::robot_state::proprioception
Definition: forward_declarations.h:78
armarx::armem::server::robot_state::proprioception::Segment::init
void init() override
Definition: Segment.cpp:46
armarx::armem::server::robot_state::proprioception::SensorValues
Definition: SensorValues.h:43
armarx::armem::PredictionResult
Definition: Prediction.h:57
armarx::armem::server::robot_state::proprioception::Segment::predictLinear
armem::PredictionResult predictLinear(const armem::PredictionRequest &request) const
Definition: Segment.cpp:219
forward_declarations.h
armarx::armem::MemoryID
A memory ID.
Definition: MemoryID.h:47
armarx::armem::server::segment::detail::SegmentBase< server::wm::CoreSegment >
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
timestamp
std::string timestamp()
Definition: CartographerAdapter.cpp:85
armarx::armem::server::robot_state::proprioception::Segment::getRobotUnitProviderID
const armem::MemoryID & getRobotUnitProviderID() const
Definition: Segment.cpp:159
armarx::armem::server::robot_state::proprioception::SensorValuesMap
std::unordered_map< std::string, SensorValues > SensorValuesMap
Definition: forward_declarations.h:85
armarx::core::time::DateTime
Represents a point in time.
Definition: DateTime.h:24
armarx::armem::server::segment::detail::SegmentBase< server::wm::CoreSegment >::iceMemory
MemoryToIceAdapter & iceMemory
Definition: SpecializedSegment.h:58
IceUtil::Handle< class PropertyDefinitionContainer >
IceInternal::ProxyHandle<::IceProxy::armarx::RobotUnitInterface >
armarx::armem::server::robot_state::proprioception::Segment::~Segment
virtual ~Segment() override
SpecializedProviderSegment.h
armarx::armem::server::robot_state::proprioception::Segment::onConnect
void onConnect(RobotUnitInterfacePrx robotUnitPrx)
Definition: Segment.cpp:56
armarx::armem::server::robot_state::proprioception::Segment::getSensorValuesLocking
SensorValuesMap getSensorValuesLocking(const armem::Time &timestamp, DebugObserverHelper *debugObserver=nullptr) const
Definition: Segment.cpp:78
armarx::armem::server::robot_state::proprioception::Segment::Segment
Segment(server::MemoryToIceAdapter &iceMemory)
Definition: Segment.cpp:24
armarx::DebugObserverHelper
Brief description of class DebugObserverHelper.
Definition: DebugObserverHelper.h:51
SpecializedCoreSegment.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::aron::data::Dict
Definition: Dict.h:44
armarx::armem::server::robot_state::proprioception::Segment::defineProperties
void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="") override
Definition: Segment.cpp:35