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),
308 orientation = QuaternionBasePtr::dynamicCast(source.orientation->clone());
309 position = Vector3Ptr::dynamicCast(source.position->clone());
318 this->position =
new Vector3(m);
324 this->position =
new Vector3(position);
325 this->orientation =
new Quaternion(quaternion);
333 this->position =
new Vector3(matrix);
340 Eigen::Matrix4f m = Eigen::Matrix4f::Identity();
343 m.block<3, 3>(0, 0) = c_orientation->toEigen();
344 m.block<3, 1>(0, 3) = c_position->toEigen();
359 position->serialize(serializer,
c);
360 orientation->serialize(serializer,
c);
368 position->deserialize(obj);
369 orientation->deserialize(obj);
375 this->c_position = Vector3Ptr::dynamicCast(this->position);
376 this->c_orientation = QuaternionPtr::dynamicCast(this->orientation);
402 rotation =
fromIce(ice).toRotationMatrix();
408 Eigen::Matrix3f helper;
422 Eigen::Matrix4f helper;
430 auto cast = Vector3Ptr::dynamicCast(pose);
432 return cast->toEigen();
438 auto cast = QuaternionPtr::dynamicCast(pose);
440 return cast->toEigenQuaternion();
446 auto cast = PosePtr::dynamicCast(pose);
448 return cast->toEigen();
466 Eigen::Matrix3f helper = rotation;
479 ice =
new Pose(pose);
485 Eigen::Matrix4f helper = pose;
504 Eigen::Matrix3f helper = rotation;
505 return toIce(helper);
517 return new Pose(pose);
523 Eigen::Matrix4f helper = pose;
524 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)