GlobalRobotPoseSensorDevice.cpp
Go to the documentation of this file.
2 
3 #include <SimoxUtility/math/convert/pos_rpy_to_mat4f.h>
4 
6 
7 namespace armarx
8 {
9  SensorValueBase::SensorValueInfo<SensorValueGlobalPoseCorrection>
11  {
14  .setVariantReportFrame("", GlobalFrame);
15  return svi;
16  }
17 
18  bool
20  {
21  return not global_T_odom.isIdentity();
22  }
23 
26  {
29  .setVariantReportFrame("", GlobalFrame);
30  return svi;
31  }
32 
33  bool
35  {
36  return not global_T_root.isIdentity();
37  }
38 
39  std::string
41  {
42  return "GlobalRobotPoseCorrectionSensorDevice";
43  }
44 
46  DeviceBase(DeviceName()), SensorDevice(DeviceName())
47  {
49  }
50 
51  const SensorValueBase*
53  {
54  return &sensor;
55  }
56 
57  std::string
59  {
60  return GlobalFrame;
61  }
62 
63  void
65  const IceUtil::Time& sensorValuesTimestamp,
66  const IceUtil::Time& timeSinceLastIteration)
67  {
68  sensor.global_T_odom = transformationBuffer.getUpToDateReadBuffer();
69  }
70 
71  void
73  const SensorValueType::Transformation& global_T_odom)
74  {
75  transformationBuffer.getWriteBuffer() = global_T_odom;
76  transformationBuffer.commitWrite();
77  }
78 
79  std::string
81  {
82  return "GlobalRobotPoseSensorDevice";
83  }
84 
86  DeviceBase(DeviceName()), SensorDevice(DeviceName())
87  {
88  }
89 
90  const SensorValueBase*
92  {
93  return &sensor;
94  }
95 
96  std::string
98  {
99  return GlobalFrame;
100  }
101 
102  void
104  const IceUtil::Time& timeSinceLastIteration)
105  {
106  }
107 
108  std::string
110  {
111  return "GlobalRobotLocalizationSensorDevice";
112  }
113 
115  DeviceBase(DeviceName()), SensorDevice(DeviceName())
116  {
117  }
118 
119  void
121  const IceUtil::Time& sensorValuesTimestamp,
122  const IceUtil::Time& timeSinceLastIteration)
123  {
124  if (sensorGlobalPositionCorrection == nullptr)
125  {
126  ARMARX_ERROR << "The global position correction sensor is not available.";
127  return;
128  }
129  if (sensorRelativePosition == nullptr)
130  {
131  ARMARX_ERROR << "The relative position sensor is not available.";
132  return;
133  }
134 
135  const auto global_T_relative = sensorGlobalPositionCorrection->global_T_odom;
136  const auto relative_T_robot =
137  simox::math::pos_rpy_to_mat4f(sensorRelativePosition->relativePositionX,
139  0,
140  0,
141  0,
143  const auto global_T_robot = global_T_relative * relative_T_robot;
144 
145  sensor.global_T_root = global_T_robot;
146  }
147 } // namespace armarx
armarx::SensorValueGlobalRobotPose::isAvailable
bool isAvailable() const
Definition: GlobalRobotPoseSensorDevice.cpp:34
armarx::GlobalRobotPoseSensorDevice::DeviceName
static std::string DeviceName()
Definition: GlobalRobotPoseSensorDevice.cpp:80
armarx::TripleBuffer::getWriteBuffer
T & getWriteBuffer()
Definition: TripleBuffer.h:90
armarx::SensorValueBase
The SensorValueBase class.
Definition: SensorValueBase.h:40
armarx::TripleBuffer::commitWrite
void commitWrite()
Definition: TripleBuffer.h:146
armarx::GlobalRobotPoseCorrectionSensorDevice::getReportingFrame
std::string getReportingFrame() const override
Definition: GlobalRobotPoseSensorDevice.cpp:58
armarx::GlobalRobotLocalizationSensorDevice::DeviceName
static std::string DeviceName()
Definition: GlobalRobotPoseSensorDevice.cpp:109
armarx::GlobalFrame
const std::string GlobalFrame
Definition: FramedPose.h:62
armarx::introspection::ClassMemberInfo
Definition: ClassMemberInfo.h:34
armarx::DeviceBase
Definition: DeviceBase.h:29
armarx::GlobalRobotLocalizationSensorDevice::rtReadSensorValues
void rtReadSensorValues(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
This is a hook for implementations to read the sensor value from a bus.
Definition: GlobalRobotPoseSensorDevice.cpp:120
armarx::SensorValueHolonomicPlatformRelativePosition::relativePositionRotation
float relativePositionRotation
Definition: SensorValueHolonomicPlatform.h:90
armarx::GlobalRobotPoseSensorDevice::GlobalRobotPoseSensorDevice
GlobalRobotPoseSensorDevice()
Definition: GlobalRobotPoseSensorDevice.cpp:85
armarx::SensorValueGlobalRobotPose::global_T_root
Transformation global_T_root
Definition: GlobalRobotPoseSensorDevice.h:45
armarx::SensorValueGlobalPoseCorrection::GetClassMemberInfo
static SensorValueInfo< SensorValueGlobalPoseCorrection > GetClassMemberInfo()
Definition: GlobalRobotPoseSensorDevice.cpp:10
armarx::SensorValueGlobalPoseCorrection::Transformation
Eigen::Matrix4f Transformation
Definition: GlobalRobotPoseSensorDevice.h:29
armarx::GlobalRobotLocalizationSensorDevice::GlobalRobotLocalizationSensorDevice
GlobalRobotLocalizationSensorDevice()
Definition: GlobalRobotPoseSensorDevice.cpp:114
armarx::GlobalRobotPoseCorrectionSensorDevice::updateGlobalPositionCorrection
void updateGlobalPositionCorrection(const SensorValueType::Transformation &global_T_odom)
Definition: GlobalRobotPoseSensorDevice.cpp:72
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:523
armarx::SensorDevice
This class represents some part of the robot providing sensor values.
Definition: SensorDevice.h:59
armarx::introspection::ClassMemberInfo::addMemberVariable
EntryConfigurator< ClassType > addMemberVariable(MemberType ClassType::*ptr, const std::string &name)
add a member variable of the current class
armarx::GlobalRobotPoseCorrectionSensorDevice::DeviceName
static std::string DeviceName()
Definition: GlobalRobotPoseSensorDevice.cpp:40
armarx::GlobalRobotPoseSensorDevice::sensor
SensorValueType sensor
Definition: GlobalRobotPoseSensorDevice.h:99
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
armarx::GlobalRobotPoseCorrectionSensorDevice::getSensorValue
const SensorValueBase * getSensorValue() const override
Definition: GlobalRobotPoseSensorDevice.cpp:52
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::GlobalRobotPoseSensorDevice::getSensorValue
const SensorValueBase * getSensorValue() const override
Definition: GlobalRobotPoseSensorDevice.cpp:91
armarx::GlobalRobotPoseSensorDevice::rtReadSensorValues
void rtReadSensorValues(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
This is a hook for implementations to read the sensor value from a bus.
Definition: GlobalRobotPoseSensorDevice.cpp:103
armarx::SensorValueGlobalPoseCorrection::isAvailable
bool isAvailable() const
Definition: GlobalRobotPoseSensorDevice.cpp:19
armarx::GlobalRobotPoseCorrectionSensorDevice::GlobalRobotPoseCorrectionSensorDevice
GlobalRobotPoseCorrectionSensorDevice()
Definition: GlobalRobotPoseSensorDevice.cpp:45
armarx::SensorValueGlobalRobotPose::GetClassMemberInfo
static SensorValueInfo< SensorValueGlobalRobotPose > GetClassMemberInfo()
Definition: GlobalRobotPoseSensorDevice.cpp:25
armarx::SensorValueGlobalPoseCorrection::global_T_odom
Transformation global_T_odom
Definition: GlobalRobotPoseSensorDevice.h:30
GlobalRobotPoseSensorDevice.h
armarx::GlobalRobotLocalizationSensorDevice::sensorGlobalPositionCorrection
const SensorValueGlobalPoseCorrection * sensorGlobalPositionCorrection
Definition: GlobalRobotPoseSensorDevice.h:114
armarx::SensorValueHolonomicPlatformRelativePosition::relativePositionY
float relativePositionY
Definition: SensorValueHolonomicPlatform.h:89
Logging.h
armarx::TripleBuffer::getUpToDateReadBuffer
const T & getUpToDateReadBuffer() const
Definition: TripleBuffer.h:108
armarx::GlobalRobotLocalizationSensorDevice::sensorRelativePosition
const SensorValueHolonomicPlatformRelativePosition * sensorRelativePosition
Definition: GlobalRobotPoseSensorDevice.h:115
armarx::TripleBuffer::reinitAllBuffers
std::enable_if< std::is_copy_constructible< U >::value >::type reinitAllBuffers(const T &init)
Definition: TripleBuffer.h:153
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::GlobalRobotPoseCorrectionSensorDevice::rtReadSensorValues
void rtReadSensorValues(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
This is a hook for implementations to read the sensor value from a bus.
Definition: GlobalRobotPoseSensorDevice.cpp:64
armarx::GlobalRobotPoseSensorDevice::getReportingFrame
std::string getReportingFrame() const override
Definition: GlobalRobotPoseSensorDevice.cpp:97
armarx::SensorValueHolonomicPlatformRelativePosition::relativePositionX
DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION float relativePositionX
Definition: SensorValueHolonomicPlatform.h:88