FramedPose.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-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
19 * @author
20 * @date
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25
26#include <Eigen/Core>
27#include <Eigen/Geometry>
28
29#include <VirtualRobot/LinkedCoordinate.h>
30#include <VirtualRobot/Robot.h>
31#include <VirtualRobot/RobotConfig.h>
32#include <VirtualRobot/VirtualRobot.h>
33
37
40
41
42using namespace Eigen;
43
44template class ::IceInternal::Handle<::armarx::FramedPose>;
45template class ::IceInternal::Handle<::armarx::FramedPosition>;
46template class ::IceInternal::Handle<::armarx::FramedDirection>;
47template class ::IceInternal::Handle<::armarx::FramedOrientation>;
48
49namespace armarx
50{
51
52
53 FramedDirection::FramedDirection() = default;
54
56 IceUtil::Shared(source),
57 armarx::Serializable(source),
58 Vector3Base(source),
59 FramedDirectionBase(source),
60 Vector3(source)
61 {
62 }
63
64 FramedDirection::FramedDirection(const Eigen::Vector3f& vec,
65 const std::string& frame,
66 const std::string& agent) :
67 Vector3(vec)
68 {
69 this->frame = frame;
70 this->agent = agent;
71 }
72
74 ::Ice::Float y,
75 ::Ice::Float z,
76 const std::string& frame,
77 const std::string& agent) :
78 Vector3(x, y, z)
79 {
80 this->frame = frame;
81 this->agent = agent;
82 }
83
84 std::string
86 {
87 return frame;
88 }
89
91 FramedDirection::ChangeFrame(const VirtualRobot::RobotConstPtr& robot,
92 const FramedDirection& framedVec,
93 const std::string& newFrame)
94 {
96 return ChangeFrame(*robot, framedVec, newFrame);
97 }
98
100 FramedDirection::ChangeFrame(const VirtualRobot::Robot& robot,
101 const FramedDirection& framedVec,
102 const std::string& newFrame)
103 {
104 if (framedVec.getFrame() == newFrame)
105 {
106 return FramedDirectionPtr::dynamicCast(framedVec.clone());
107 }
108
109 if (!robot.hasRobotNode(newFrame))
110 {
111 throw LocalException() << "The requested frame '" << newFrame
112 << "' does not exists in the robot " << robot.getName();
113 }
114
115 Eigen::Matrix4f rotToNewFrame =
116 __GetRotationBetweenFrames(framedVec.frame, newFrame, robot);
117
118 Eigen::Vector3f vecOldFrame = framedVec.Vector3::toEigen();
119
120 Eigen::Vector3f newVec = rotToNewFrame.block(0, 0, 3, 3).inverse() * vecOldFrame;
121
122 FramedDirectionPtr result = new FramedDirection();
123 result->x = newVec(0);
124 result->y = newVec(1);
125 result->z = newVec(2);
126 result->frame = newFrame;
127 result->agent = robot.getName();
128 return result;
129 }
130
131 void
132 FramedDirection::changeFrame(const VirtualRobot::RobotConstPtr& robot, const std::string& newFrame)
133 {
135 changeFrame(*robot, newFrame);
136 }
137
138 void
139 FramedDirection::changeFrame(const VirtualRobot::Robot& robot, const std::string& newFrame)
140 {
141 if (frame == "")
142 {
143 frame = GlobalFrame;
144 }
145
146
147 if (getFrame() == newFrame)
148 {
149 return;
150 }
151
152 if (newFrame == GlobalFrame)
153 {
154 changeToGlobal(robot);
155 return;
156 }
157
158 if (!robot.hasRobotNode(newFrame))
159 {
160 throw LocalException() << "The requested frame '" << newFrame
161 << "' does not exist in the robot " << robot.getName();
162 }
163
164 if (frame != GlobalFrame && !robot.hasRobotNode(frame))
165 {
166 throw LocalException() << "The current frame '" << frame
167 << "' does not exist in the robot " << robot.getName();
168 }
169
170
171 Eigen::Matrix4f rotToNewFrame = __GetRotationBetweenFrames(frame, newFrame, robot);
172
173 Eigen::Vector3f vecOldFrame = Vector3::toEigen();
174
175 Eigen::Vector3f newVec = rotToNewFrame.block(0, 0, 3, 3).inverse() * vecOldFrame;
176
177
178 x = newVec(0);
179 y = newVec(1);
180 z = newVec(2);
181 frame = newFrame;
182 agent = robot.getName();
183 }
184
185 void
187 {
188 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
189 changeToGlobal(sharedRobot);
190 }
191
192 void
193 FramedDirection::changeToGlobal(const VirtualRobot::RobotConstPtr& referenceRobot)
194 {
195 ARMARX_CHECK_NOT_NULL(referenceRobot);
196 changeToGlobal(*referenceRobot);
197 }
198
199 void
200 FramedDirection::changeToGlobal(const VirtualRobot::Robot& referenceRobot)
201 {
202 if (frame == GlobalFrame)
203 {
204 return;
205 }
206
207 changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
208 Eigen::Vector3f pos =
209 referenceRobot.getRootNode()->getGlobalPose().block<3, 3>(0, 0) * toEigen();
210 x = pos[0];
211 y = pos[1];
212 z = pos[2];
213 frame = GlobalFrame;
214 agent = "";
215 }
216
219 {
220 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
221 return toGlobal(sharedRobot);
222 }
223
225 FramedDirection::toGlobal(const VirtualRobot::RobotConstPtr& referenceRobot) const
226 {
227 ARMARX_CHECK_NOT_NULL(referenceRobot);
228 return toGlobal(*referenceRobot);
229 }
230
232 FramedDirection::toGlobal(const VirtualRobot::Robot& referenceRobot) const
233 {
234 FramedDirectionPtr newDirection = FramedDirectionPtr::dynamicCast(this->clone());
235 newDirection->changeToGlobal(referenceRobot);
236 return newDirection;
237 }
238
239 Eigen::Vector3f
241 {
242 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
243 return toGlobalEigen(sharedRobot);
244 }
245
246 Eigen::Vector3f
247 FramedDirection::toGlobalEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
248 {
249 ARMARX_CHECK_NOT_NULL(referenceRobot);
250 return toGlobalEigen(*referenceRobot);
251 }
252
253 Eigen::Vector3f
254 FramedDirection::toGlobalEigen(const VirtualRobot::Robot& referenceRobot) const
255 {
256 FramedDirection newDirection(toEigen(), frame, agent);
257 newDirection.changeToGlobal(referenceRobot);
258 return newDirection.toEigen();
259 }
260
263 {
264 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
265 return toRootFrame(sharedRobot);
266 }
267
269 FramedDirection::toRootFrame(const VirtualRobot::RobotConstPtr& referenceRobot) const
270 {
271 ARMARX_CHECK_NOT_NULL(referenceRobot);
272 return toRootFrame(*referenceRobot);
273 }
274
276 FramedDirection::toRootFrame(const VirtualRobot::Robot& referenceRobot) const
277 {
278 FramedDirectionPtr newDirection = FramedDirectionPtr::dynamicCast(this->clone());
279 newDirection->changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
280 return newDirection;
281 }
282
283 Eigen::Vector3f
285 {
286 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
287 return toRootEigen(sharedRobot);
288 }
289
290 Eigen::Vector3f
291 FramedDirection::toRootEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
292 {
293 ARMARX_CHECK_NOT_NULL(referenceRobot);
294 return toRootEigen(*referenceRobot);
295 }
296
297 Eigen::Vector3f
298 FramedDirection::toRootEigen(const VirtualRobot::Robot& referenceRobot) const
299 {
300 FramedDirection newDirection(toEigen(), frame, agent);
301 newDirection.changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
302 return newDirection.toEigen();
303 }
304
305 std::string
306 FramedDirection::output(const Ice::Current& c) const
307 {
308 std::stringstream s;
309 s << toEigen().format(ArmarXEigenFormat) << std::endl
310 << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent));
311 return s.str();
312 }
313
314 Eigen::Matrix4f
315 FramedDirection::__GetRotationBetweenFrames(const std::string& oldFrame,
316 const std::string& newFrame,
317 const VirtualRobot::Robot& robotState)
318 {
319 Eigen::Matrix4f toNewFrame;
320
321 if (oldFrame == GlobalFrame)
322 {
323 auto node = robotState.getRobotNode(newFrame);
324 ARMARX_CHECK_EXPRESSION(node) << newFrame;
325 toNewFrame = node->getGlobalPose();
326 }
327 else
328 {
329 auto node = robotState.getRobotNode(oldFrame);
331 << "old frame: " + oldFrame +
332 ValueToString(robotState.getConfig()->getRobotNodeJointValueMap());
333 auto newNode = robotState.getRobotNode(newFrame);
334 ARMARX_CHECK_EXPRESSION(newNode) << newFrame;
335 toNewFrame = node->getTransformationTo(newNode);
336 }
337
338 toNewFrame(0, 3) = 0;
339 toNewFrame(1, 3) = 0;
340 toNewFrame(2, 3) = 0;
341
342 return toNewFrame;
343 }
344
345 void
346 FramedDirection::serialize(const ObjectSerializerBasePtr& serializer, const Ice::Current&) const
347 {
348 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
349 Vector3::serialize(serializer);
350 obj->setString("frame", frame);
351 obj->setString("agent", agent);
352 }
353
354 void
355 FramedDirection::deserialize(const ObjectSerializerBasePtr& serializer, const Ice::Current&)
356 {
357 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
358 Vector3::deserialize(serializer);
359 frame = obj->getString("frame");
360
361 if (obj->hasElement("agent"))
362 {
363 agent = obj->getString("agent");
364 }
365 }
366
367 Ice::ObjectPtr
369 {
370 return this->clone();
371 }
372
373 VariantDataClassPtr
374 FramedDirection::clone(const Ice::Current& c) const
375 {
376 return new FramedDirection(*this);
377 }
378
380 FramedDirection::getType(const Ice::Current& c) const
381 {
383 }
384
385 bool
386 FramedDirection::validate(const Ice::Current& c)
387 {
388 return true;
389 }
390
391 std::ostream&
392 operator<<(std::ostream& stream, const FramedDirection& rhs)
393 {
394 stream << "FramedDirection: " << std::endl << rhs.output() << std::endl;
395 return stream;
396 }
397
399 {
400 frame = "";
401 }
402
404 IceUtil::Shared(pose),
405 armarx::Serializable(pose),
406 armarx::VariantDataClass(pose),
407 PoseBase(pose),
408 FramedPoseBase(pose),
409 Pose(pose)
410 {
411 }
412
413 FramedPose::FramedPose(const Eigen::Matrix3f& m,
414 const Eigen::Vector3f& v,
415 const std::string& s,
416 const std::string& agent) :
417 Pose(m, v)
418 {
419 frame = s;
420 this->agent = agent;
421 }
422
423 FramedPose::FramedPose(const Eigen::Matrix4f& m,
424 const std::string& s,
425 const std::string& agent) :
426 Pose(m)
427 {
428 frame = s;
429 this->agent = agent;
430 }
431
432 FramedPose::FramedPose(const armarx::Vector3BasePtr pos,
433 const armarx::QuaternionBasePtr ori,
434 const std::string& frame,
435 const std::string& agent) :
436 Pose(pos, ori)
437 {
438 this->frame = frame;
439 this->agent = agent;
440 }
441
442 FramedPose::FramedPose(const Eigen::Vector3f& pos,
443 const Eigen::Quaternionf& ori,
444 const std::string& frame,
445 const std::string& agent) :
446 Pose(pos, ori)
447 {
448 this->frame = frame;
449 this->agent = agent;
450 }
451
452 std::string
454 {
455 return frame;
456 }
457
458 std::string
459 FramedPose::output(const Ice::Current& c) const
460 {
461 std::stringstream s;
462 const Eigen::IOFormat ArmarXEigenFormat(Eigen::StreamPrecision, 4, " ", "\n", "", "");
463 s << toEigen().format(ArmarXEigenFormat) << std::endl
464 << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent));
465 return s.str();
466 }
467
468 void
470 const std::string& newFrame)
471 {
472 if (newFrame == frame)
473 {
474 return;
475 }
476
477 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
478 changeFrame(sharedRobot, newFrame);
479 }
480
481 void
482 FramedPose::changeFrame(const VirtualRobot::RobotConstPtr& referenceRobot,
483 const std::string& newFrame)
484 {
485 ARMARX_CHECK_NOT_NULL(referenceRobot);
486 changeFrame(*referenceRobot, newFrame);
487 }
488
489 void
490 FramedPose::changeFrame(const VirtualRobot::Robot& referenceRobot, const std::string& newFrame)
491 {
492 if (newFrame == frame)
493 {
494 return;
495 }
496
497 if (newFrame == GlobalFrame)
498 {
499 changeToGlobal(referenceRobot);
500 return;
501 }
502
503 Eigen::Matrix4f oldFrameTransformation = Eigen::Matrix4f::Identity();
504
505 if (frame != GlobalFrame and !referenceRobot.hasRobotNode(frame))
506 {
507 throw LocalException() << "The current frame '" << frame
508 << "' does not exists in the robot " << referenceRobot.getName();
509 }
510 if (!referenceRobot.hasRobotNode(newFrame))
511 {
512 throw LocalException() << "The requested frame '" << newFrame
513 << "' does not exists in the robot " << referenceRobot.getName();
514 }
515
516 if (frame != GlobalFrame)
517 {
518 oldFrameTransformation = referenceRobot.getRobotNode(frame)->getPoseInRootFrame();
519 }
520 else
521 {
522 oldFrameTransformation = referenceRobot.getRootNode()->getGlobalPose().inverse();
523 }
524
525 Eigen::Matrix4f newPose =
526 (referenceRobot.getRobotNode(newFrame)->getPoseInRootFrame().inverse() *
527 oldFrameTransformation) *
528 toEigen();
529
530 orientation = new Quaternion(newPose);
531 Eigen::Vector3f pos = newPose.block<3, 1>(0, 3);
532 position = new Vector3(pos);
533 frame = newFrame;
534 agent = referenceRobot.getName();
535 init();
536 }
537
538 void
540 {
541 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
542 changeToGlobal(sharedRobot);
543 }
544
545 void
546 FramedPose::changeToGlobal(const VirtualRobot::RobotConstPtr& referenceRobot)
547 {
548 ARMARX_CHECK_NOT_NULL(referenceRobot);
549 changeToGlobal(*referenceRobot);
550 }
551
552 void
553 FramedPose::changeToGlobal(const VirtualRobot::Robot& referenceRobot)
554 {
555 if (frame == GlobalFrame)
556 {
557 return;
558 }
559
560 changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
561 Eigen::Matrix4f global = referenceRobot.getRootNode()->getGlobalPose();
562 const Eigen::Matrix4f pose = global * toEigen();
563 position->x = pose(0, 3);
564 position->y = pose(1, 3);
565 position->z = pose(2, 3);
566 Eigen::Quaternionf q(pose.block<3, 3>(0, 0));
567 orientation->qw = q.w();
568 orientation->qx = q.x();
569 orientation->qy = q.y();
570 orientation->qz = q.z();
571 frame = GlobalFrame;
572 agent = "";
573 }
574
577 {
578 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
579 return toGlobal(sharedRobot);
580 }
581
583 FramedPose::toGlobal(const VirtualRobot::RobotConstPtr& referenceRobot) const
584 {
585 ARMARX_CHECK_NOT_NULL(referenceRobot);
586 return toGlobal(*referenceRobot);
587 }
588
590 FramedPose::toGlobal(const VirtualRobot::Robot& referenceRobot) const
591 {
592 FramedPosePtr newPose = FramedPosePtr::dynamicCast(this->clone());
593 newPose->changeToGlobal(referenceRobot);
594 return newPose;
595 }
596
597 Eigen::Matrix4f
599 {
600 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
601 return toGlobalEigen(sharedRobot);
602 }
603
604 Eigen::Matrix4f
605 FramedPose::toGlobalEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
606 {
607 ARMARX_CHECK_NOT_NULL(referenceRobot);
608 return toGlobalEigen(*referenceRobot);
609 }
610
611 Eigen::Matrix4f
612 FramedPose::toGlobalEigen(const VirtualRobot::Robot& referenceRobot) const
613 {
614 FramedPose newPose(toEigen(), frame, agent);
615 newPose.changeToGlobal(referenceRobot);
616 return newPose.toEigen();
617 }
618
621 {
622 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
623 return toRootFrame(sharedRobot);
624 }
625
627 FramedPose::toRootFrame(const VirtualRobot::RobotConstPtr& referenceRobot) const
628 {
629 ARMARX_CHECK_NOT_NULL(referenceRobot);
630 return toRootFrame(*referenceRobot);
631 }
632
634 FramedPose::toRootFrame(const VirtualRobot::Robot& referenceRobot) const
635 {
636 FramedPosePtr newPose = FramedPosePtr::dynamicCast(this->clone());
637 newPose->changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
638 return newPose;
639 }
640
641 Eigen::Matrix4f
643 {
644 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
645 return toRootEigen(sharedRobot);
646 }
647
648 Eigen::Matrix4f
649 FramedPose::toRootEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
650 {
651 ARMARX_CHECK_NOT_NULL(referenceRobot);
652 return toRootEigen(*referenceRobot);
653 }
654
655 Eigen::Matrix4f
656 FramedPose::toRootEigen(const VirtualRobot::Robot& referenceRobot) const
657 {
658 FramedPose newPose(toEigen(), frame, agent);
659 newPose.changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
660 return newPose.toEigen();
661 }
662
665 {
666 FramedPositionPtr result =
667 new FramedPosition(Vector3Ptr::dynamicCast(position)->toEigen(), frame, agent);
668 return result;
669 }
670
673 {
675 QuaternionPtr::dynamicCast(this->orientation)->toEigen(), frame, agent);
676 return result;
677 }
678
679 void
680 FramedPose::serialize(const ObjectSerializerBasePtr& serializer, const ::Ice::Current& c) const
681 {
682 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
683
684 Pose::serialize(obj, c);
685 obj->setString("frame", frame);
686 obj->setString("agent", agent);
687 }
688
689 void
690 FramedPose::deserialize(const ObjectSerializerBasePtr& serializer, const ::Ice::Current& c)
691 {
692 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
693
695 frame = obj->getString("frame");
696
697 if (obj->hasElement("agent"))
698 {
699 agent = obj->getString("agent");
700 }
701 }
702
704 {
705 frame = "";
706 }
707
708 FramedPosition::FramedPosition(const Eigen::Vector3f& v,
709 const std::string& s,
710 const std::string& agent) :
711 Vector3(v)
712 {
713 frame = s;
714 this->agent = agent;
715 }
716
717 FramedPosition::FramedPosition(const Eigen::Matrix4f& m,
718 const std::string& s,
719 const std::string& agent) :
720 Vector3(m)
721 {
722 frame = s;
723 this->agent = agent;
724 }
725
726 // this doesnt work for unknown reasons
727 // FramedPosition::FramedPosition(const Vector3BasePtr pos, const std::string &frame )
728 // {
729 // this->x = pos->x;
730 // this->y = pos->y;
731 // this->z = pos->z;
732 // this->frame = frame;
733 // }
734
735 std::string
737 {
738 return this->frame;
739 }
740
741 void
743 const std::string& newFrame)
744 {
745 if (newFrame == frame)
746 {
747 return;
748 }
749
750 if (!referenceRobot->hasRobotNode(newFrame))
751 {
752 throw LocalException()
753 << "The requested frame '" << newFrame << "' does not exists in the robot "
754 << referenceRobot->getName();
755 }
756
757 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
758 changeFrame(sharedRobot, newFrame);
759 }
760
761 void
762 FramedPosition::changeFrame(const VirtualRobot::RobotConstPtr& referenceRobot,
763 const std::string& newFrame)
764 {
765 ARMARX_CHECK_NOT_NULL(referenceRobot);
766 changeFrame(*referenceRobot, newFrame);
767 }
768
769 void
770 FramedPosition::changeFrame(const VirtualRobot::Robot& referenceRobot,
771 const std::string& newFrame)
772 {
773 if (newFrame == frame)
774 {
775 return;
776 }
777
778 if (newFrame == GlobalFrame)
779 {
780 changeToGlobal(referenceRobot);
781 return;
782 }
783
784 if (newFrame.empty())
785 {
786 ARMARX_WARNING_S << "Frame Conversion: Frame is empty, always set frame names! "
787 "...assuming GlobalFrame";
788 changeToGlobal(referenceRobot);
789 return;
790 }
791
792 Eigen::Matrix4f oldFrameTransformation = Eigen::Matrix4f::Identity();
793
794 if (!referenceRobot.hasRobotNode(newFrame))
795 {
796 throw LocalException() << "The requested frame '" << newFrame
797 << "' does not exists in the robot " << referenceRobot.getName();
798 }
799
800 if (frame != GlobalFrame)
801 {
802 oldFrameTransformation = referenceRobot.getRobotNode(frame)->getPoseInRootFrame();
803 }
804 else
805 {
806 oldFrameTransformation = referenceRobot.getRootNode()->getGlobalPose().inverse();
807 }
808
809 Eigen::Matrix4f oldPose = Eigen::Matrix4f::Identity();
810 oldPose.block<3, 1>(0, 3) = toEigen();
811 Eigen::Matrix4f newPose =
812 (referenceRobot.getRobotNode(newFrame)->getPoseInRootFrame().inverse() *
813 oldFrameTransformation) *
814 oldPose;
815
816 Eigen::Vector3f pos = newPose.block<3, 1>(0, 3);
817 x = pos[0];
818 y = pos[1];
819 z = pos[2];
820 agent = referenceRobot.getName();
821 frame = newFrame;
822 }
823
824 void
826 {
827 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
828 changeToGlobal(sharedRobot);
829 }
830
831 void
832 FramedPosition::changeToGlobal(const VirtualRobot::RobotConstPtr& referenceRobot)
833 {
834 ARMARX_CHECK_NOT_NULL(referenceRobot);
835 changeToGlobal(*referenceRobot);
836 }
837
838 void
839 FramedPosition::changeToGlobal(const VirtualRobot::Robot& referenceRobot)
840 {
841 if (frame == GlobalFrame)
842 {
843 return;
844 }
845
846 changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
847 Eigen::Vector3f pos =
848 referenceRobot.getRootNode()->getGlobalPose().block<3, 3>(0, 0) * toEigen() +
849 referenceRobot.getRootNode()->getGlobalPose().block<3, 1>(0, 3);
850 x = pos[0];
851 y = pos[1];
852 z = pos[2];
853 frame = GlobalFrame;
854 agent = "";
855 }
856
859 {
860 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
861 return toGlobal(sharedRobot);
862 }
863
865 FramedPosition::toGlobal(const VirtualRobot::RobotConstPtr& referenceRobot) const
866 {
867 ARMARX_CHECK_NOT_NULL(referenceRobot);
868 return toGlobal(*referenceRobot);
869 }
870
872 FramedPosition::toGlobal(const VirtualRobot::Robot& referenceRobot) const
873 {
874 FramedPositionPtr newPosition = FramedPositionPtr::dynamicCast(this->clone());
875 newPosition->changeToGlobal(referenceRobot);
876 return newPosition;
877 }
878
879 Eigen::Vector3f
881 {
882 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
883 return toGlobalEigen(sharedRobot);
884 }
885
886 Eigen::Vector3f
887 FramedPosition::toGlobalEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
888 {
889 ARMARX_CHECK_NOT_NULL(referenceRobot);
890 return toGlobalEigen(*referenceRobot);
891 }
892
893 Eigen::Vector3f
894 FramedPosition::toGlobalEigen(const VirtualRobot::Robot& referenceRobot) const
895 {
896 FramedPosition newPosition(toEigen(), frame, agent);
897 newPosition.changeToGlobal(referenceRobot);
898 return newPosition.toEigen();
899 }
900
903 {
904 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
905 return toRootFrame(sharedRobot);
906 }
907
909 FramedPosition::toRootFrame(const VirtualRobot::RobotConstPtr& referenceRobot) const
910 {
911 ARMARX_CHECK_NOT_NULL(referenceRobot);
912 return toRootFrame(*referenceRobot);
913 }
914
916 FramedPosition::toRootFrame(const VirtualRobot::Robot& referenceRobot) const
917 {
918 FramedPositionPtr newPosition = FramedPositionPtr::dynamicCast(this->clone());
919 newPosition->changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
920 return newPosition;
921 }
922
923 Eigen::Vector3f
925 {
926 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
927 return toRootEigen(sharedRobot);
928 }
929
930 Eigen::Vector3f
931 FramedPosition::toRootEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
932 {
933 ARMARX_CHECK_NOT_NULL(referenceRobot);
934 return toRootEigen(*referenceRobot);
935 }
936
937 Eigen::Vector3f
938 FramedPosition::toRootEigen(const VirtualRobot::Robot& referenceRobot) const
939 {
940 FramedPosition newPosition(toEigen(), frame, agent);
941 newPosition.changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
942 return newPosition.toEigen();
943 }
944
945 std::string
946 FramedPosition::output(const Ice::Current& c) const
947 {
948 std::stringstream s;
949 s << toEigen().format(ArmarXEigenFormat) << std::endl
950 << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent));
951 return s.str();
952 }
953
954 void
955 FramedPosition::serialize(const ObjectSerializerBasePtr& serializer,
956 const ::Ice::Current& c) const
957 {
958 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
959
960 Vector3::serialize(obj, c);
961 obj->setString("frame", frame);
962 obj->setString("agent", agent);
963 }
964
965 void
966 FramedPosition::deserialize(const ObjectSerializerBasePtr& serializer, const ::Ice::Current& c)
967 {
968 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
969
971 frame = obj->getString("frame");
972
973 if (obj->hasElement("agent"))
974 {
975 agent = obj->getString("agent");
976 }
977 }
978
980 Shared(other),
981 armarx::Serializable(other),
982 Vector3Base(other.x, other.y, other.z),
983 FramedPositionBase(other.x, other.y, other.z, other.frame, other.agent),
984 Vector3(other.x, other.y, other.z)
985 {
986 }
987
990 {
991 x = other.x;
992 y = other.y;
993 z = other.z;
994 frame = other.frame;
995 agent = other.agent;
996 return *this;
997 }
998
999 Ice::ObjectPtr
1001 {
1002 return this->clone();
1003 }
1004
1005 VariantDataClassPtr
1006 FramedPosition::clone(const Ice::Current& c) const
1007 {
1008 return new FramedPosition(*this);
1009 }
1010
1012 FramedPosition::getType(const Ice::Current& c) const
1013 {
1015 }
1016
1017 bool
1018 FramedPosition::validate(const Ice::Current& c)
1019 {
1020 return true;
1021 }
1022
1023 std::ostream&
1024 operator<<(std::ostream& stream, const FramedPosition& rhs)
1025 {
1026 stream << "FramedPosition: " << std::endl << rhs.output() << std::endl;
1027 return stream;
1028 }
1029
1031 {
1032 frame = "";
1033 }
1034
1036 const std::string& s,
1037 const std::string& agent) :
1038 Quaternion(m)
1039 {
1040 frame = s;
1041 this->agent = agent;
1042 }
1043
1045 const std::string& frame,
1046 const std::string& agent) :
1047 Quaternion(q)
1048 {
1049 this->frame = frame;
1050 this->agent = agent;
1051 }
1052
1054 const std::string& s,
1055 const std::string& agent) :
1056 Quaternion(m)
1057 {
1058 frame = s;
1059 this->agent = agent;
1060 }
1061
1062 // this doesnt work for an unknown reason
1063 // FramedOrientation::FramedOrientation(const QuaternionBasePtr ori, const std::string &frame )
1064 // {
1065 // Matrix3f rot;
1066 // rot = Quaternionf(ori->qw, ori->qx, ori->qy, ori->qz);
1067 // FramedOrientation(rot, frame);
1068 // }
1069
1070 std::string
1072 {
1073 return this->frame;
1074 }
1075
1076 std::string
1077 FramedOrientation::output(const Ice::Current& c) const
1078 {
1079 std::stringstream s;
1080 s << toEigen() /*.format(ArmarXEigenFormat)*/ << std::endl
1081 << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent));
1082 return s.str();
1083 }
1084
1085 void
1087 const std::string& newFrame)
1088 {
1089 if (newFrame == frame)
1090 {
1091 return;
1092 }
1093
1094 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1095
1096 changeFrame(sharedRobot, newFrame);
1097 }
1098
1099 void
1100 FramedOrientation::changeFrame(const VirtualRobot::RobotConstPtr& referenceRobot,
1101 const std::string& newFrame)
1102 {
1103 ARMARX_CHECK_NOT_NULL(referenceRobot);
1104 changeFrame(*referenceRobot, newFrame);
1105 }
1106
1107 void
1108 FramedOrientation::changeFrame(const VirtualRobot::Robot& referenceRobot,
1109 const std::string& newFrame)
1110 {
1111 if (newFrame == frame)
1112 {
1113 return;
1114 }
1115
1116 if (newFrame == GlobalFrame)
1117 {
1118 changeToGlobal(referenceRobot);
1119 return;
1120 }
1121
1122 Eigen::Matrix4f oldFrameTransformation = Eigen::Matrix4f::Identity();
1123
1124 if (!referenceRobot.hasRobotNode(newFrame))
1125 {
1126 throw LocalException() << "The requested frame '" << newFrame
1127 << "' does not exists in the robot " << referenceRobot.getName();
1128 }
1129
1130 if (frame != GlobalFrame)
1131 {
1132 oldFrameTransformation = referenceRobot.getRobotNode(frame)->getPoseInRootFrame();
1133 }
1134 else
1135 {
1136 oldFrameTransformation = referenceRobot.getRootNode()->getGlobalPose().inverse();
1137 }
1138
1139 Eigen::Matrix4f oldPose = Eigen::Matrix4f::Identity();
1140 oldPose.block<3, 3>(0, 0) = toEigen();
1141
1142 Eigen::Matrix4f newPose =
1143 (referenceRobot.getRobotNode(newFrame)->getPoseInRootFrame().inverse() *
1144 oldFrameTransformation) *
1145 oldPose;
1146
1147 Eigen::Quaternionf quat(newPose.block<3, 3>(0, 0));
1148 qw = quat.w();
1149 qx = quat.x();
1150 qy = quat.y();
1151 qz = quat.z();
1152 agent = referenceRobot.getName();
1153 frame = newFrame;
1154 }
1155
1156 void
1158 {
1159 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1160 changeToGlobal(sharedRobot);
1161 }
1162
1163 void
1164 FramedOrientation::changeToGlobal(const VirtualRobot::RobotConstPtr& referenceRobot)
1165 {
1166 ARMARX_CHECK_NOT_NULL(referenceRobot);
1167 changeToGlobal(*referenceRobot);
1168 }
1169
1170 void
1171 FramedOrientation::changeToGlobal(const VirtualRobot::Robot& referenceRobot)
1172 {
1173 if (frame == GlobalFrame)
1174 {
1175 return;
1176 }
1177
1178 changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
1179 Eigen::Matrix3f rot =
1180 referenceRobot.getRootNode()->getGlobalPose().block<3, 3>(0, 0) * toEigen();
1181 Eigen::Quaternionf quat(rot);
1182 qw = quat.w();
1183 qx = quat.x();
1184 qy = quat.y();
1185 qz = quat.z();
1186 frame = GlobalFrame;
1187 agent = "";
1188 }
1189
1192 {
1193 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1194 return toGlobal(sharedRobot);
1195 }
1196
1198 FramedOrientation::toGlobal(const VirtualRobot::RobotConstPtr& referenceRobot) const
1199 {
1200 ARMARX_CHECK_NOT_NULL(referenceRobot);
1201 return toGlobal(*referenceRobot);
1202 }
1203
1205 FramedOrientation::toGlobal(const VirtualRobot::Robot& referenceRobot) const
1206 {
1207 FramedOrientationPtr newOrientation = FramedOrientationPtr::dynamicCast(this->clone());
1208 newOrientation->changeToGlobal(referenceRobot);
1209 return newOrientation;
1210 }
1211
1212 Eigen::Matrix3f
1214 {
1215 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1216 return toGlobalEigen(sharedRobot);
1217 }
1218
1219 Eigen::Matrix3f
1220 FramedOrientation::toGlobalEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
1221 {
1222 ARMARX_CHECK_NOT_NULL(referenceRobot);
1223 return toGlobalEigen(*referenceRobot);
1224 }
1225
1226 Eigen::Matrix3f
1227 FramedOrientation::toGlobalEigen(const VirtualRobot::Robot& referenceRobot) const
1228 {
1229 FramedOrientation newOrientation(toEigen(), frame, agent);
1230 newOrientation.changeToGlobal(referenceRobot);
1231 return newOrientation.toEigen();
1232 }
1233
1236 {
1237 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1238 return toRootFrame(sharedRobot);
1239 }
1240
1242 FramedOrientation::toRootFrame(const VirtualRobot::RobotConstPtr& referenceRobot) const
1243 {
1244 ARMARX_CHECK_NOT_NULL(referenceRobot);
1245 return toRootFrame(*referenceRobot);
1246 }
1247
1249 FramedOrientation::toRootFrame(const VirtualRobot::Robot& referenceRobot) const
1250 {
1251 FramedOrientationPtr newOrientation = FramedOrientationPtr::dynamicCast(this->clone());
1252 newOrientation->changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
1253 return newOrientation;
1254 }
1255
1256 Eigen::Matrix3f
1258 {
1259 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1260 return toRootEigen(sharedRobot);
1261 }
1262
1263 Eigen::Matrix3f
1264 FramedOrientation::toRootEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
1265 {
1266 ARMARX_CHECK_NOT_NULL(referenceRobot);
1267 return toRootEigen(*referenceRobot);
1268 }
1269
1270 Eigen::Matrix3f
1271 FramedOrientation::toRootEigen(const VirtualRobot::Robot& referenceRobot) const
1272 {
1273 FramedOrientation newOrientation(toEigen(), frame, agent);
1274 newOrientation.changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
1275 return newOrientation.toEigen();
1276 }
1277
1278 void
1279 FramedOrientation::serialize(const ObjectSerializerBasePtr& serializer,
1280 const ::Ice::Current& c) const
1281 {
1282 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
1283
1285 obj->setString("frame", frame);
1286 obj->setString("agent", agent);
1287 }
1288
1289 void
1290 FramedOrientation::deserialize(const ObjectSerializerBasePtr& serializer,
1291 const ::Ice::Current& c)
1292 {
1293 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
1294
1296 frame = obj->getString("frame");
1297
1298 if (obj->hasElement("agent"))
1299 {
1300 agent = obj->getString("agent");
1301 }
1302 }
1303
1304 Ice::ObjectPtr
1306 {
1307 return this->clone();
1308 }
1309
1310 VariantDataClassPtr
1311 FramedOrientation::clone(const Ice::Current& c) const
1312 {
1313 return new FramedOrientation(*this);
1314 }
1315
1317 FramedOrientation::getType(const Ice::Current& c) const
1318 {
1320 }
1321
1322 bool
1323 FramedOrientation::validate(const Ice::Current& c)
1324 {
1325 return true;
1326 }
1327
1328 std::ostream&
1329 operator<<(std::ostream& stream, const FramedOrientation& rhs)
1330 {
1331 stream << "FramedOrientation: " << std::endl << rhs.output() << std::endl;
1332 return stream;
1333 }
1334
1335 VirtualRobot::LinkedCoordinate
1337 const FramedPositionPtr& position,
1338 const FramedOrientationPtr& orientation)
1339 {
1340 VirtualRobot::LinkedCoordinate c(virtualRobot);
1341 std::string frame;
1342
1343 if (position)
1344 {
1345 frame = position->getFrame();
1346
1347 if (orientation)
1348 {
1349 if (!frame.empty() && frame != orientation->getFrame())
1350 {
1351 throw armarx::UserException("Error: frames mismatch");
1352 }
1353 }
1354 }
1355 else
1356 {
1357 if (!orientation)
1358 {
1359 armarx::UserException(
1360 "createLinkedCoordinate: orientation and position are both NULL");
1361 }
1362 else
1363 {
1364 frame = orientation->getFrame();
1365 }
1366 }
1367
1368 Eigen::Matrix4f pose = Eigen::Matrix4f::Identity();
1369
1370 if (orientation)
1371 {
1372 pose.block<3, 3>(0, 0) = orientation->toEigen();
1373 }
1374
1375 if (position)
1376 {
1377 pose.block<3, 1>(0, 3) = position->toEigen();
1378 }
1379
1380 c.set(frame, pose);
1381
1382 return c;
1383 }
1384
1387 const std::string& newFrame) const
1388 {
1389 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1390 return toFrame(sharedRobot, newFrame);
1391 }
1392
1394 FramedPose::toFrame(const VirtualRobot::RobotConstPtr& referenceRobot,
1395 const std::string& newFrame) const
1396 {
1397 FramedPosePtr newPose = FramedPosePtr::dynamicCast(this->clone());
1398 newPose->changeFrame(referenceRobot, newFrame);
1399 return newPose;
1400 }
1401
1402 Eigen::Matrix4f
1404 const std::string& newFrame) const
1405 {
1406 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1407 return toFrameEigen(sharedRobot, newFrame);
1408 }
1409
1410 Eigen::Matrix4f
1411 FramedPose::toFrameEigen(const VirtualRobot::RobotConstPtr& referenceRobot,
1412 const std::string& newFrame) const
1413 {
1414 return toFrame(referenceRobot, newFrame)->toEigen();
1415 }
1416
1417 Ice::ObjectPtr
1419 {
1420 return this->clone();
1421 }
1422
1423 VariantDataClassPtr
1424 FramedPose::clone(const Ice::Current& c) const
1425 {
1426 return new FramedPose(*this);
1427 }
1428
1430 FramedPose::getType(const Ice::Current& c) const
1431 {
1433 }
1434
1435 bool
1436 FramedPose::validate(const Ice::Current& c)
1437 {
1438 return true;
1439 }
1440
1441 std::ostream&
1442 operator<<(std::ostream& stream, const FramedPose& rhs)
1443 {
1444 stream << "FramedPose: " << std::endl << rhs.output() << std::endl;
1445 return stream;
1446 }
1447
1448 bool
1449 operator==(const FramedPose& pose1, const FramedPose& pose2)
1450 {
1451 if (pose1.frame != pose2.frame || pose1.agent != pose2.agent)
1452 return false;
1453 return (pose1.toEigen().isApprox(pose2.toEigen()));
1454 }
1455
1456 bool
1457 operator!=(const FramedPose& pose1, const FramedPose& pose2)
1458 {
1459 return !(pose1 == pose2);
1460 }
1461
1462
1463} // namespace armarx
constexpr T c
FramedDirectionPtr toGlobal(const SharedRobotInterfacePrx &referenceRobot) const
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Eigen::Vector3f toGlobalEigen(const SharedRobotInterfacePrx &referenceRobot) const
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
static FramedDirectionPtr ChangeFrame(const VirtualRobot::RobotConstPtr &robot, const FramedDirection &framedVec, const std::string &newFrame)
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
void changeToGlobal(const SharedRobotInterfacePrx &referenceRobot)
FramedDirectionPtr toRootFrame(const SharedRobotInterfacePrx &referenceRobot) const
Ice::ObjectPtr ice_clone() const override
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Eigen::Vector3f toRootEigen(const SharedRobotInterfacePrx &referenceRobot) const
std::string getFrame() const
void changeFrame(const VirtualRobot::RobotConstPtr &robot, const std::string &newFrame)
The FramedOrientation class.
Definition FramedPose.h:216
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
FramedOrientationPtr toGlobal(const SharedRobotInterfacePrx &referenceRobot) const
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
FramedOrientationPtr toRootFrame(const SharedRobotInterfacePrx &referenceRobot) const
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
Eigen::Matrix3f toGlobalEigen(const SharedRobotInterfacePrx &referenceRobot) const
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
void changeToGlobal(const SharedRobotInterfacePrx &referenceRobot)
Ice::ObjectPtr ice_clone() const override
Eigen::Matrix3f toRootEigen(const SharedRobotInterfacePrx &referenceRobot) const
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
std::string getFrame() const
void changeFrame(const SharedRobotInterfacePrx &referenceRobot, const std::string &newFrame)
FramedOrientationPtr getOrientation() const
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
FramedPosePtr toRootFrame(const SharedRobotInterfacePrx &referenceRobot) const
Eigen::Matrix4f toGlobalEigen(const SharedRobotInterfacePrx &referenceRobot) const
static VirtualRobot::LinkedCoordinate createLinkedCoordinate(const VirtualRobot::RobotPtr &virtualRobot, const FramedPositionPtr &position, const FramedOrientationPtr &orientation)
Eigen::Matrix4f toRootEigen(const SharedRobotInterfacePrx &referenceRobot) const
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Eigen::Matrix4f toFrameEigen(const SharedRobotInterfacePrx &referenceRobot, const std::string &newFrame) const
FramedPosePtr toFrame(const SharedRobotInterfacePrx &referenceRobot, const std::string &newFrame) const
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
void changeToGlobal(const SharedRobotInterfacePrx &referenceRobot)
FramedPosePtr toGlobal(const SharedRobotInterfacePrx &referenceRobot) const
FramedPositionPtr getPosition() const
Ice::ObjectPtr ice_clone() const override
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
std::string getFrame() const
void changeFrame(const SharedRobotInterfacePrx &referenceRobot, const std::string &newFrame)
The FramedPosition class.
Definition FramedPose.h:158
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
FramedPositionPtr toGlobal(const SharedRobotInterfacePrx &referenceRobot) const
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
FramedPosition & operator=(const armarx::FramedPosition &other)
Eigen::Vector3f toGlobalEigen(const SharedRobotInterfacePrx &referenceRobot) const
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
void changeToGlobal(const SharedRobotInterfacePrx &referenceRobot)
FramedPositionPtr toRootFrame(const SharedRobotInterfacePrx &referenceRobot) const
Ice::ObjectPtr ice_clone() const override
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Eigen::Vector3f toRootEigen(const SharedRobotInterfacePrx &referenceRobot) const
std::string getFrame() const
void changeFrame(const SharedRobotInterfacePrx &referenceRobot, const std::string &newFrame)
void init()
Definition Pose.cpp:369
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
Definition Pose.cpp:360
virtual Eigen::Matrix4f toEigen() const
Definition Pose.cpp:334
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition Pose.cpp:353
The Quaternion class.
Definition Pose.h:174
Eigen::Matrix3f toEigen() const
Definition Pose.cpp:204
Quaternion()
Construct an identity quaternion.
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
Definition Pose.cpp:269
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition Pose.cpp:258
Mimics the behaviour of the VirtualRobot::Robot class while redirecting everything to an Ice proxy.
The Vector3 class.
Definition Pose.h:113
virtual Eigen::Vector3f toEigen() const
Definition Pose.cpp:134
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
Definition Pose.cpp:168
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition Pose.cpp:158
#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_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
#define ARMARX_WARNING_S
The logging level for unexpected behaviour, but not a serious problem.
Definition Logging.h:213
std::string const GlobalFrame
Variable of the global coordinate system.
Definition FramedPose.h:65
#define q
Quaternion< float, 0 > Quaternionf
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
const VariantTypeId FramedPosition
Definition FramedPose.h:38
const VariantTypeId FramedOrientation
Definition FramedPose.h:39
const VariantTypeId FramedPose
Definition FramedPose.h:36
const VariantTypeId FramedDirection
Definition FramedPose.h:37
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::ostream & operator<<(std::ostream &os, const PythonApplicationManager::Paths &paths)
IceInternal::Handle< FramedDirection > FramedDirectionPtr
Definition FramedPose.h:84
bool operator==(const RemoteHandle< PrxTA > &fst, const RemoteHandle< PrxTB > &snd)
const Eigen::IOFormat ArmarXEigenFormat(Eigen::StreamPrecision, Eigen::DontAlignCols, " ", "\n", "", "")
IceInternal::Handle< AbstractObjectSerializer > AbstractObjectSerializerPtr
IceInternal::Handle< FramedPosition > FramedPositionPtr
Definition FramedPose.h:149
::IceInternal::ProxyHandle<::IceProxy::armarx::SharedRobotInterface > SharedRobotInterfacePrx
Definition FramedPose.h:59
Ice::Int VariantTypeId
Definition Variant.h:43
IceInternal::Handle< FramedOrientation > FramedOrientationPtr
Definition FramedPose.h:207
bool operator!=(const RemoteHandle< PrxTA > &fst, const RemoteHandle< PrxTB > &snd)
IceInternal::Handle< FramedPose > FramedPosePtr
Definition FramedPose.h:272
std::string ValueToString(const T &value)