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();
107 endLocalization = std::chrono::high_resolution_clock::now();
111 ARMARX_WARNING <<
"Could not commit data to proprioception segment in memory. "
118 ARMARX_WARNING <<
"Could not commit data to exteroception segment in memory. "
125 auto end = std::chrono::high_resolution_clock::now();
127 debugObserver->setDebugObserverDatafield(
"RobotStateWriter | t Commit (ms)",
128 toDurationMs(start, end));
130 "RobotStateWriter | t Commit 1. Build Update (ms)",
131 toDurationMs(start, endBuildUpdate));
133 "RobotStateWriter | t Commit 2. Proprioception (ms)",
134 toDurationMs(endBuildUpdate, endProprioception));
136 "RobotStateWriter | t Commit 3. Localization (ms)",
137 toDurationMs(endProprioception, endLocalization));
143 <<
static_cast<std::underlying_type<boost::queue_op_status>::type
>(
155 RobotStateWriter::isRunning()
157 return task and not
task->isStopped();
160 RobotStateWriter::Update
166 if (
data.proprioception)
179 if (
data.exteroception)
192 const std::string platformKey =
"platform";
193 if (
data.proprioception->hasElement(platformKey))
198 update.localization.emplace_back(getTransform(platformData,
data.timestamp));
203 <<
"(No element '" << platformKey <<
"' in proprioception data.)"
204 <<
"\nIf you are using a mobile platform this should not have happened."
205 <<
"\nThis error is only logged once."
206 <<
"\nThese keys exist: " <<
data.proprioception->getAllKeys();
207 noOdometryDataLogged =
true;
215 const Time& timestamp)
const
217 prop::arondto::Platform platform;
218 platform.fromAron(platformData);
220 const Eigen::Vector3f& relPose = platform.relativePosition;
223 odometryPose.translation() << relPose.x(), relPose.y(), 0;
224 odometryPose.linear() = simox::math::rpy_to_mat3f(0.f, 0.f, relPose.z());