21 const std::string& robotTypeName)
26 <<
"No converter for robot type '" << robotTypeName <<
"' available. \n"
37 <<
"No converter for robot type '" << robotTypeName <<
"' available. \n"
53 while (
task and not
task->isStopped())
55 auto start = std::chrono::high_resolution_clock::now();
60 "RobotUnitReader | t commitTimestamp [us]",
61 commit->timestamp.toMicroSecondsSinceEpoch());
64 dataBuffer.push(std::move(commit.value()));
66 auto duration = std::chrono::duration_cast<std::chrono::microseconds>(
67 std::chrono::high_resolution_clock::now() - start);
70 debugObserver->setDebugObserverDatafield(
"RobotUnitReader | t run [ms]",
71 duration.count() / 1000.f);
79 std::optional<RobotUnitData>
86 std::optional<RobotUnitDataStreaming::TimeStep>
data;
88 auto start = std::chrono::high_resolution_clock::now();
89 data = fetchLatestData();
92 auto duration = std::chrono::duration_cast<std::chrono::microseconds>(
93 std::chrono::high_resolution_clock::now() - start);
96 debugObserver->setDebugObserverDatafield(
"RobotUnitReader | t Fetch [ms]",
97 duration.count() / 1000.f);
100 if (not
data.has_value())
105 ARMARX_DEBUG <<
"RobotUnitReader: Converting data current timestep to commit";
106 auto start = std::chrono::high_resolution_clock::now();
121 auto stop = std::chrono::high_resolution_clock::now();
122 auto duration = std::chrono::duration_cast<std::chrono::microseconds>(stop - start);
123 ARMARX_DEBUG <<
"RobotUnitReader: The total time needed to convert the data to commit: "
128 debugObserver->setDebugObserverDatafield(
"RobotUnitReader | t Read+Group [ms]",
129 duration.count() / 1000.f);
135 std::optional<RobotUnitDataStreaming::TimeStep>
136 RobotUnitReader::fetchLatestData()
138 std::deque<RobotUnitDataStreaming::TimeStep>&
data =
receiver->getDataBuffer();
141 debugObserver->setDebugObserverDatafield(
"RobotUnitReader | Buffer Size",
data.size());
144 debugObserver->setDebugObserverDatafield(
"RobotUnitReader | RT Timestamp USec",
145 data.back().timestampUSec);
147 "RobotUnitReader | RT Timestamp Since Last Iteration",
148 data.back().timesSinceLastIterationUSec);
150 "RobotUnitReader | Timestamp Arrived in RSM",
160 RobotUnitDataStreaming::TimeStep currentTimestep =
data.back();
162 return currentTimestep;