24 #define EIGEN_NO_STATIC_ASSERT
30 #include <Eigen/Geometry>
32 #include <VirtualRobot/LinkedCoordinate.h>
33 #include <VirtualRobot/Robot.h>
34 #include <VirtualRobot/VirtualRobot.h>
39 template class ::IceInternal::Handle<::armarx::Pose>;
40 template class ::IceInternal::Handle<::armarx::Vector2>;
41 template class ::IceInternal::Handle<::armarx::Vector3>;
42 template class ::IceInternal::Handle<::armarx::Quaternion>;
68 v << this->x, this->y;
73 Vector2::operator=(
const Eigen::Vector2f& vec)
80 Vector2::output(
const Ice::Current&)
const
88 Vector2::serialize(
const ObjectSerializerBasePtr& serializer, const ::Ice::Current&)
const
92 obj->setFloat(
"x", x);
93 obj->setFloat(
"y", y);
97 Vector2::deserialize(
const ObjectSerializerBasePtr& serializer, const ::Ice::Current&)
101 x = obj->getFloat(
"x");
102 y = obj->getFloat(
"y");
137 v << this->x, this->y, this->z;
142 Vector3::operator=(
const Eigen::Vector3f& vec)
150 Vector3::output(
const Ice::Current&)
const
158 Vector3::serialize(
const ObjectSerializerBasePtr& serializer, const ::Ice::Current&)
const
162 obj->setFloat(
"x", x);
163 obj->setFloat(
"y", y);
164 obj->setFloat(
"z", z);
168 Vector3::deserialize(
const ObjectSerializerBasePtr& serializer, const ::Ice::Current&
c)
172 x = obj->getFloat(
"x");
173 y = obj->getFloat(
"y");
174 z = obj->getFloat(
"z");
206 return toEigenQuaternion().toRotationMatrix();
210 Quaternion::toEigenQuaternion()
const
212 return {this->qw, this->qx, this->qy, this->qz};
235 return Quaternion::slerp(alpha, this->
toEigen(), m);
245 result = q1.
slerp(alpha, q2);
250 Quaternion::output(
const Ice::Current&
c)
const
258 Quaternion::serialize(
const ObjectSerializerBasePtr& serializer, const ::Ice::Current&)
const
262 obj->setFloat(
"qx", qx);
263 obj->setFloat(
"qy", qy);
264 obj->setFloat(
"qz", qz);
265 obj->setFloat(
"qw", qw);
269 Quaternion::deserialize(
const ObjectSerializerBasePtr& serializer, const ::Ice::Current&
c)
273 qx = obj->getFloat(
"qx");
274 qy = obj->getFloat(
"qy");
275 qz = obj->getFloat(
"qz");
276 qw = obj->getFloat(
"qw");
286 Pose::Pose(
const armarx::Vector3BasePtr pos,
const armarx::QuaternionBasePtr ori)
288 this->orientation =
new Quaternion(*QuaternionPtr::dynamicCast(ori));
289 this->position =
new Vector3(*Vector3Ptr::dynamicCast(pos));
296 this->position =
new Vector3();
306 orientation = QuaternionBasePtr::dynamicCast(
source.orientation->clone());
307 position = Vector3Ptr::dynamicCast(
source.position->clone());
314 this->position =
new Vector3(m);
320 this->position =
new Vector3(position);
321 this->orientation =
new Quaternion(quaternion);
329 this->position =
new Vector3(matrix);
339 m.block<3, 3>(0, 0) = c_orientation->toEigen();
340 m.block<3, 1>(0, 3) = c_position->toEigen();
355 position->serialize(serializer,
c);
356 orientation->serialize(serializer,
c);
364 position->deserialize(obj);
365 orientation->deserialize(obj);
371 this->c_position = Vector3Ptr::dynamicCast(this->position);
372 this->c_orientation = QuaternionPtr::dynamicCast(this->orientation);
398 rotation =
fromIce(ice).toRotationMatrix();
426 auto cast = Vector3Ptr::dynamicCast(pose);
428 return cast->toEigen();
434 auto cast = QuaternionPtr::dynamicCast(pose);
436 return cast->toEigenQuaternion();
442 auto cast = PosePtr::dynamicCast(pose);
444 return cast->toEigen();
475 ice =
new Pose(pose);
501 return toIce(helper);
513 return new Pose(pose);
520 return toIce(helper);