GlobalRobotPoseSensorDevice.cpp
Go to the documentation of this file.
2
3#include <SimoxUtility/math/convert/pos_rpy_to_mat4f.h>
4
6
7namespace armarx
8{
17
18 bool
20 {
21 return not global_T_odom.isIdentity();
22 }
23
32
33 bool
35 {
36 return not global_T_root.isIdentity();
37 }
38
39 std::string
41 {
42 return "GlobalRobotPoseCorrectionSensorDevice";
43 }
44
47 {
48 transformationBuffer.reinitAllBuffers(SensorValueType::Transformation::Identity());
49 }
50
51 const SensorValueBase*
53 {
54 return &sensor;
55 }
56
57 std::string
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
89
90 const SensorValueBase*
95
96 std::string
101
102 void
103 GlobalRobotPoseSensorDevice::rtReadSensorValues(const IceUtil::Time& sensorValuesTimestamp,
104 const IceUtil::Time& timeSinceLastIteration)
105 {
106 }
107
108 std::string
110 {
111 return "GlobalRobotLocalizationSensorDevice";
112 }
113
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 << deactivateSpam(1);
128 return;
129 }
130 if (sensorRelativePosition == nullptr)
131 {
132 ARMARX_ERROR << "The relative position sensor is not available." << deactivateSpam(1);
133 return;
134 }
135
136 const auto global_T_relative = sensorGlobalPositionCorrection->global_T_odom;
137 const auto relative_T_robot =
138 simox::math::pos_rpy_to_mat4f(sensorRelativePosition->relativePositionX,
139 sensorRelativePosition->relativePositionY,
140 0,
141 0,
142 0,
143 sensorRelativePosition->relativePositionRotation);
144 const auto global_T_robot = global_T_relative * relative_T_robot;
145
146 sensor.global_T_root = global_T_robot;
147 }
148} // namespace armarx
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
Definition Logging.cpp:75
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.
const SensorValueGlobalPoseCorrection * sensorGlobalPositionCorrection
const SensorValueHolonomicPlatformRelativePosition * sensorRelativePosition
void updateGlobalPositionCorrection(const SensorValueType::Transformation &global_T_odom)
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.
const SensorValueBase * getSensorValue() const override
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.
const SensorValueBase * getSensorValue() const override
This class represents some part of the robot providing sensor values.
SensorDevice(const std::string &name)
Create a SensorDevice with the given name.
The SensorValueBase class.
introspection::ClassMemberInfo< SensorValueBase, DerivedClass > SensorValueInfo
static SensorValueInfo< SensorValueGlobalPoseCorrection > GetClassMemberInfo()
static SensorValueInfo< SensorValueGlobalRobotPose > GetClassMemberInfo()
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
Definition Logging.h:196
std::string const GlobalFrame
Variable of the global coordinate system.
Definition FramedPose.h:65
This file offers overloads of toIce() and fromIce() functions for STL container types.
EntryConfigurator< ClassType > addMemberVariable(MemberType ClassType::*ptr, const std::string &name)
add a member variable of the current class