29 #include <SimoxUtility/math/convert/rpy_to_mat3f.h>
38 #include <RobotAPI/libraries/armem_robot_state/aron/Proprioception.aron.generated.h>
55 toDurationMs(std::chrono::high_resolution_clock::time_point start,
56 std::chrono::high_resolution_clock::time_point end)
58 auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
59 return duration.count() / 1000.f;
74 size_t dataBufferSize = dataBuffer.size();
75 debugObserver->setDebugObserverDatafield(
"RobotStateWriter | Queue Size",
76 static_cast<long>(dataBufferSize));
80 if (
const auto status = dataBuffer.wait_pull(robotUnitData);
81 status == boost::queue_op_status::success)
83 auto start = std::chrono::high_resolution_clock::now();
84 auto endBuildUpdate = start, endProprioception = start, endLocalization = start;
87 endBuildUpdate = std::chrono::high_resolution_clock::now();
98 endProprioception = std::chrono::high_resolution_clock::now();
108 endLocalization = std::chrono::high_resolution_clock::now();
112 ARMARX_WARNING <<
"Could not commit data to proprioception segment in memory. "
119 ARMARX_WARNING <<
"Could not commit data to exteroception segment in memory. "
126 auto end = std::chrono::high_resolution_clock::now();
128 debugObserver->setDebugObserverDatafield(
"RobotStateWriter | t Commit (ms)",
129 toDurationMs(start, end));
131 "RobotStateWriter | t Commit 1. Build Update (ms)",
132 toDurationMs(start, endBuildUpdate));
134 "RobotStateWriter | t Commit 2. Proprioception (ms)",
135 toDurationMs(endBuildUpdate, endProprioception));
137 "RobotStateWriter | t Commit 3. Localization (ms)",
138 toDurationMs(endProprioception, endLocalization));
144 <<
static_cast<std::underlying_type<boost::queue_op_status>::type
>(
156 RobotStateWriter::isRunning()
158 return task and not
task->isStopped();
161 RobotStateWriter::Update
167 if (
data.proprioception)
180 if (
data.exteroception)
193 const std::string platformKey =
"platform";
194 if (
data.proprioception->hasElement(platformKey))
199 update.localization.emplace_back(getTransform(platformData,
data.timestamp));
204 <<
"(No element '" << platformKey <<
"' in proprioception data.)"
205 <<
"\nIf you are using a mobile platform this should not have happened."
206 <<
"\nThis error is only logged once."
207 <<
"\nThese keys exist: " <<
data.proprioception->getAllKeys();
208 noOdometryDataLogged =
true;
216 const Time& timestamp)
const
218 prop::arondto::Platform platform;
219 platform.fromAron(platformData);
221 const Eigen::Vector3f& relPose = platform.relativePosition;
224 odometryPose.translation() << relPose.x(), relPose.y(), 0;
225 odometryPose.linear() = simox::math::rpy_to_mat3f(0.f, 0.f, relPose.z());