RobotStateComponent.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package RobotStateComponent::
19 * @author ( at kit dot edu)
20 * @date
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#include "RobotStateComponent.h"
26
27#include <Ice/ObjectAdapter.h>
28
29#include <VirtualRobot/Nodes/RobotNode.h>
30#include <VirtualRobot/RobotNodeSet.h>
31#include <VirtualRobot/XML/RobotIO.h>
32#include <VirtualRobot/math/Helpers.h>
33
40
43
44
45using namespace Eigen;
46using namespace Ice;
47using namespace VirtualRobot;
48
49namespace armarx
50{
52 {
53 try
54 {
55 if (_synchronizedPrx)
56 {
57 _synchronizedPrx->unref();
58 }
59 }
60 catch (...)
61 {
62 }
63 }
64
67 {
68 defineRequiredProperty<std::string>("RobotNodeSetName",
69 "Set of nodes that is controlled by the KinematicUnit");
71 "RobotFileName", "Filename of VirtualRobot robot model (e.g. robot_model.xml)");
73 "AgentName", "Name of the agent for which the sensor values are provided");
75 "RobotStateReportingTopic",
76 "RobotStateUpdates",
77 "Name of the topic on which updates of the robot state are reported.");
79 "HistoryLength", 10000, "Number of entries in the robot state history")
80 .setMin(0);
81 defineOptionalProperty<float>("RobotModelScaling", 1.0f, "Scaling of the robot model");
83 "TopicPrefix", "", "Prefix for the sensor value topic name.");
84 defineOptionalProperty<std::string>("GlobalRobotPoseLocalizationTopicName",
85 "GlobalRobotPoseLocalization",
86 "Topic where the global robot pose can be reported.");
87 }
88
89 std::string
91 {
92 return "RobotStateComponent";
93 }
94
95 void
97 {
98 robotStateTopicName = getProperty<std::string>("RobotStateReportingTopic").getValue();
99 offeringTopic(getProperty<std::string>("RobotStateReportingTopic"));
100 const std::size_t historyLength =
101 static_cast<std::size_t>(getProperty<int>("HistoryLength").getValue());
102
103 jointHistory.clear();
104 jointHistoryLength = historyLength;
105
106 poseHistory.clear();
107 poseHistoryLength = historyLength;
108
109 relativeRobotFile = getProperty<std::string>("RobotFileName").getValue();
110
111 if (!ArmarXDataPath::getAbsolutePath(relativeRobotFile, robotFile))
112 {
113 throw UserException("Could not find robot file " + robotFile);
114 }
115
116 this->_synchronized =
117 VirtualRobot::RobotIO::loadRobot(robotFile, VirtualRobot::RobotIO::eStructure);
118 _synchronized->setName(getProperty<std::string>("AgentName").getValue());
119
120 robotModelScaling = getProperty<float>("RobotModelScaling").getValue();
121 ARMARX_INFO << "scale factor: " << robotModelScaling;
122 if (robotModelScaling != 1.0f)
123 {
124 ARMARX_INFO << "Scaling robot model with scale factor " << robotModelScaling;
125 _synchronized = _synchronized->clone(
126 _synchronized->getName(), _synchronized->getCollisionChecker(), robotModelScaling);
127 }
128
129 if (this->_synchronized)
130 {
131 ARMARX_VERBOSE << "Loaded robot from file " << robotFile
132 << ". Robot name: " << this->_synchronized->getName();
133 this->_synchronized->setPropagatingJointValuesEnabled(false);
134 }
135 else
136 {
137 ARMARX_VERBOSE << "Failed loading robot from file " << robotFile;
138 }
139
140 robotNodeSetName = getProperty<std::string>("RobotNodeSetName").getValue();
141
142
143 if (robotNodeSetName.empty())
144 {
145 throw UserException("RobotNodeSet not defined");
146 }
147
148 VirtualRobot::RobotNodeSetPtr rns = this->_synchronized->getRobotNodeSet(robotNodeSetName);
149
150 if (!rns)
151 {
152 throw UserException("RobotNodeSet not defined");
153 }
154
155 std::vector<RobotNodePtr> nodes = rns->getAllRobotNodes();
156
157 ARMARX_VERBOSE << "Using RobotNodeSet " << robotNodeSetName << " with " << nodes.size()
158 << " robot nodes.";
159 for (const RobotNodePtr& node : nodes)
160 {
161 ARMARX_VERBOSE << "Node: " << node->getName();
162 }
163 const auto topicPrefix = getProperty<std::string>("TopicPrefix").getValue();
164 usingTopic(topicPrefix + robotNodeSetName + "State");
165
166 usingTopic(topicPrefix +
167 getProperty<std::string>("GlobalRobotPoseLocalizationTopicName").getValue());
168
169 try
170 {
171 readRobotInfo(robotFile);
172 }
173 catch (const std::exception& e)
174 {
175 ARMARX_WARNING << "Failed to read robot info from file: " << robotFile
176 << ".\nReason: " << e.what();
177 }
178 catch (...)
179 {
180 ARMARX_WARNING << "Failed to read robot info from file: " << robotFile
181 << " for unknown reason.";
182 }
183 usingTopic("SimulatorResetEvent");
184 }
185
186 void
187 RobotStateComponent::readRobotInfo(const std::string& robotFile)
188 {
190 RapidXmlReaderNode robotNode = reader->getRoot("Robot");
191 robotInfo = readRobotInfo(robotNode.first_node("RobotInfo"));
192 }
193
194 RobotInfoNodePtr
195 RobotStateComponent::readRobotInfo(const RapidXmlReaderNode& infoNode)
196 {
197 std::string name = infoNode.name();
198 std::string profile = infoNode.attribute_value_or_default("profile", "");
199 std::string value = infoNode.attribute_value_or_default("value", "");
200 //ARMARX_IMPORTANT << "name: " << name << "; profile: " << profile << "; value: " << value;
201 std::vector<RobotInfoNodePtr> children;
202 for (const RapidXmlReaderNode& childNode : infoNode.nodes())
203 {
204 children.push_back(readRobotInfo(childNode));
205 }
206 return new RobotInfoNode(name, profile, value, children);
207 }
208
209 void
211 {
212 robotStateListenerPrx = getTopic<RobotStateListenerInterfacePrx>(
213 getProperty<std::string>("RobotStateReportingTopic"));
214 _sharedRobotServant =
215 new SharedRobotServant(this->_synchronized,
216 RobotStateComponentInterfacePrx::uncheckedCast(getProxy()),
217 robotStateListenerPrx);
218 _sharedRobotServant->ref();
219
220 _sharedRobotServant->setRobotStateComponent(
221 RobotStateComponentInterfacePrx::uncheckedCast(getProxy()));
222 this->_synchronizedPrx = SharedRobotInterfacePrx::uncheckedCast(
223 getObjectAdapter()->addWithUUID(_sharedRobotServant));
224 ARMARX_INFO << "Started RobotStateComponent" << flush;
225 if (robotStateObs)
226 {
227 robotStateObs->setRobot(_synchronized);
228 }
229 }
230
231 void
235
238 {
239 if (!this->_synchronizedPrx)
240 {
241 throw NotInitializedException("Shared Robot is NULL", "getSynchronizedRobot");
242 }
243 return this->_synchronizedPrx;
244 }
245
247 RobotStateComponent::getRobotSnapshot(const std::string& deprecated, const Current&)
248 {
249 (void)deprecated;
250
251 if (!_synchronized)
252 {
253 throw NotInitializedException("Shared Robot is NULL", "getRobotSnapshot");
254 }
255
256 auto clone = this->_synchronized->clone(_synchronized->getName());
257
259 clone, RobotStateComponentInterfacePrx::uncheckedCast(getProxy()), nullptr);
260 p->setTimestamp(
261 IceUtil::Time::microSecondsDouble(_sharedRobotServant->getTimestamp()->timestamp));
262 auto result = getObjectAdapter()->addWithUUID(p);
263 // virtal robot clone is buggy -> set global pose here
264 p->setGlobalPose(new Pose(_synchronized->getGlobalPose()));
265 return SharedRobotInterfacePrx::uncheckedCast(result);
266 }
267
270 {
271 const IceUtil::Time time = IceUtil::Time::microSecondsDouble(_time);
272
273 if (!_synchronized)
274 {
275 throw NotInitializedException("Shared Robot is NULL", "getRobotSnapshot");
276 }
277
278 VirtualRobot::RobotPtr clone = this->_synchronized->clone(_synchronized->getName());
279 auto config = interpolate(time);
280 if (!config)
281 {
282 ARMARX_WARNING << "Could not find or interpolate a robot state for time "
283 << time.toDateTime();
284 return nullptr;
285 }
286
287 clone->setJointValues(config->jointMap);
289 clone, RobotStateComponentInterfacePrx::uncheckedCast(getProxy()), nullptr);
290 p->setTimestamp(time);
291 auto result = getObjectAdapter()->addWithUUID(p);
292 // Virtal robot clone is buggy -> set global pose here.
293 p->setGlobalPose(config->globalPose);
294
295 return SharedRobotInterfacePrx::uncheckedCast(result);
296 }
297
298 NameValueMap
300 {
301 auto jointAngles = interpolateJoints(IceUtil::Time::microSecondsDouble(timestamp));
302 return jointAngles ? jointAngles->value : NameValueMap();
303 }
304
305 RobotStateConfig
307 {
308 auto config = interpolate(IceUtil::Time::microSecondsDouble(timestamp));
309 return config ? *config : RobotStateConfig();
310 }
311
312 std::string
313 RobotStateComponent::getRobotFilename(const Ice::Current&) const
314 {
315 return relativeRobotFile;
316 }
317
318 float
319 RobotStateComponent::getScaling(const Ice::Current&) const
320 {
321 return robotModelScaling;
322 }
323
324 RobotInfoNodePtr
325 RobotStateComponent::getRobotInfo(const Ice::Current&) const
326 {
327 return robotInfo;
328 }
329
330 void
331 RobotStateComponent::reportJointAngles(const NameValueMap& jointAngles,
332 Ice::Long timestamp,
333 bool aValueChanged,
334 const Current&)
335 {
336 if (timestamp <= 0)
337 {
338 timestamp = armarx::rtNow().toMicroSeconds();
339 }
340
341 IceUtil::Time time = mapRtTimestampToNonRtTimestamp(IceUtil::Time::microSeconds(timestamp));
342
343 ARMARX_DEBUG << deactivateSpam(1) << "Got new jointangles: " << jointAngles
344 << " from timestamp " << time.toDateTime()
345 << " a value changed: " << aValueChanged;
346
347 if (aValueChanged)
348 {
349 {
350 WriteLockPtr lock = _synchronized->getWriteLock();
351
352 _synchronized->setJointValues(jointAngles);
353 }
354
355 if (robotStateObs)
356 {
357 robotStateObs->updatePoses();
358 }
359 }
360 if (_sharedRobotServant)
361 {
362 _sharedRobotServant->setTimestamp(time);
363 }
364
365 {
366 std::unique_lock lock(jointHistoryMutex);
367 jointHistory.emplace_hint(jointHistory.end(), time, jointAngles);
368
369 if (jointHistory.size() > jointHistoryLength)
370 {
371 jointHistory.erase(jointHistory.begin());
372 }
373 }
374
375 robotStateListenerPrx->reportJointValues(jointAngles, timestamp, aValueChanged);
376 }
377
378 void
379 RobotStateComponent::reportGlobalRobotPose(const TransformStamped& globalRobotPose,
380 const Ice::Current&)
381 {
382 if (_synchronized)
383 {
384 std::string localRobotName = _synchronized->getName();
385 ARMARX_DEBUG << "Comparing " << localRobotName << " and "
386 << globalRobotPose.header.agent << ".";
387 if (localRobotName == globalRobotPose.header.agent)
388 {
389 const IceUtil::Time time =
390 IceUtil::Time::microSeconds(globalRobotPose.header.timestampInMicroSeconds);
391
392 insertPose(time, globalRobotPose.transform);
393 _synchronized->setGlobalPose(globalRobotPose.transform);
394
395 if (_sharedRobotServant)
396 {
397 _sharedRobotServant->setGlobalPose(new Pose(globalRobotPose.transform));
398 _sharedRobotServant->setTimestamp(time);
399 }
400 }
401 }
402 else
403 {
404 throw NotInitializedException("Robot Ptr is NULL", "reportGlobalRobotPose");
405 }
406 }
407
408 std::vector<std::string>
410 {
411 std::vector<std::string> result;
413 packages.push_back(Application::GetProjectName());
414
415 for (const std::string& projectName : packages)
416 {
417 if (projectName.empty())
418 {
419 continue;
420 }
421
422 result.push_back(projectName);
423 }
424
425 return result;
426 }
427
428 void
429 RobotStateComponent::reportControlModeChanged(const NameControlModeMap& jointModes,
430 Ice::Long timestamp,
431 bool aValueChanged,
432 const Current&)
433 {
434 // Unused.
435 (void)jointModes, (void)timestamp, (void)aValueChanged;
436 }
437
438 void
439 RobotStateComponent::reportJointVelocities(const NameValueMap& jointVelocities,
440 Ice::Long timestamp,
441 bool aValueChanged,
442 const Current&)
443 {
444 // Unused.
445 (void)aValueChanged;
446 if (robotStateObs)
447 {
448 robotStateObs->updateNodeVelocities(jointVelocities, timestamp);
449 }
450 }
451
452 void
453 RobotStateComponent::reportJointTorques(const NameValueMap& jointTorques,
454 Ice::Long timestamp,
455 bool aValueChanged,
456 const Current&)
457 {
458 // Unused.
459 (void)jointTorques, (void)timestamp, (void)aValueChanged;
460 }
461
462 void
463 RobotStateComponent::reportJointAccelerations(const NameValueMap& jointAccelerations,
464 Ice::Long timestamp,
465 bool aValueChanged,
466 const Current&)
467 {
468 // Unused.
469 (void)jointAccelerations, (void)timestamp, (void)aValueChanged;
470 }
471
472 void
473 RobotStateComponent::reportJointCurrents(const NameValueMap& jointCurrents,
474 Ice::Long timestamp,
475 bool aValueChanged,
476 const Current&)
477 {
478 // Unused.
479 (void)jointCurrents, (void)timestamp, (void)aValueChanged;
480 }
481
482 void
483 RobotStateComponent::reportJointMotorTemperatures(const NameValueMap& jointMotorTemperatures,
484 Ice::Long timestamp,
485 bool aValueChanged,
486 const Current&)
487 {
488 // Unused.
489 (void)jointMotorTemperatures, (void)timestamp, (void)aValueChanged;
490 }
491
492 void
493 RobotStateComponent::reportJointStatuses(const NameStatusMap& jointStatuses,
494 Ice::Long timestamp,
495 bool aValueChanged,
496 const Current&)
497 {
498 // Unused.
499 (void)jointStatuses, (void)timestamp, (void)aValueChanged;
500 }
501
502 void
504 {
505 {
506 std::lock_guard lock(poseHistoryMutex);
507 poseHistory.clear();
508 }
509 {
510 std::lock_guard lock(jointHistoryMutex);
511 jointHistory.clear();
512 }
513 }
514
520
521 void
523 {
524 robotStateObs = observer;
525 }
526
527 std::string
529 {
530 if (_synchronized)
531 {
532 return _synchronized->getName(); // _synchronizedPrx->getName();
533 }
534 else
535 {
536 throw NotInitializedException("Robot Ptr is NULL", "getName");
537 }
538 }
539
540 std::string
542 {
543 if (robotNodeSetName.empty())
544 {
545 throw NotInitializedException("RobotNodeSetName is empty", "getRobotNodeSetName");
546 }
547 return robotNodeSetName;
548 }
549
550 std::string
552 {
553 return robotStateTopicName;
554 }
555
556 void
557 RobotStateComponent::insertPose(IceUtil::Time timestamp, const Matrix4f& globalPose)
558 {
559 IceUtil::Time duration;
560 {
561 IceUtil::Time start = IceUtil::Time::now();
562 std::unique_lock lock(poseHistoryMutex);
563 duration = IceUtil::Time::now() - start;
564
565 poseHistory.emplace_hint(
566 poseHistory.end(), timestamp, new FramedPose(globalPose, GlobalFrame, ""));
567
568 if (poseHistory.size() > poseHistoryLength)
569 {
570 poseHistory.erase(poseHistory.begin());
571 }
572 }
573
574 if (robotStateObs)
575 {
576 robotStateObs->updatePoses();
577 }
578 }
579
580 std::optional<RobotStateConfig>
581 RobotStateComponent::interpolate(IceUtil::Time time) const
582 {
583 auto joints = interpolateJoints(time);
584 auto globalPose = interpolatePose(time);
585
586 if (joints && globalPose)
587 {
588 RobotStateConfig config;
589 // Use time stamp from interpolation.
590 // config.timestamp = time.toMicroSeconds();
591 config.timestamp = std::min(joints->timestamp, globalPose->timestamp).toMicroSeconds();
592 config.jointMap = joints->value;
593 config.globalPose = globalPose->value;
594 return config;
595 }
596 else
597 {
598 return std::nullopt;
599 }
600 }
601
602 auto
603 RobotStateComponent::interpolateJoints(IceUtil::Time time) const
604 -> std::optional<Timestamped<NameValueMap>>
605 {
606 std::shared_lock lock(jointHistoryMutex);
607 if (jointHistory.empty())
608 {
610 << "Joint history of robot state component is empty!";
611 return std::nullopt;
612 }
613
614 const IceUtil::Time newestTimeInHistory = jointHistory.rbegin()->first;
615 if (time > newestTimeInHistory)
616 {
617 const IceUtil::Time minOffset = IceUtil::Time::milliSeconds(25);
618 const IceUtil::Time maxOffset = IceUtil::Time::seconds(2);
619 if (time > newestTimeInHistory + maxOffset)
620 {
622 << "Requested joint timestamp is substantially newer (>"
623 << maxOffset.toSecondsDouble()
624 << " sec) than newest available timestamp!"
625 << "\n- requested timestamp: \t" << time.toDateTime()
626 << "\n- newest timestamp: \t" << newestTimeInHistory.toDateTime();
627 return std::nullopt;
628 }
629 else if (time > newestTimeInHistory + minOffset)
630 {
632 << "Requested joint timestamp is newer than newest available timestamp!"
633 << "\n- requested timestamp: \t" << time.toDateTime()
634 << "\n- newest timestamp: \t" << newestTimeInHistory.toDateTime()
635 << "\n- difference: \t"
636 << (time - newestTimeInHistory).toMicroSeconds() << " us";
637 }
638
639 return Timestamped<NameValueMap>{jointHistory.rbegin()->first,
640 jointHistory.rbegin()->second};
641 }
642
643 // Get the oldest entry whose time >= time.
644 auto nextIt = jointHistory.lower_bound(time);
645 if (nextIt == jointHistory.end())
646 {
648 << "Could not find or interpolate a robot joint angles for time "
649 << time.toDateTime() << "\n- oldest available value: "
650 << jointHistory.begin()->first.toDateTime()
651 << "\n- newest available value: " << newestTimeInHistory.toDateTime();
652 return std::nullopt;
653 }
654
655 if (nextIt == jointHistory.begin())
656 {
657 // Next was oldest entry.
658 return Timestamped<NameValueMap>{nextIt->first, nextIt->second};
659 }
660
661 const NameValueMap& next = nextIt->second;
662 auto prevIt = std::prev(nextIt);
663
664
665 // Interpolate.
666
667 IceUtil::Time prevTime = prevIt->first;
668 IceUtil::Time nextTime = nextIt->first;
669
670 float t = static_cast<float>((time - prevTime).toSecondsDouble() /
671 (nextTime - prevTime).toSecondsDouble());
672
674 auto prevJointIt = prevIt->second.begin();
675 for (const auto& [name, nextAngle] : next)
676 {
677 float value = (1 - t) * prevJointIt->second + t * nextAngle;
678 prevJointIt++;
679
680 jointAngles.emplace(name, value);
681 }
682
683 return Timestamped<NameValueMap>{time, std::move(jointAngles)};
684 }
685
686 auto
687 RobotStateComponent::interpolatePose(IceUtil::Time time) const
688 -> std::optional<Timestamped<FramedPosePtr>>
689 {
690 std::shared_lock lock(poseHistoryMutex);
691
692 if (poseHistory.empty())
693 {
695 << "Pose history is empty. This can happen if there is no platform unit.";
696
697 ReadLockPtr readLock = _synchronized->getReadLock();
698
699 FramedPosePtr pose =
700 new FramedPose(_synchronized->getGlobalPose(), armarx::GlobalFrame, "");
701 return Timestamped<FramedPosePtr>{IceUtil::Time::seconds(0), pose};
702 }
703
704
705 const IceUtil::Time newestTimeInHistory = poseHistory.rbegin()->first;
706 if (time > newestTimeInHistory)
707 {
708 IceUtil::Time maxOffset = IceUtil::Time::seconds(2);
709 if (time <= newestTimeInHistory + maxOffset)
710 {
712 << "Requested pose timestamp is newer than newest available timestamp!"
713 << "\n- requested timestamp: \t" << time.toDateTime()
714 << "\n- newest timestamp: \t" << newestTimeInHistory.toDateTime()
715 << "\n- difference: \t"
716 << (time - newestTimeInHistory).toMicroSeconds() << " us";
717 }
718 else
719 {
721 << "Requested pose timestamp is substantially newer (>"
722 << maxOffset.toSecondsDouble()
723 << " sec) than newest available timestamp!"
724 << "\n- requested timestamp: \t" << time.toDateTime()
725 << "\n- newest timestamp: \t" << newestTimeInHistory.toDateTime();
726 return std::nullopt;
727 }
728 return Timestamped<FramedPosePtr>{poseHistory.rbegin()->first,
729 poseHistory.rbegin()->second};
730 }
731
732
733 auto nextIt = poseHistory.lower_bound(time);
734 if (nextIt == poseHistory.end())
735 {
737 << "Could not find or interpolate platform pose for time "
738 << time.toDateTime() << "\n- oldest available value: "
739 << jointHistory.begin()->first.toDateTime()
740 << "\n- newest available value: " << newestTimeInHistory.toDateTime();
741 return std::nullopt;
742 }
743
744
745 if (nextIt == poseHistory.begin())
746 {
747 // Next was oldest entry.
748 return Timestamped<FramedPosePtr>{nextIt->first, nextIt->second};
749 }
750
751 auto prevIt = std::prev(nextIt);
752 ARMARX_CHECK_EXPRESSION(prevIt->second);
753
754 const FramedPosePtr& next = nextIt->second;
755 const FramedPosePtr& prev = prevIt->second;
756
757
758 // Interpolate.
759
760 IceUtil::Time prevTime = prevIt->first;
761 IceUtil::Time nextTime = nextIt->first;
762
763 float t = static_cast<float>((time - prevTime).toSecondsDouble() /
764 (nextTime - prevTime).toSecondsDouble());
765
766 Eigen::Matrix4f globalPoseNext = next->toEigen();
767 Eigen::Matrix4f globalPosePrev = prev->toEigen();
768
769
770 Eigen::Matrix4f globalPose;
771
772 math::Helpers::Position(globalPose) = (1 - t) * math::Helpers::Position(globalPosePrev) +
773 t * math::Helpers::Position(globalPoseNext);
774
775 Eigen::Quaternionf rotNext(math::Helpers::Orientation(globalPoseNext));
776 Eigen::Quaternionf rotPrev(math::Helpers::Orientation(globalPosePrev));
777 Eigen::Quaternionf rotNew = rotPrev.slerp(t, rotNext);
778
779 math::Helpers::Orientation(globalPose) = rotNew.toRotationMatrix();
780
781 return Timestamped<FramedPosePtr>{time,
782 new FramedPose(globalPose, armarx::GlobalFrame, "")};
783 }
784
785} // namespace armarx
std::string timestamp()
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
Definition Logging.cpp:75
static const std::string & GetProjectName()
static const Ice::StringSeq & GetProjectDependencies()
static bool getAbsolutePath(const std::string &relativeFilename, std::string &storeAbsoluteFilename, const std::vector< std::string > &additionalSearchPaths={}, bool verbose=true)
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
Property< PropertyType > getProperty(const std::string &name)
The FramedPose class.
Definition FramedPose.h:281
SpamFilterDataPtr deactivateSpam(float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
disables the logging for the current line for the given amount of seconds.
Definition Logging.cpp:99
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
Ice::ObjectAdapterPtr getObjectAdapter() const
Returns object's Ice adapter.
void usingTopic(const std::string &name, bool orderedPublishing=false)
Registers a proxy for subscription after initialization.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
The Pose class.
Definition Pose.h:243
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
PropertyDefinition< PropertyType > & defineRequiredProperty(const std::string &name, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
RapidXmlReaderNode first_node(const char *name=nullptr) const
static RapidXmlReaderPtr FromFile(const std::string &path)
void onInitComponent() override
Load and create a VirtualRobot::Robot instance from the RobotFileName property.
void reportJointMotorTemperatures(const NameValueMap &jointMotorTemperatures, Ice::Long timestamp, bool aValueChanged, const Ice::Current &c=Ice::emptyCurrent) override
Does nothing.
void reportJointVelocities(const NameValueMap &jointVelocities, Ice::Long timestamp, bool aValueChanged, const Ice::Current &c=Ice::emptyCurrent) override
Sends the joint velocities to the robot state observer.
void reportJointAngles(const NameValueMap &jointAngles, Ice::Long timestamp, bool aValueChanged, const Ice::Current &c=Ice::emptyCurrent) override
Stores the reported joint angles in the joint history and publishes the new joint angles.
float getScaling(const Ice::Current &) const override
void onDisconnectComponent() override
Hook for subclass.
void reportJointTorques(const NameValueMap &jointTorques, Ice::Long timestamp, bool aValueChanged, const Ice::Current &c=Ice::emptyCurrent) override
Does nothing.
std::vector< std::string > getArmarXPackages(const Ice::Current &) const override
void reportGlobalRobotPose(const TransformStamped &globalRobotPose, const Ice::Current &=Ice::Current()) override
std::string getRobotName(const Ice::Current &) const override
RobotStateConfig getRobotStateAtTimestamp(double timestamp, const Ice::Current &) const override
SharedRobotInterfacePrx getSynchronizedRobot(const Ice::Current &) const override
void reportControlModeChanged(const NameControlModeMap &jointModes, Ice::Long timestamp, bool aValueChanged, const Ice::Current &c=Ice::emptyCurrent) override
Does nothing.
void reportJointCurrents(const NameValueMap &jointCurrents, Ice::Long timestamp, bool aValueChanged, const Ice::Current &c=Ice::emptyCurrent) override
Does nothing.
std::string getRobotStateTopicName(const Ice::Current &) const override
void onConnectComponent() override
Setup RobotStateObjectFactories needed for creating RemoteRobot instances.
SharedRobotInterfacePrx getRobotSnapshot(const std::string &deprecated, const Ice::Current &) override
Creates a snapshot of the robot state at this moment in time.
void reportJointAccelerations(const NameValueMap &jointAccelerations, Ice::Long timestamp, bool aValueChanged, const Ice::Current &c) override
Does nothing.
void reportJointStatuses(const NameStatusMap &jointStatuses, Ice::Long timestamp, bool aValueChanged, const Ice::Current &c=Ice::emptyCurrent) override
Does nothing.
PropertyDefinitionsPtr createPropertyDefinitions() override
Create an instance of RobotStatePropertyDefinitions.
RobotInfoNodePtr getRobotInfo(const Ice::Current &) const override
std::string getRobotNodeSetName(const Ice::Current &) const override
void setRobotStateObserver(RobotStateObserverPtr observer)
std::string getRobotFilename(const Ice::Current &) const override
NameValueMap getJointConfigAtTimestamp(double timestamp, const Ice::Current &) const override
void simulatorWasReset(const Ice::Current &=Ice::emptyCurrent) override
~RobotStateComponent() override
Calls unref() on RobotStateComponent::_synchronizedPrx.
std::string getDefaultName() const override
Retrieve default name of component.
SharedRobotInterfacePrx getRobotSnapshotAtTimestamp(double time, const Ice::Current &current) override
The SharedRobotNodeServant class is a remote represenation of a Simox VirtualRobot::Robot.
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
Definition Logging.h:184
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
Definition Logging.h:193
#define ARMARX_VERBOSE
The logging level for verbose information.
Definition Logging.h:187
std::string const GlobalFrame
Variable of the global coordinate system.
Definition FramedPose.h:65
Quaternion< float, 0 > Quaternionf
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
const KinematicUnitDatafieldCreator jointAngles("jointAngles")
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Time mapRtTimestampToNonRtTimestamp(const IceUtil::Time &time_monotic_raw)
Definition NonRtTiming.h:46
std::shared_ptr< RapidXmlReader > RapidXmlReaderPtr
IceUtil::Time rtNow()
Definition RtTiming.h:40
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::SharedRobotInterface > SharedRobotInterfacePrx
Definition FramedPose.h:59
const LogSender::manipulator flush
Definition LogSender.h:251
IceInternal::Handle< SharedRobotServant > SharedRobotServantPtr
IceInternal::Handle< RobotStateObserver > RobotStateObserverPtr
IceInternal::Handle< FramedPose > FramedPosePtr
Definition FramedPose.h:272
std::shared_ptr< Value > value()
Definition cxxopts.hpp:855