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,
133 const std::string& newFrame)
134 {
136 changeFrame(*robot, newFrame);
137 }
138
139 void
140 FramedDirection::changeFrame(const VirtualRobot::Robot& robot, const std::string& newFrame)
141 {
142 if (frame == "")
143 {
144 frame = GlobalFrame;
145 }
146
147
148 if (getFrame() == newFrame)
149 {
150 return;
151 }
152
153 if (newFrame == GlobalFrame)
154 {
155 changeToGlobal(robot);
156 return;
157 }
158
159 if (!robot.hasRobotNode(newFrame))
160 {
161 throw LocalException() << "The requested frame '" << newFrame
162 << "' does not exist in the robot " << robot.getName();
163 }
164
165 if (frame != GlobalFrame && !robot.hasRobotNode(frame))
166 {
167 throw LocalException() << "The current frame '" << frame
168 << "' does not exist in the robot " << robot.getName();
169 }
170
171
172 Eigen::Matrix4f rotToNewFrame = __GetRotationBetweenFrames(frame, newFrame, robot);
173
174 Eigen::Vector3f vecOldFrame = Vector3::toEigen();
175
176 Eigen::Vector3f newVec = rotToNewFrame.block(0, 0, 3, 3).inverse() * vecOldFrame;
177
178
179 x = newVec(0);
180 y = newVec(1);
181 z = newVec(2);
182 frame = newFrame;
183 agent = robot.getName();
184 }
185
186 void
188 {
189 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
190 changeToGlobal(sharedRobot);
191 }
192
193 void
194 FramedDirection::changeToGlobal(const VirtualRobot::RobotConstPtr& referenceRobot)
195 {
196 ARMARX_CHECK_NOT_NULL(referenceRobot);
197 changeToGlobal(*referenceRobot);
198 }
199
200 void
201 FramedDirection::changeToGlobal(const VirtualRobot::Robot& referenceRobot)
202 {
203 if (frame == GlobalFrame)
204 {
205 return;
206 }
207
208 changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
209 Eigen::Vector3f pos =
210 referenceRobot.getRootNode()->getGlobalPose().block<3, 3>(0, 0) * toEigen();
211 x = pos[0];
212 y = pos[1];
213 z = pos[2];
214 frame = GlobalFrame;
215 agent = "";
216 }
217
220 {
221 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
222 return toGlobal(sharedRobot);
223 }
224
226 FramedDirection::toGlobal(const VirtualRobot::RobotConstPtr& referenceRobot) const
227 {
228 ARMARX_CHECK_NOT_NULL(referenceRobot);
229 return toGlobal(*referenceRobot);
230 }
231
233 FramedDirection::toGlobal(const VirtualRobot::Robot& referenceRobot) const
234 {
235 FramedDirectionPtr newDirection = FramedDirectionPtr::dynamicCast(this->clone());
236 newDirection->changeToGlobal(referenceRobot);
237 return newDirection;
238 }
239
240 Eigen::Vector3f
242 {
243 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
244 return toGlobalEigen(sharedRobot);
245 }
246
247 Eigen::Vector3f
248 FramedDirection::toGlobalEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
249 {
250 ARMARX_CHECK_NOT_NULL(referenceRobot);
251 return toGlobalEigen(*referenceRobot);
252 }
253
254 Eigen::Vector3f
255 FramedDirection::toGlobalEigen(const VirtualRobot::Robot& referenceRobot) const
256 {
257 FramedDirection newDirection(toEigen(), frame, agent);
258 newDirection.changeToGlobal(referenceRobot);
259 return newDirection.toEigen();
260 }
261
264 {
265 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
266 return toRootFrame(sharedRobot);
267 }
268
270 FramedDirection::toRootFrame(const VirtualRobot::RobotConstPtr& referenceRobot) const
271 {
272 ARMARX_CHECK_NOT_NULL(referenceRobot);
273 return toRootFrame(*referenceRobot);
274 }
275
277 FramedDirection::toRootFrame(const VirtualRobot::Robot& referenceRobot) const
278 {
279 FramedDirectionPtr newDirection = FramedDirectionPtr::dynamicCast(this->clone());
280 newDirection->changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
281 return newDirection;
282 }
283
284 Eigen::Vector3f
286 {
287 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
288 return toRootEigen(sharedRobot);
289 }
290
291 Eigen::Vector3f
292 FramedDirection::toRootEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
293 {
294 ARMARX_CHECK_NOT_NULL(referenceRobot);
295 return toRootEigen(*referenceRobot);
296 }
297
298 Eigen::Vector3f
299 FramedDirection::toRootEigen(const VirtualRobot::Robot& referenceRobot) const
300 {
301 FramedDirection newDirection(toEigen(), frame, agent);
302 newDirection.changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
303 return newDirection.toEigen();
304 }
305
306 std::string
307 FramedDirection::output(const Ice::Current& c) const
308 {
309 std::stringstream s;
310 s << toEigen().format(ArmarXEigenFormat) << std::endl
311 << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent));
312 return s.str();
313 }
314
315 Eigen::Matrix4f
316 FramedDirection::__GetRotationBetweenFrames(const std::string& oldFrame,
317 const std::string& newFrame,
318 const VirtualRobot::Robot& robotState)
319 {
320 Eigen::Matrix4f toNewFrame;
321
322 if (oldFrame == GlobalFrame)
323 {
324 auto node = robotState.getRobotNode(newFrame);
325 ARMARX_CHECK_EXPRESSION(node) << newFrame;
326 toNewFrame = node->getGlobalPose();
327 }
328 else
329 {
330 auto node = robotState.getRobotNode(oldFrame);
332 << "old frame: " + oldFrame +
333 ValueToString(robotState.getConfig()->getRobotNodeJointValueMap());
334 auto newNode = robotState.getRobotNode(newFrame);
335 ARMARX_CHECK_EXPRESSION(newNode) << newFrame;
336 toNewFrame = node->getTransformationTo(newNode);
337 }
338
339 toNewFrame(0, 3) = 0;
340 toNewFrame(1, 3) = 0;
341 toNewFrame(2, 3) = 0;
342
343 return toNewFrame;
344 }
345
346 void
347 FramedDirection::serialize(const ObjectSerializerBasePtr& serializer, const Ice::Current&) const
348 {
349 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
350 Vector3::serialize(serializer);
351 obj->setString("frame", frame);
352 obj->setString("agent", agent);
353 }
354
355 void
356 FramedDirection::deserialize(const ObjectSerializerBasePtr& serializer, const Ice::Current&)
357 {
358 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
359 Vector3::deserialize(serializer);
360 frame = obj->getString("frame");
361
362 if (obj->hasElement("agent"))
363 {
364 agent = obj->getString("agent");
365 }
366 }
367
368 Ice::ObjectPtr
370 {
371 return this->clone();
372 }
373
374 VariantDataClassPtr
375 FramedDirection::clone(const Ice::Current& c) const
376 {
377 return new FramedDirection(*this);
378 }
379
381 FramedDirection::getType(const Ice::Current& c) const
382 {
384 }
385
386 bool
387 FramedDirection::validate(const Ice::Current& c)
388 {
389 return true;
390 }
391
392 std::ostream&
393 operator<<(std::ostream& stream, const FramedDirection& rhs)
394 {
395 stream << "FramedDirection: " << std::endl << rhs.output() << std::endl;
396 return stream;
397 }
398
400 {
401 frame = "";
402 }
403
405 IceUtil::Shared(pose),
406 armarx::Serializable(pose),
407 armarx::VariantDataClass(pose),
408 PoseBase(pose),
409 FramedPoseBase(pose),
410 Pose(pose)
411 {
412 }
413
414 FramedPose::FramedPose(const Eigen::Matrix3f& m,
415 const Eigen::Vector3f& v,
416 const std::string& s,
417 const std::string& agent) :
418 Pose(m, v)
419 {
420 frame = s;
421 this->agent = agent;
422 }
423
424 FramedPose::FramedPose(const Eigen::Matrix4f& m,
425 const std::string& s,
426 const std::string& agent) :
427 Pose(m)
428 {
429 frame = s;
430 this->agent = agent;
431 }
432
433 FramedPose::FramedPose(const armarx::Vector3BasePtr pos,
434 const armarx::QuaternionBasePtr ori,
435 const std::string& frame,
436 const std::string& agent) :
437 Pose(pos, ori)
438 {
439 this->frame = frame;
440 this->agent = agent;
441 }
442
443 FramedPose::FramedPose(const Eigen::Vector3f& pos,
444 const Eigen::Quaternionf& ori,
445 const std::string& frame,
446 const std::string& agent) :
447 Pose(pos, ori)
448 {
449 this->frame = frame;
450 this->agent = agent;
451 }
452
453 std::string
455 {
456 return frame;
457 }
458
459 std::string
460 FramedPose::output(const Ice::Current& c) const
461 {
462 std::stringstream s;
463 const Eigen::IOFormat ArmarXEigenFormat(Eigen::StreamPrecision, 4, " ", "\n", "", "");
464 s << toEigen().format(ArmarXEigenFormat) << std::endl
465 << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent));
466 return s.str();
467 }
468
469 void
471 const std::string& newFrame)
472 {
473 if (newFrame == frame)
474 {
475 return;
476 }
477
478 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
479 changeFrame(sharedRobot, newFrame);
480 }
481
482 void
483 FramedPose::changeFrame(const VirtualRobot::RobotConstPtr& referenceRobot,
484 const std::string& newFrame)
485 {
486 ARMARX_CHECK_NOT_NULL(referenceRobot);
487 changeFrame(*referenceRobot, newFrame);
488 }
489
490 void
491 FramedPose::changeFrame(const VirtualRobot::Robot& referenceRobot, const std::string& newFrame)
492 {
493 if (newFrame == frame)
494 {
495 return;
496 }
497
498 if (newFrame == GlobalFrame)
499 {
500 changeToGlobal(referenceRobot);
501 return;
502 }
503
504 Eigen::Isometry3f oldFrameTransformation = Eigen::Isometry3f::Identity();
505
506 if (frame != GlobalFrame and !referenceRobot.hasRobotNode(frame))
507 {
508 throw LocalException() << "The current frame '" << frame
509 << "' does not exists in the robot " << referenceRobot.getName();
510 }
511 if (!referenceRobot.hasRobotNode(newFrame))
512 {
513 throw LocalException() << "The requested frame '" << newFrame
514 << "' does not exists in the robot " << referenceRobot.getName();
515 }
516
517 if (frame != GlobalFrame)
518 {
519 oldFrameTransformation = referenceRobot.getRobotNode(frame)->getPoseInRootFrame();
520 }
521 else
522 {
523 oldFrameTransformation =
524 Eigen::Isometry3f{referenceRobot.getRootNode()->getGlobalPose()}.inverse();
525 }
526
527 Eigen::Isometry3f newPose =
528 (Eigen::Isometry3f{referenceRobot.getRobotNode(newFrame)->getPoseInRootFrame()}
529 .inverse() *
530 oldFrameTransformation) *
531 Eigen::Isometry3f{toEigen()};
532
533 orientation = new Quaternion(Eigen::Matrix3f{newPose.linear()});
534 Eigen::Vector3f pos = newPose.translation();
535 position = new Vector3(pos);
536 frame = newFrame;
537 agent = referenceRobot.getName();
538 init();
539 }
540
541 void
543 {
544 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
545 changeToGlobal(sharedRobot);
546 }
547
548 void
549 FramedPose::changeToGlobal(const VirtualRobot::RobotConstPtr& referenceRobot)
550 {
551 ARMARX_CHECK_NOT_NULL(referenceRobot);
552 changeToGlobal(*referenceRobot);
553 }
554
555 void
556 FramedPose::changeToGlobal(const VirtualRobot::Robot& referenceRobot)
557 {
558 if (frame == GlobalFrame)
559 {
560 return;
561 }
562
563 changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
564 Eigen::Matrix4f global = referenceRobot.getRootNode()->getGlobalPose();
565 const Eigen::Matrix4f pose = global * toEigen();
566 position->x = pose(0, 3);
567 position->y = pose(1, 3);
568 position->z = pose(2, 3);
569 Eigen::Quaternionf q(pose.block<3, 3>(0, 0));
570 orientation->qw = q.w();
571 orientation->qx = q.x();
572 orientation->qy = q.y();
573 orientation->qz = q.z();
574 frame = GlobalFrame;
575 agent = "";
576 }
577
580 {
581 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
582 return toGlobal(sharedRobot);
583 }
584
586 FramedPose::toGlobal(const VirtualRobot::RobotConstPtr& referenceRobot) const
587 {
588 ARMARX_CHECK_NOT_NULL(referenceRobot);
589 return toGlobal(*referenceRobot);
590 }
591
593 FramedPose::toGlobal(const VirtualRobot::Robot& referenceRobot) const
594 {
595 FramedPosePtr newPose = FramedPosePtr::dynamicCast(this->clone());
596 newPose->changeToGlobal(referenceRobot);
597 return newPose;
598 }
599
600 Eigen::Matrix4f
602 {
603 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
604 return toGlobalEigen(sharedRobot);
605 }
606
607 Eigen::Matrix4f
608 FramedPose::toGlobalEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
609 {
610 ARMARX_CHECK_NOT_NULL(referenceRobot);
611 return toGlobalEigen(*referenceRobot);
612 }
613
614 Eigen::Matrix4f
615 FramedPose::toGlobalEigen(const VirtualRobot::Robot& referenceRobot) const
616 {
617 FramedPose newPose(toEigen(), frame, agent);
618 newPose.changeToGlobal(referenceRobot);
619 return newPose.toEigen();
620 }
621
624 {
625 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
626 return toRootFrame(sharedRobot);
627 }
628
630 FramedPose::toRootFrame(const VirtualRobot::RobotConstPtr& referenceRobot) const
631 {
632 ARMARX_CHECK_NOT_NULL(referenceRobot);
633 return toRootFrame(*referenceRobot);
634 }
635
637 FramedPose::toRootFrame(const VirtualRobot::Robot& referenceRobot) const
638 {
639 FramedPosePtr newPose = FramedPosePtr::dynamicCast(this->clone());
640 newPose->changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
641 return newPose;
642 }
643
644 Eigen::Matrix4f
646 {
647 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
648 return toRootEigen(sharedRobot);
649 }
650
651 Eigen::Matrix4f
652 FramedPose::toRootEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
653 {
654 ARMARX_CHECK_NOT_NULL(referenceRobot);
655 return toRootEigen(*referenceRobot);
656 }
657
658 Eigen::Matrix4f
659 FramedPose::toRootEigen(const VirtualRobot::Robot& referenceRobot) const
660 {
661 FramedPose newPose(toEigen(), frame, agent);
662 newPose.changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
663 return newPose.toEigen();
664 }
665
668 {
669 FramedPositionPtr result =
670 new FramedPosition(Vector3Ptr::dynamicCast(position)->toEigen(), frame, agent);
671 return result;
672 }
673
676 {
678 QuaternionPtr::dynamicCast(this->orientation)->toEigen(), frame, agent);
679 return result;
680 }
681
682 void
683 FramedPose::serialize(const ObjectSerializerBasePtr& serializer, const ::Ice::Current& c) const
684 {
685 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
686
687 Pose::serialize(obj, c);
688 obj->setString("frame", frame);
689 obj->setString("agent", agent);
690 }
691
692 void
693 FramedPose::deserialize(const ObjectSerializerBasePtr& serializer, const ::Ice::Current& c)
694 {
695 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
696
698 frame = obj->getString("frame");
699
700 if (obj->hasElement("agent"))
701 {
702 agent = obj->getString("agent");
703 }
704 }
705
707 {
708 frame = "";
709 }
710
711 FramedPosition::FramedPosition(const Eigen::Vector3f& v,
712 const std::string& s,
713 const std::string& agent) :
714 Vector3(v)
715 {
716 frame = s;
717 this->agent = agent;
718 }
719
720 FramedPosition::FramedPosition(const Eigen::Matrix4f& m,
721 const std::string& s,
722 const std::string& agent) :
723 Vector3(m)
724 {
725 frame = s;
726 this->agent = agent;
727 }
728
729 // this doesnt work for unknown reasons
730 // FramedPosition::FramedPosition(const Vector3BasePtr pos, const std::string &frame )
731 // {
732 // this->x = pos->x;
733 // this->y = pos->y;
734 // this->z = pos->z;
735 // this->frame = frame;
736 // }
737
738 std::string
740 {
741 return this->frame;
742 }
743
744 void
746 const std::string& newFrame)
747 {
748 if (newFrame == frame)
749 {
750 return;
751 }
752
753 if (!referenceRobot->hasRobotNode(newFrame))
754 {
755 throw LocalException()
756 << "The requested frame '" << newFrame << "' does not exists in the robot "
757 << referenceRobot->getName();
758 }
759
760 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
761 changeFrame(sharedRobot, newFrame);
762 }
763
764 void
765 FramedPosition::changeFrame(const VirtualRobot::RobotConstPtr& referenceRobot,
766 const std::string& newFrame)
767 {
768 ARMARX_CHECK_NOT_NULL(referenceRobot);
769 changeFrame(*referenceRobot, newFrame);
770 }
771
772 void
773 FramedPosition::changeFrame(const VirtualRobot::Robot& referenceRobot,
774 const std::string& newFrame)
775 {
776 if (newFrame == frame)
777 {
778 return;
779 }
780
781 if (newFrame == GlobalFrame)
782 {
783 changeToGlobal(referenceRobot);
784 return;
785 }
786
787 if (newFrame.empty())
788 {
789 ARMARX_WARNING_S << "Frame Conversion: Frame is empty, always set frame names! "
790 "...assuming GlobalFrame";
791 changeToGlobal(referenceRobot);
792 return;
793 }
794
795 Eigen::Matrix4f oldFrameTransformation = Eigen::Matrix4f::Identity();
796
797 if (!referenceRobot.hasRobotNode(newFrame))
798 {
799 throw LocalException() << "The requested frame '" << newFrame
800 << "' does not exists in the robot " << referenceRobot.getName();
801 }
802
803 if (frame != GlobalFrame)
804 {
805 oldFrameTransformation = referenceRobot.getRobotNode(frame)->getPoseInRootFrame();
806 }
807 else
808 {
809 oldFrameTransformation = referenceRobot.getRootNode()->getGlobalPose().inverse();
810 }
811
812 Eigen::Matrix4f oldPose = Eigen::Matrix4f::Identity();
813 oldPose.block<3, 1>(0, 3) = toEigen();
814 Eigen::Matrix4f newPose =
815 (referenceRobot.getRobotNode(newFrame)->getPoseInRootFrame().inverse() *
816 oldFrameTransformation) *
817 oldPose;
818
819 Eigen::Vector3f pos = newPose.block<3, 1>(0, 3);
820 x = pos[0];
821 y = pos[1];
822 z = pos[2];
823 agent = referenceRobot.getName();
824 frame = newFrame;
825 }
826
827 void
829 {
830 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
831 changeToGlobal(sharedRobot);
832 }
833
834 void
835 FramedPosition::changeToGlobal(const VirtualRobot::RobotConstPtr& referenceRobot)
836 {
837 ARMARX_CHECK_NOT_NULL(referenceRobot);
838 changeToGlobal(*referenceRobot);
839 }
840
841 void
842 FramedPosition::changeToGlobal(const VirtualRobot::Robot& referenceRobot)
843 {
844 if (frame == GlobalFrame)
845 {
846 return;
847 }
848
849 changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
850 Eigen::Vector3f pos =
851 referenceRobot.getRootNode()->getGlobalPose().block<3, 3>(0, 0) * toEigen() +
852 referenceRobot.getRootNode()->getGlobalPose().block<3, 1>(0, 3);
853 x = pos[0];
854 y = pos[1];
855 z = pos[2];
856 frame = GlobalFrame;
857 agent = "";
858 }
859
862 {
863 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
864 return toGlobal(sharedRobot);
865 }
866
868 FramedPosition::toGlobal(const VirtualRobot::RobotConstPtr& referenceRobot) const
869 {
870 ARMARX_CHECK_NOT_NULL(referenceRobot);
871 return toGlobal(*referenceRobot);
872 }
873
875 FramedPosition::toGlobal(const VirtualRobot::Robot& referenceRobot) const
876 {
877 FramedPositionPtr newPosition = FramedPositionPtr::dynamicCast(this->clone());
878 newPosition->changeToGlobal(referenceRobot);
879 return newPosition;
880 }
881
882 Eigen::Vector3f
884 {
885 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
886 return toGlobalEigen(sharedRobot);
887 }
888
889 Eigen::Vector3f
890 FramedPosition::toGlobalEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
891 {
892 ARMARX_CHECK_NOT_NULL(referenceRobot);
893 return toGlobalEigen(*referenceRobot);
894 }
895
896 Eigen::Vector3f
897 FramedPosition::toGlobalEigen(const VirtualRobot::Robot& referenceRobot) const
898 {
899 FramedPosition newPosition(toEigen(), frame, agent);
900 newPosition.changeToGlobal(referenceRobot);
901 return newPosition.toEigen();
902 }
903
906 {
907 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
908 return toRootFrame(sharedRobot);
909 }
910
912 FramedPosition::toRootFrame(const VirtualRobot::RobotConstPtr& referenceRobot) const
913 {
914 ARMARX_CHECK_NOT_NULL(referenceRobot);
915 return toRootFrame(*referenceRobot);
916 }
917
919 FramedPosition::toRootFrame(const VirtualRobot::Robot& referenceRobot) const
920 {
921 FramedPositionPtr newPosition = FramedPositionPtr::dynamicCast(this->clone());
922 newPosition->changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
923 return newPosition;
924 }
925
926 Eigen::Vector3f
928 {
929 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
930 return toRootEigen(sharedRobot);
931 }
932
933 Eigen::Vector3f
934 FramedPosition::toRootEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
935 {
936 ARMARX_CHECK_NOT_NULL(referenceRobot);
937 return toRootEigen(*referenceRobot);
938 }
939
940 Eigen::Vector3f
941 FramedPosition::toRootEigen(const VirtualRobot::Robot& referenceRobot) const
942 {
943 FramedPosition newPosition(toEigen(), frame, agent);
944 newPosition.changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
945 return newPosition.toEigen();
946 }
947
948 std::string
949 FramedPosition::output(const Ice::Current& c) const
950 {
951 std::stringstream s;
952 s << toEigen().format(ArmarXEigenFormat) << std::endl
953 << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent));
954 return s.str();
955 }
956
957 void
958 FramedPosition::serialize(const ObjectSerializerBasePtr& serializer,
959 const ::Ice::Current& c) const
960 {
961 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
962
963 Vector3::serialize(obj, c);
964 obj->setString("frame", frame);
965 obj->setString("agent", agent);
966 }
967
968 void
969 FramedPosition::deserialize(const ObjectSerializerBasePtr& serializer, const ::Ice::Current& c)
970 {
971 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
972
974 frame = obj->getString("frame");
975
976 if (obj->hasElement("agent"))
977 {
978 agent = obj->getString("agent");
979 }
980 }
981
983 Shared(other),
984 armarx::Serializable(other),
985 Vector3Base(other.x, other.y, other.z),
986 FramedPositionBase(other.x, other.y, other.z, other.frame, other.agent),
987 Vector3(other.x, other.y, other.z)
988 {
989 }
990
993 {
994 x = other.x;
995 y = other.y;
996 z = other.z;
997 frame = other.frame;
998 agent = other.agent;
999 return *this;
1000 }
1001
1002 Ice::ObjectPtr
1004 {
1005 return this->clone();
1006 }
1007
1008 VariantDataClassPtr
1009 FramedPosition::clone(const Ice::Current& c) const
1010 {
1011 return new FramedPosition(*this);
1012 }
1013
1015 FramedPosition::getType(const Ice::Current& c) const
1016 {
1018 }
1019
1020 bool
1021 FramedPosition::validate(const Ice::Current& c)
1022 {
1023 return true;
1024 }
1025
1026 std::ostream&
1027 operator<<(std::ostream& stream, const FramedPosition& rhs)
1028 {
1029 stream << "FramedPosition: " << std::endl << rhs.output() << std::endl;
1030 return stream;
1031 }
1032
1034 {
1035 frame = "";
1036 }
1037
1039 const std::string& s,
1040 const std::string& agent) :
1041 Quaternion(m)
1042 {
1043 frame = s;
1044 this->agent = agent;
1045 }
1046
1048 const std::string& frame,
1049 const std::string& agent) :
1050 Quaternion(q)
1051 {
1052 this->frame = frame;
1053 this->agent = agent;
1054 }
1055
1057 const std::string& s,
1058 const std::string& agent) :
1059 Quaternion(m)
1060 {
1061 frame = s;
1062 this->agent = agent;
1063 }
1064
1065 // this doesnt work for an unknown reason
1066 // FramedOrientation::FramedOrientation(const QuaternionBasePtr ori, const std::string &frame )
1067 // {
1068 // Matrix3f rot;
1069 // rot = Quaternionf(ori->qw, ori->qx, ori->qy, ori->qz);
1070 // FramedOrientation(rot, frame);
1071 // }
1072
1073 std::string
1075 {
1076 return this->frame;
1077 }
1078
1079 std::string
1080 FramedOrientation::output(const Ice::Current& c) const
1081 {
1082 std::stringstream s;
1083 s << toEigen() /*.format(ArmarXEigenFormat)*/ << std::endl
1084 << "frame: " << getFrame() << (agent.empty() ? "" : (" agent: " + agent));
1085 return s.str();
1086 }
1087
1088 void
1090 const std::string& newFrame)
1091 {
1092 if (newFrame == frame)
1093 {
1094 return;
1095 }
1096
1097 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1098
1099 changeFrame(sharedRobot, newFrame);
1100 }
1101
1102 void
1103 FramedOrientation::changeFrame(const VirtualRobot::RobotConstPtr& referenceRobot,
1104 const std::string& newFrame)
1105 {
1106 ARMARX_CHECK_NOT_NULL(referenceRobot);
1107 changeFrame(*referenceRobot, newFrame);
1108 }
1109
1110 void
1111 FramedOrientation::changeFrame(const VirtualRobot::Robot& referenceRobot,
1112 const std::string& newFrame)
1113 {
1114 if (newFrame == frame)
1115 {
1116 return;
1117 }
1118
1119 if (newFrame == GlobalFrame)
1120 {
1121 changeToGlobal(referenceRobot);
1122 return;
1123 }
1124
1125 Eigen::Matrix4f oldFrameTransformation = Eigen::Matrix4f::Identity();
1126
1127 if (!referenceRobot.hasRobotNode(newFrame))
1128 {
1129 throw LocalException() << "The requested frame '" << newFrame
1130 << "' does not exists in the robot " << referenceRobot.getName();
1131 }
1132
1133 if (frame != GlobalFrame)
1134 {
1135 oldFrameTransformation = referenceRobot.getRobotNode(frame)->getPoseInRootFrame();
1136 }
1137 else
1138 {
1139 oldFrameTransformation = referenceRobot.getRootNode()->getGlobalPose().inverse();
1140 }
1141
1142 Eigen::Matrix4f oldPose = Eigen::Matrix4f::Identity();
1143 oldPose.block<3, 3>(0, 0) = toEigen();
1144
1145 Eigen::Matrix4f newPose =
1146 (referenceRobot.getRobotNode(newFrame)->getPoseInRootFrame().inverse() *
1147 oldFrameTransformation) *
1148 oldPose;
1149
1150 Eigen::Quaternionf quat(newPose.block<3, 3>(0, 0));
1151 qw = quat.w();
1152 qx = quat.x();
1153 qy = quat.y();
1154 qz = quat.z();
1155 agent = referenceRobot.getName();
1156 frame = newFrame;
1157 }
1158
1159 void
1161 {
1162 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1163 changeToGlobal(sharedRobot);
1164 }
1165
1166 void
1167 FramedOrientation::changeToGlobal(const VirtualRobot::RobotConstPtr& referenceRobot)
1168 {
1169 ARMARX_CHECK_NOT_NULL(referenceRobot);
1170 changeToGlobal(*referenceRobot);
1171 }
1172
1173 void
1174 FramedOrientation::changeToGlobal(const VirtualRobot::Robot& referenceRobot)
1175 {
1176 if (frame == GlobalFrame)
1177 {
1178 return;
1179 }
1180
1181 changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
1182 Eigen::Matrix3f rot =
1183 referenceRobot.getRootNode()->getGlobalPose().block<3, 3>(0, 0) * toEigen();
1184 Eigen::Quaternionf quat(rot);
1185 qw = quat.w();
1186 qx = quat.x();
1187 qy = quat.y();
1188 qz = quat.z();
1189 frame = GlobalFrame;
1190 agent = "";
1191 }
1192
1195 {
1196 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1197 return toGlobal(sharedRobot);
1198 }
1199
1201 FramedOrientation::toGlobal(const VirtualRobot::RobotConstPtr& referenceRobot) const
1202 {
1203 ARMARX_CHECK_NOT_NULL(referenceRobot);
1204 return toGlobal(*referenceRobot);
1205 }
1206
1208 FramedOrientation::toGlobal(const VirtualRobot::Robot& referenceRobot) const
1209 {
1210 FramedOrientationPtr newOrientation = FramedOrientationPtr::dynamicCast(this->clone());
1211 newOrientation->changeToGlobal(referenceRobot);
1212 return newOrientation;
1213 }
1214
1215 Eigen::Matrix3f
1217 {
1218 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1219 return toGlobalEigen(sharedRobot);
1220 }
1221
1222 Eigen::Matrix3f
1223 FramedOrientation::toGlobalEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
1224 {
1225 ARMARX_CHECK_NOT_NULL(referenceRobot);
1226 return toGlobalEigen(*referenceRobot);
1227 }
1228
1229 Eigen::Matrix3f
1230 FramedOrientation::toGlobalEigen(const VirtualRobot::Robot& referenceRobot) const
1231 {
1232 FramedOrientation newOrientation(toEigen(), frame, agent);
1233 newOrientation.changeToGlobal(referenceRobot);
1234 return newOrientation.toEigen();
1235 }
1236
1239 {
1240 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1241 return toRootFrame(sharedRobot);
1242 }
1243
1245 FramedOrientation::toRootFrame(const VirtualRobot::RobotConstPtr& referenceRobot) const
1246 {
1247 ARMARX_CHECK_NOT_NULL(referenceRobot);
1248 return toRootFrame(*referenceRobot);
1249 }
1250
1252 FramedOrientation::toRootFrame(const VirtualRobot::Robot& referenceRobot) const
1253 {
1254 FramedOrientationPtr newOrientation = FramedOrientationPtr::dynamicCast(this->clone());
1255 newOrientation->changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
1256 return newOrientation;
1257 }
1258
1259 Eigen::Matrix3f
1261 {
1262 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1263 return toRootEigen(sharedRobot);
1264 }
1265
1266 Eigen::Matrix3f
1267 FramedOrientation::toRootEigen(const VirtualRobot::RobotConstPtr& referenceRobot) const
1268 {
1269 ARMARX_CHECK_NOT_NULL(referenceRobot);
1270 return toRootEigen(*referenceRobot);
1271 }
1272
1273 Eigen::Matrix3f
1274 FramedOrientation::toRootEigen(const VirtualRobot::Robot& referenceRobot) const
1275 {
1276 FramedOrientation newOrientation(toEigen(), frame, agent);
1277 newOrientation.changeFrame(referenceRobot, referenceRobot.getRootNode()->getName());
1278 return newOrientation.toEigen();
1279 }
1280
1281 void
1282 FramedOrientation::serialize(const ObjectSerializerBasePtr& serializer,
1283 const ::Ice::Current& c) const
1284 {
1285 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
1286
1288 obj->setString("frame", frame);
1289 obj->setString("agent", agent);
1290 }
1291
1292 void
1293 FramedOrientation::deserialize(const ObjectSerializerBasePtr& serializer,
1294 const ::Ice::Current& c)
1295 {
1296 AbstractObjectSerializerPtr obj = AbstractObjectSerializerPtr::dynamicCast(serializer);
1297
1299 frame = obj->getString("frame");
1300
1301 if (obj->hasElement("agent"))
1302 {
1303 agent = obj->getString("agent");
1304 }
1305 }
1306
1307 Ice::ObjectPtr
1309 {
1310 return this->clone();
1311 }
1312
1313 VariantDataClassPtr
1314 FramedOrientation::clone(const Ice::Current& c) const
1315 {
1316 return new FramedOrientation(*this);
1317 }
1318
1320 FramedOrientation::getType(const Ice::Current& c) const
1321 {
1323 }
1324
1325 bool
1326 FramedOrientation::validate(const Ice::Current& c)
1327 {
1328 return true;
1329 }
1330
1331 std::ostream&
1332 operator<<(std::ostream& stream, const FramedOrientation& rhs)
1333 {
1334 stream << "FramedOrientation: " << std::endl << rhs.output() << std::endl;
1335 return stream;
1336 }
1337
1338 VirtualRobot::LinkedCoordinate
1340 const FramedPositionPtr& position,
1341 const FramedOrientationPtr& orientation)
1342 {
1343 VirtualRobot::LinkedCoordinate c(virtualRobot);
1344 std::string frame;
1345
1346 if (position)
1347 {
1348 frame = position->getFrame();
1349
1350 if (orientation)
1351 {
1352 if (!frame.empty() && frame != orientation->getFrame())
1353 {
1354 throw armarx::UserException("Error: frames mismatch");
1355 }
1356 }
1357 }
1358 else
1359 {
1360 if (!orientation)
1361 {
1362 armarx::UserException(
1363 "createLinkedCoordinate: orientation and position are both NULL");
1364 }
1365 else
1366 {
1367 frame = orientation->getFrame();
1368 }
1369 }
1370
1371 Eigen::Matrix4f pose = Eigen::Matrix4f::Identity();
1372
1373 if (orientation)
1374 {
1375 pose.block<3, 3>(0, 0) = orientation->toEigen();
1376 }
1377
1378 if (position)
1379 {
1380 pose.block<3, 1>(0, 3) = position->toEigen();
1381 }
1382
1383 c.set(frame, pose);
1384
1385 return c;
1386 }
1387
1390 const std::string& newFrame) const
1391 {
1392 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1393 return toFrame(sharedRobot, newFrame);
1394 }
1395
1397 FramedPose::toFrame(const VirtualRobot::RobotConstPtr& referenceRobot,
1398 const std::string& newFrame) const
1399 {
1400 FramedPosePtr newPose = FramedPosePtr::dynamicCast(this->clone());
1401 newPose->changeFrame(referenceRobot, newFrame);
1402 return newPose;
1403 }
1404
1405 Eigen::Matrix4f
1407 const std::string& newFrame) const
1408 {
1409 VirtualRobot::RobotConstPtr sharedRobot(new RemoteRobot(referenceRobot));
1410 return toFrameEigen(sharedRobot, newFrame);
1411 }
1412
1413 Eigen::Matrix4f
1414 FramedPose::toFrameEigen(const VirtualRobot::RobotConstPtr& referenceRobot,
1415 const std::string& newFrame) const
1416 {
1417 return toFrame(referenceRobot, newFrame)->toEigen();
1418 }
1419
1420 Ice::ObjectPtr
1422 {
1423 return this->clone();
1424 }
1425
1426 VariantDataClassPtr
1427 FramedPose::clone(const Ice::Current& c) const
1428 {
1429 return new FramedPose(*this);
1430 }
1431
1433 FramedPose::getType(const Ice::Current& c) const
1434 {
1436 }
1437
1438 bool
1439 FramedPose::validate(const Ice::Current& c)
1440 {
1441 return true;
1442 }
1443
1444 std::ostream&
1445 operator<<(std::ostream& stream, const FramedPose& rhs)
1446 {
1447 stream << "FramedPose: " << std::endl << rhs.output() << std::endl;
1448 return stream;
1449 }
1450
1451 bool
1452 operator==(const FramedPose& pose1, const FramedPose& pose2)
1453 {
1454 if (pose1.frame != pose2.frame || pose1.agent != pose2.agent)
1455 return false;
1456 return (pose1.toEigen().isApprox(pose2.toEigen()));
1457 }
1458
1459 bool
1460 operator!=(const FramedPose& pose1, const FramedPose& pose2)
1461 {
1462 return !(pose1 == pose2);
1463 }
1464
1465
1466} // 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)