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>
39template class ::IceInternal::Handle<::armarx::Pose>;
40template class ::IceInternal::Handle<::armarx::Vector2>;
41template class ::IceInternal::Handle<::armarx::Vector3>;
42template class ::IceInternal::Handle<::armarx::Quaternion>;
68 v << this->
x, this->y;
92 obj->setFloat(
"x",
x);
93 obj->setFloat(
"y", y);
101 x = obj->getFloat(
"x");
102 y = obj->getFloat(
"y");
137 v << this->
x, this->y, this->z;
162 obj->setFloat(
"x",
x);
163 obj->setFloat(
"y", y);
164 obj->setFloat(
"z", z);
172 x = obj->getFloat(
"x");
173 y = obj->getFloat(
"y");
174 z = obj->getFloat(
"z");
181 Eigen::Matrix3f m3 = m4.block<3, 3>(0, 0);
212 return {this->qw, this->qx, this->qy, this->qz};
216 Quaternion::init(
const Eigen::Matrix3f& m3)
241 Eigen::Matrix3f result;
245 result = q1.
slerp(alpha, q2);
262 obj->setFloat(
"qx", qx);
263 obj->setFloat(
"qy", qy);
264 obj->setFloat(
"qz", qz);
265 obj->setFloat(
"qw", qw);
273 qx = obj->getFloat(
"qx");
274 qy = obj->getFloat(
"qy");
275 qz = obj->getFloat(
"qz");
276 qw = obj->getFloat(
"qw");
279 Pose::Pose(
const Eigen::Matrix3f& m,
const Eigen::Vector3f& v)
282 this->position =
new Vector3(v);
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();
302 armarx::Serializable(source),
303 armarx::VariantDataClass(source),
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);
336 Eigen::Matrix4f m = Eigen::Matrix4f::Identity();
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();
404 Eigen::Matrix3f helper;
418 Eigen::Matrix4f helper;
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();
462 Eigen::Matrix3f helper = rotation;
475 ice =
new Pose(pose);
481 Eigen::Matrix4f helper = pose;
500 Eigen::Matrix3f helper = rotation;
501 return toIce(helper);
513 return new Pose(pose);
519 Eigen::Matrix4f helper = pose;
520 return toIce(helper);
void ice_postUnmarshal() override
Pose & operator=(const Pose &)=default
std::string output(const Ice::Current &=Ice::emptyCurrent) const override
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
virtual Eigen::Matrix4f toEigen() const
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
Eigen::Matrix3f toEigen() const
Quaternion()
Construct an identity quaternion.
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
Eigen::Quaternionf toEigenQuaternion() const
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Eigen::Matrix3f slerp(float, const Eigen::Matrix3f &)
virtual Eigen::Vector2f toEigen() const
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
void operator=(const Eigen::Vector2f &ves)
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
void operator=(const Eigen::Vector3f &vec)
virtual Eigen::Vector3f toEigen() const
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
#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...
Quaternion< float, 0 > Quaternionf
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< Vector3 > Vector3Ptr
IceInternal::Handle< Pose > PosePtr
const Eigen::IOFormat ArmarXEigenFormat(Eigen::StreamPrecision, Eigen::DontAlignCols, " ", "\n", "", "")
IceInternal::Handle< AbstractObjectSerializer > AbstractObjectSerializerPtr
IceInternal::Handle< Quaternion > QuaternionPtr
void fromIce(const std::map< IceKeyT, IceValueT > &iceMap, boost::container::flat_map< CppKeyT, CppValueT > &cppMap)
void toIce(std::map< IceKeyT, IceValueT > &iceMap, const boost::container::flat_map< CppKeyT, CppValueT > &cppMap)