20 #include "../utility/TableHelper.hpp" 21 #include "../utility/GeometryHelper.hpp" 29 double px,
double py,
double pz,
double qw,
double qx,
double qy,
double qz)
31 Eigen::Vector3d nullPoint = Eigen::Vector3d(0,0,0);
34 Eigen::Vector3d newPoint = Eigen::Vector3d(px,py,pz);
35 Eigen::Quaterniond newQuat = Eigen::Quaterniond(qw,qx,qy,qz);
39 std::ifstream source(sourceFile, std::fstream::binary);
40 std::ofstream target(targetFile, std::fstream::trunc|std::fstream::binary);
41 target << source.rdbuf();
46 targetHelper.
dropTable(
"recorded_objects");
57 std::cout <<
"Reference Object not found!" << std::endl;
60 Eigen::Vector3d transformPoint = nullPoint - reference->pose->point->eigen + newPoint;
61 Eigen::Quaterniond transformQuat = newQuat * reference->pose->quat->eigen.inverse();
62 Eigen::Vector3d referencePosition = reference->pose->point->eigen;
65 std::cout <<
"transformQuat: w: " << transformQuat.w() <<
", x: " << transformQuat.x() <<
", y: " << transformQuat.y() <<
", z: " << transformQuat.z() << std::endl;
66 std::cout <<
"angle: " << angle << std::endl;
68 while (currentSet->objects.size() != 0)
70 std::cout <<
"Processing object set " << counter <<
"..." << std::endl;
71 transformSet(currentSet, transformPoint, transformQuat, referencePosition);
80 Eigen::Translation3d translation(orginalCenter);
81 Eigen::Translation3d translationBack(-orginalCenter);
82 Eigen::Affine3d endTransform;
83 endTransform = translation * quat * translationBack;
87 Eigen::Vector3d transformedPoint =
object->pose->point->eigen;
88 transformedPoint = endTransform * transformedPoint;
89 object->pose->point->eigen = transformedPoint + point;
91 Eigen::Quaterniond transformedQuat = quat *
object->pose->quat->eigen;
92 transformedQuat.normalize();
93 object->pose->quat->eigen = transformedQuat;
99 Eigen::AngleAxisd axis(angle, Eigen::Vector3d::UnitY());
102 Eigen::Vector3d transformedPoint =
object->pose->point->eigen + point;
103 Eigen::Quaterniond transformedQuat = axis *
object->pose->quat->eigen;
104 transformedQuat.normalize();
105 object->pose->point->eigen = transformedPoint;
106 object->pose->quat->eigen = transformedQuat;
112 std::vector<ObjectPtr> objects = oset->objects;
114 for (
unsigned int i = 0; i < objects.size(); i++)
116 currentObject = objects.at(i);
117 if ((currentObject->type == type) && (currentObject->observedId ==
id))
119 std::cout <<
"Found reference object." << std::endl;
120 return currentObject;
123 std::cerr <<
"Reference object is missing in current Object set" << std::endl;
const ObjectSetPtr getRecordedObjectSet(int setId) const
static double getAngleBetweenQuats(const QuaternionPtr &q1, const QuaternionPtr &q2)
int insertRecordedObjectSet(const boost::shared_ptr< ObjectSet > &os, const std::string &patternName)
void dropTable(const std::string &tablename) const
boost::shared_ptr< ObjectSet > ObjectSetPtr
std::vector< std::string > getRecordedPatternNames() const
void createTablesIfNecessary() const
this namespace contains all generally usable classes.
static QuaternionPtr eigenQuatToQuat(const Eigen::Quaternion< double > &q)
boost::shared_ptr< Object > ObjectPtr