19 #include <dynamic_reconfigure/server.h> 20 #include <std_msgs/Float64MultiArray.h> 21 #include <std_msgs/Empty.h> 22 #include <std_msgs/UInt32.h> 23 #include <std_msgs/UInt32MultiArray.h> 24 #include <std_msgs/String.h> 26 #include <visualization_msgs/Marker.h> 27 #include <visualization_msgs/MarkerArray.h> 29 #include <ISM/common_type/Point.hpp> 30 #include <ISM/common_type/Track.hpp> 31 #include <ISM/common_type/Tracks.hpp> 32 #include <ISM/common_type/Object.hpp> 33 #include "ISM/recognizer/VotingSpace.hpp" 34 #include "ISM/recorder/Recorder.hpp" 35 #include <ISM/utility/TableHelper.hpp> 36 #include <ISM/utility/MathHelper.hpp> 38 #include <asr_ism/recordGenConfig.h> 40 #include <asr_ism_visualizations/ObjectModelVisualizerRVIZ.hpp> 41 #include "asr_ism_visualizations/VizHelperRVIZ.hpp" 43 #include <boost/filesystem/path.hpp> 44 #include <boost/property_tree/ptree.hpp> 45 #include <boost/property_tree/xml_parser.hpp> 46 #include <boost/algorithm/string.hpp> 49 #include <eigen3/unsupported/Eigen/Splines> 50 #include <Eigen/Geometry> 54 #include <boost/math/constants/constants.hpp> 55 #include <boost/lexical_cast.hpp> 56 #include <boost/random.hpp> 57 #include <boost/random/variate_generator.hpp> 58 #include <boost/random/uniform_real.hpp> 69 using visualization_msgs::MarkerArray;
72 double frand(
double min,
double max) {
73 double f = (double) rand() / RAND_MAX;
74 return min + f * (max - min);
87 template<
class C,
class T>
89 -> decltype(end(v),
true)
91 return end(v) != std::find(begin(v), end(v),
x);
100 }
else if(s ==
"MidSpline")
103 }
else if(s ==
"MidSplineAlt")
124 }
else if (s ==
"Random")
127 }
else if (s ==
"Linear")
138 double posZ,
double orientW,
double orientX,
double orientY,
double orientZ,
139 OrientCalcType orientCalcType,
double posErr,
double orientDerivation,
unsigned int from,
140 unsigned int to,
double linearDegX,
double linearDegY,
double linearDegZ):
142 mCurrentApplied(false),
149 mCurrentOrientW(orientW),
150 mCurrentOrientX(orientX),
151 mCurrentOrientY(orientY),
152 mCurrentOrientZ(orientZ),
153 mInitOrientW(orientW),
154 mInitOrientX(orientX),
155 mInitOrientY(orientY),
156 mInitOrientZ(orientZ),
157 mOrientCalcType(orientCalcType),
159 mOrientDer(orientDerivation),
162 mLinearDegX(linearDegX),
163 mLinearDegY(linearDegY),
164 mLinearDegZ(linearDegZ),
166 mNormal(0, mOrientDer)
171 throw std::runtime_error(
"Type of OrientCalc is undefined");
175 throw std::runtime_error(
"Type of RecGenPoint is undefined");
177 mTrack.reset(
new ISM::Track(name, boost::lexical_cast<std::string>(
id)));
178 std::random_device rd;
179 mRandomGen.seed(rd());
180 mRandomGenOrient.seed(rd());
181 mVariantGen =
new boost::variate_generator<boost::mt19937, boost::uniform_real<>>
182 (mRandomGen, mUniform);
183 mVarGenOrient =
new boost::variate_generator<boost::mt19937, boost::normal_distribution<>>
184 (mRandomGenOrient, mNormal);
189 virtual bool isVisible() = 0;
190 virtual void calcCurrObPos() = 0;
193 ISM::PointPtr currPos;
194 if(mCurrentO && mCurrentO->pose)
196 currPos = mCurrentO->pose->point;
199 switch(mOrientCalcType)
203 mCurrentO.reset(
new ISM::Object(mName,
204 new ISM::Pose(currPos,
205 new ISM::Quaternion(mCurrentOrientW, mCurrentOrientX,
206 mCurrentOrientY, mCurrentOrientZ)),
207 boost::lexical_cast<std::string>(mId)));
213 mCurrentOrientW = (*mVariantGen)();
214 mCurrentOrientX = (*mVariantGen)();
215 mCurrentOrientY = (*mVariantGen)();
216 mCurrentOrientZ = (*mVariantGen)();
218 mCurrentO.reset(
new ISM::Object(mName,
219 new ISM::Pose(mCurrentO->pose->point,
220 new ISM::Quaternion(mCurrentOrientW, mCurrentOrientX,
221 mCurrentOrientY, mCurrentOrientZ)),
222 boost::lexical_cast<std::string>(mId)));
227 if(mTimestep > 0 && mFrom < mTo)
229 const double pi = boost::math::constants::pi<double>();
230 double totSpan = mTo - mFrom;
231 double currentLinEulX = mLinearDegX * ((double) mTimestep) / totSpan
233 double currentLinEulY = mLinearDegY * ((double) mTimestep) / totSpan
235 double currentLinEulZ = mLinearDegZ * ((double) mTimestep) / totSpan
238 Eigen::Quaterniond linQ = Eigen::AngleAxisd(currentLinEulX, Eigen::Vector3d::UnitX())
239 * Eigen::AngleAxisd(currentLinEulY, Eigen::Vector3d::UnitY())
240 * Eigen::AngleAxisd(currentLinEulZ, Eigen::Vector3d::UnitZ());
241 Eigen::Quaterniond q(mInitOrientW, mInitOrientX, mInitOrientY, mInitOrientZ);
242 Eigen::Quaterniond totalQ = q * linQ;
244 mCurrentOrientW = totalQ.w();
245 mCurrentOrientX = totalQ.x();
246 mCurrentOrientY = totalQ.y();
247 mCurrentOrientZ = totalQ.z();
249 mCurrentO.reset(
new ISM::Object(mName,
250 new ISM::Pose(mCurrentO->pose->point,
251 new ISM::Quaternion(mCurrentOrientW, mCurrentOrientX,
252 mCurrentOrientY, mCurrentOrientZ)),
253 boost::lexical_cast<std::string>(mId)));
258 throw std::runtime_error(
"OrientCalcType is Undefined");
263 virtual void forceInvisible(
bool) = 0;
266 if(!mCurrentO || !mCurrentO->pose->point ||
267 !mCurrentO->pose->quat)
268 throw "RecordGenPoint: Current Object must always be initialized";
271 auto point = mCurrentO->pose->point;
272 auto quat = mCurrentO->pose->quat;
273 point->eigen.x() = point->eigen.x() + (*mVariantGen)() * mPosErr;
274 point->eigen.y() = point->eigen.y() + (*mVariantGen)() * mPosErr;
275 point->eigen.z() = point->eigen.z() + (*mVariantGen)() * mPosErr;
276 if(point->eigen.x() < -1.0 || point->eigen.x() > 1.0
277 || point->eigen.y() < -1.0 || point->eigen.y() > 1.0
278 ||point->eigen.z() < -1.0 || point->eigen.z() > 1.0 )
280 std::cerr <<
"Warning Point does not lie in range: " << point << std::endl
281 <<
"type: " << mName <<
" id: " << mId << std::endl
282 <<
"at timestep: " << mTimestep << std::endl;
285 const double pi = boost::math::constants::pi<double>();
288 m = Eigen::AngleAxisd(pi * (*mVarGenOrient)(), Eigen::Vector3d::UnitX())
289 * Eigen::AngleAxisd(pi * (*mVarGenOrient)(), Eigen::Vector3d::UnitY())
290 * Eigen::AngleAxisd(pi * (*mVarGenOrient)(), Eigen::Vector3d::UnitZ());
292 Eigen::Quaterniond errorQ(m);
293 Eigen::Quaterniond q(quat->eigen.w(), quat->eigen.x(), quat->eigen.y(), quat->eigen.z());
294 Eigen::Quaterniond totalQ = q * errorQ;
296 quat->eigen.w() = totalQ.w();
297 quat->eigen.x() = totalQ.x();
298 quat->eigen.y() = totalQ.y();
299 quat->eigen.z() = totalQ.z();
311 mTrack->objects.push_back(mCurrentO);
315 mTrack->objects.push_back(ISM::ObjectPtr());
316 std::cout << mName <<
" is not visible" << std::endl;
319 mCurrentApplied =
true;
326 mCurrentApplied =
false;
361 boost::variate_generator<boost::mt19937, boost::uniform_real<>>*
mVariantGen;
362 boost::variate_generator<boost::mt19937, boost::normal_distribution<>>*
mVarGenOrient;
369 void setCol(Eigen::MatrixXd &m,
int col, Eigen::Vector3d &v,
double time)
379 Eigen::Vector3d
s = Eigen::Vector3d(mXs, mYs , mZs);
380 Eigen::Vector3d e = Eigen::Vector3d(mXe, mYe , mZe);
381 Eigen::Vector3d sToe = e - s;
382 Eigen::Vector3d m = s + sToe/2;
383 Eigen::Vector3d temp = sToe;
386 Eigen::Vector3d orthSToe = temp.unitOrthogonal();
387 orthSToe.normalize();
388 orthSToe *= (sToe.norm()/2) * tan(mDegree * (boost::math::constants::pi<double>() / 180.0));
389 Eigen::Vector3d p3 = m + orthSToe;
393 double timeToNextPoint = mTimeSpan / (double) numPoints;
394 Eigen::MatrixXd points(4, numPoints);
395 setCol(points, 0, s, 0);
396 setCol(points, 1, p3, timeToNextPoint);
397 setCol(points, 2, e, mTimeSpan);
398 mSpline = Eigen::SplineFitting<Eigen::Spline<double, 4>>::Interpolate(points, numPoints - 1);
401 double xe,
double ye,
double ze,
double degree,
double timeSpan,
402 double orientW,
double orientX,
double orientY,
double orientZ,
404 unsigned int from,
unsigned int to,
405 double linearDegX,
double linearDegY,
double linearDegZ) :
407 orientX, orientY, orientZ, orientCalcType, posErr,
409 linearDegX, linearDegY, linearDegZ),
411 mXs(xs), mYs(ys), mZs(zs), mXe(xe), mYe(ye), mZe(ze), mDegree(degree), mTimeSpan(timeSpan)
419 double xe,
double ye,
double ze,
double degree,
double timeSpan)
430 mTimeSpan = timeSpan;
441 return !mIsInvisible;
451 ISM::QuaternionPtr currOrient;
452 if(mCurrentO && mCurrentO->pose)
454 currOrient = mCurrentO->pose->quat;
458 if(mTimestep > mTimeSpan)
461 values = mSpline(mTimestep/mTimeSpan);
463 mCurrentPosX = values(1);
464 mCurrentPosY = values(2);
465 mCurrentPosZ = values(3);
466 mCurrentO.reset(
new ISM::Object(mName,
467 new ISM::Pose(
new ISM::Point(mCurrentPosX, mCurrentPosY, mCurrentPosZ),
468 currOrient), boost::lexical_cast<std::string>(mId)));
487 double xe,
double ye,
double ze,
double degree,
double timeSpan,
488 double orientW,
double orientX,
double orientY,
double orientZ,
490 unsigned int from,
unsigned int to ,
double linearDegX,
double linearDegY,
double linearDegZ) :
492 xe, ye, ze, degree, timeSpan, orientW, orientX, orientY, orientZ,
493 orientCalcType, posErr, orientErr, from, to, linearDegX, linearDegY, linearDegZ)
499 ISM::QuaternionPtr currOrient;
500 if(mCurrentO && mCurrentO->pose)
502 currOrient = mCurrentO->pose->quat;
506 int timesTimeSpan = mTimestep / mTimeSpan;
507 if((timesTimeSpan % 2) == 0)
508 values = mSpline((mTimestep - (timesTimeSpan * mTimeSpan)) / mTimeSpan);
510 values = mSpline(1 - (mTimestep - (timesTimeSpan * mTimeSpan)) / mTimeSpan);
512 mCurrentPosX = values(1);
513 mCurrentPosY = values(2);
514 mCurrentPosZ = values(3);
515 mCurrentO.reset(
new ISM::Object(mName,
516 new ISM::Pose(
new ISM::Point(mCurrentPosX, mCurrentPosY, mCurrentPosZ),
517 currOrient), boost::lexical_cast<std::string>(mId)));
525 double orientW,
double orientX,
double orientY,
double orientZ,
527 unsigned int from,
unsigned int to,
double linearDegX,
double linearDegY,
double linearDegZ):
528 RecordGenPoint(name, id,
RecGenPointType::
Fix, x, y, z, orientW, orientX, orientY, orientZ,
529 orientCalcType, posErr, orientErr, from, to, linearDegX, linearDegY, linearDegZ),
537 unsigned int desTs = mTimestep;
539 forceInvisible(
true);
540 for(
unsigned int i = 0; i < desTs; ++i)
542 applyAndGotoNextTimestep();
544 forceInvisible(
false);
563 return !mIsInvisible;
573 ISM::QuaternionPtr currOrient;
574 if(mCurrentO && mCurrentO->pose)
576 currOrient = mCurrentO->pose->quat;
578 mCurrentO.reset(
new ISM::Object(mName,
579 new ISM::Pose(
new ISM::Point(mCurrentPosX, mCurrentPosY, mCurrentPosZ),
580 currOrient), boost::lexical_cast<std::string>(mId)));
587 using boost::filesystem::path;
590 namespace pt = boost::property_tree;
593 bool operator()(
const FromToPointTuple& a,
const FromToPointTuple& b)
const {
594 if(std::get<2>(a)->mName == std::get<2>(b)->mName &&
595 std::get<2>(a)->mId == std::get<2>(b)->mId)
597 return std::get<1>(a) < std::get<0>(b);
600 return (uintptr_t)(std::get<2>(a).
get()) < (uintptr_t)(std::get<2>(b).
get());
612 pt::read_xml(xmlFile.string(), tree);
614 for(
auto& fstLvlNode : tree)
616 if(fstLvlNode.first ==
"object")
618 std::string name = fstLvlNode.second.get<std::string>(
"<xmlattr>.name");
619 int32_t
id = fstLvlNode.second.get<int32_t>(
"<xmlattr>.id");
620 ISM::TrackPtr sharedTrack = ISM::TrackPtr(
new ISM::Track(name,
621 boost::lexical_cast<std::string>(
id)));
622 mTracks.push_back(sharedTrack);
623 for(
auto& pointNode : fstLvlNode.second)
625 if(pointNode.first ==
"point")
627 auto& pointAttrs = pointNode.second;
630 (pointAttrs.get<std::string>(
"<xmlattr>.type",
""));
631 int from = pointAttrs.get<uint32_t>(
"from");
632 int to = pointAttrs.get<uint32_t>(
"to");
635 std::stringstream ss;
636 ss <<
"At: " << name <<
"," <<
id <<
" from must be less than to";
637 throw std::runtime_error(ss.str());
639 double posX = pointAttrs.get<
double>(
"posX", 0.0);
640 double posY = pointAttrs.get<
double>(
"posY", 0.0);
641 double posZ = pointAttrs.get<
double>(
"posZ", 0.0);
642 double orientW = pointAttrs.get<
double>(
"orientW", 0.0);
643 double orientX = pointAttrs.get<
double>(
"orientX", 0.0);
644 double orientY = pointAttrs.get<
double>(
"orientY", 0.0);
645 double orientZ = pointAttrs.get<
double>(
"orientZ", 0.0);
646 double xs = pointAttrs.get<
double>(
"xs", 0.0);
647 double ys = pointAttrs.get<
double>(
"ys", 0.0);
648 double zs = pointAttrs.get<
double>(
"zs", 0.0);
649 double xe = pointAttrs.get<
double>(
"xe", 0.0);
650 double ye = pointAttrs.get<
double>(
"ye", 0.0);
651 double ze = pointAttrs.get<
double>(
"ze", 0.0);
652 double degree = pointAttrs.get<
double>(
"degree", 0.0);
653 double timeSpan = pointAttrs.get<
double>(
"timeSpan", 0.0);
654 double posErr = pointAttrs.get<
double>(
"posErr", 0.0);
655 double orientErr = pointAttrs.get<
double>(
"orientErr", 0.0);
656 double linearDegX = pointAttrs.get<
double>(
"linearDegX", 0.0);
657 double linearDegY = pointAttrs.get<
double>(
"linearDegY", 0.0);
658 double linearDegZ = pointAttrs.get<
double>(
"linearDegZ", 0.0);
660 std::vector<unsigned int> timestampVisible;
661 for(
auto& pointAttr : pointAttrs)
663 if(pointAttr.first ==
"visible")
665 std::string rangeString = pointAttr.second.get_value(
"");
666 std::vector<std::string> range;
667 boost::split(range, rangeString, boost::is_any_of(
"-"));
668 if(range.size() == 2)
670 for(
unsigned int i = boost::lexical_cast<unsigned int>(range[0]);
671 i <= boost::lexical_cast<unsigned int>(range[1]); ++i)
673 timestampVisible.push_back(i);
677 timestampVisible.push_back(boost::lexical_cast<unsigned int>(range[0]));
687 orientX, orientY, orientZ, oCT, posErr, orientErr, from, to
688 ,linearDegX, linearDegY, linearDegZ));
694 timeSpan, orientW, orientX, orientY, orientZ, oCT, posErr, orientErr, from, to,
695 linearDegX, linearDegY, linearDegZ));
701 timeSpan, orientW, orientX, orientY, orientZ, oCT, posErr, orientErr, from, to,
702 linearDegX, linearDegY, linearDegZ));
707 throw std::runtime_error(
"Error in parsing xml: RecGenPointType not valid");
710 mTimestampVisibleXmlPoints[p] = timestampVisible;
711 p->mTrack = sharedTrack;
712 auto itToSucceed = mPoints.insert(std::make_tuple(from,to,p));
713 if(!itToSucceed.second)
715 std::stringstream ss;
716 ss <<
"At: " << name <<
"," <<
id <<
" point intervals overlapping";
717 throw std::runtime_error(ss.str());
727 mShowFrom = config.from;
732 std::string patternName =
"pattern0",
bool doPublish =
false):
736 mFilterViaVgOut(false),
737 mPatternName(patternName),
739 mDoPublish(doPublish),
744 mDynReconfServer.setCallback(f);
745 rec.reset(
new ISM::Recorder(mDbFile));
752 mFilterViaVgOut =
true;
753 std::ifstream is(vgOutFile.string());
757 bool foundRep =
true;
758 while(std::getline(is, line))
760 if(line.find(
"Ref is:") != std::string::npos)
762 line.erase(line.begin(), line.begin() + line.find_first_of(
":") + 1);
763 mPatternToRef[pattern] = line;
765 if(line.find(
"Id for pattern:") != std::string::npos)
767 line.erase(line.begin(), line.begin() + line.find_first_of(
":") + 1);
769 }
else if(line.find(
"Id for type:") != std::string::npos)
771 line.erase(line.begin(), line.begin() + line.find_first_of(
":") + 1);
773 }
else if(line.find(
"These trackIds are in the same Orient Grid:") != std::string::npos)
781 rep = boost::lexical_cast<uint32_t>(line);
782 }
catch(boost::bad_lexical_cast& e)
786 mPatternTypeToVoxelReps[std::make_pair(pattern,type)].insert(rep);
790 for(
auto& patternTypeToVoxelReps : mPatternTypeToVoxelReps)
792 std::string pattern = patternTypeToVoxelReps.first.first;
793 std::string type = patternTypeToVoxelReps.first.second;
794 for(uint32_t rep : patternTypeToVoxelReps.second)
796 std::cout <<
"Rep for p: " << pattern <<
" t: " << type <<
" is: " << rep << std::endl;
803 for(
auto& fromToPoint : mPoints)
805 if(std::get<0>(fromToPoint) <= mTimestep &&
806 std::get<1>(fromToPoint) >= mTimestep)
808 auto& p = std::get<2>(fromToPoint);
809 std::vector<unsigned int>& visTs = mTimestampVisibleXmlPoints[p];
811 if(std::find(visTs.begin(), visTs.end(), mTimestep) != visTs.end())
813 p->forceInvisible(
false);
816 p->forceInvisible(
true);
818 p->applyAndGotoNextTimestep();
826 for(
auto& fromToPoint : mPoints)
828 if(std::get<0>(fromToPoint) <= mTimestep &&
829 std::get<1>(fromToPoint) >= mTimestep)
831 auto& p = std::get<2>(fromToPoint);
832 std::vector<unsigned int>& visTs = mTimestampVisibleXmlPoints[p];
834 if(std::find(visTs.begin(), visTs.end(), mTimestep) != visTs.end())
836 p->forceInvisible(
false);
839 p->forceInvisible(
true);
848 for(
unsigned int i = 0; i < n; ++i)
850 applyAndGotoNextTimestep();
856 std::vector<ISM::ObjectPtr> result;
857 for(
auto& fromToPoint : mPoints)
859 if(std::get<0>(fromToPoint) <= mTimestep &&
860 std::get<1>(fromToPoint) >= mTimestep)
862 auto& p = std::get<2>(fromToPoint);
865 result.push_back(p->mCurrentO);
874 std::vector<ISM::ObjectPtr> result;
875 for(
auto& fromToPoint : mPoints)
877 if(std::get<0>(fromToPoint) <= mTimestep &&
878 std::get<1>(fromToPoint) >= mTimestep)
880 auto& p = std::get<2>(fromToPoint);
883 result.push_back(p->mCurrentO);
891 void showFromTo(
const std_msgs::Float64MultiArray::ConstPtr& msg)
893 mShowFrom = *msg->data.begin();
894 mShowTo = *(msg->data.begin() + 1);
895 mShowCurrent =
false;
898 std::vector<ISM::ObjectPtr>
getObjects(
unsigned int from,
unsigned int to)
900 std::vector<ISM::ObjectPtr> result;
901 static unsigned int oldTo = to;
916 applyAndGotoNextTimestep(to - mTimestep);
925 for(
auto& t : mTracks)
930 std::vector<std::string> isRefInPatterns;
931 for(
auto& patternToRef : mPatternToRef)
933 if(patternToRef.second == t->type)
935 isRefInPatterns.push_back(patternToRef.first);
938 if(isRefInPatterns.size() > 0)
941 for(
auto& patternTypeToReps : mPatternTypeToVoxelReps)
943 if(patternTypeToReps.first.second != t->type
944 &&
H::contains(isRefInPatterns, patternTypeToReps.first.first))
946 for(uint32_t repTs : patternTypeToReps.second)
948 if(from <= repTs && repTs <= to && !
H::contains(result,
951 result.push_back(t->objects[repTs]);
958 if((!isRef && mFilterViaVgOut) || !mFilterViaVgOut)
960 if(t->objects.size() > to)
964 result.insert(result.end(), t->objects.begin() + from, t->objects.begin() + to + 1);
966 }
else if(t->objects.size() > from)
968 result.insert(result.end(), t->objects.begin() + from, t->objects.end());
991 return std::vector<ISM::ObjectPtr>();
993 return getObjects(0, mTimestep -1);
998 uint32_t maxTimestep = std::get<1>(*mPoints.rbegin());
999 if(maxTimestep > mTimestep)
1001 applyAndGotoNextTimestep(maxTimestep - mTimestep);
1006 ISM::TracksPtr tracks(
new ISM::Tracks(mTracks));
1007 auto objectSets = tracks->toObjectSetVector();
1008 for (
auto objectSet : objectSets) {
1009 rec->insert(objectSet, mPatternName);
1042 std_msgs::ColorRGBA
getColorForTypeId(std::map<std::pair<std::string,std::string>, std_msgs::ColorRGBA >&
1043 typeIdToColor, std::vector<std_msgs::ColorRGBA>& allColors, uint32_t& availColorIndex,
1044 std::string& type, std::string&
id)
1046 std_msgs::ColorRGBA result;
1047 if(typeIdToColor.find(std::make_pair(type,
id)) != typeIdToColor.end())
1049 result = typeIdToColor[std::make_pair(type,
id)];
1052 if(allColors.size() < availColorIndex + 1)
1054 std::uniform_real_distribution<float> urd;
1055 std::default_random_engine re;
1056 result = VIZ::VizHelperRVIZ::createColorRGBA(urd(re), urd(re), urd(re), 1);
1057 allColors.push_back(result);
1060 result = allColors[availColorIndex];
1062 typeIdToColor[std::make_pair(type,
id)] = result;
1072 std::string baseFrame =
"/camera_left_frame";
1073 std::string visualizationTopic =
"/visualization_marker";
1075 double bin_size = 0.03;
1076 double maxAngleDeviation = 10;
1077 bool useXml =
false;
1078 bool useVgOut =
false;
1079 boost::filesystem::path xmlFile;
1080 boost::filesystem::path vgOutFile;
1084 if (!n.
getParam(
"dbfilename", dbFile)) {
1085 throw std::runtime_error(
"dbfilename not set");
1099 if(boost::filesystem::is_regular_file(vgOutFile))
1113 if (!n.
getParam(
"detailedBinNS", detailedBinNS)) {
1114 detailedBinNS =
false;
1118 if (!n.
getParam(
"doPublish", doPublish)) {
1123 if (!n.
getParam(
"bin_size", bin_size)) {
1141 ISM::VotingSpace vs = ISM::VotingSpace(bin_size, maxAngleDeviation);
1157 std::vector<std_msgs::ColorRGBA> allColors;
1158 allColors.push_back(VIZ::VizHelperRVIZ::createColorRGBA(0.0,0.0,0.0,1.0));
1159 allColors.push_back(VIZ::VizHelperRVIZ::createColorRGBA(1.0,0.0,0.0,1.0));
1160 allColors.push_back(VIZ::VizHelperRVIZ::createColorRGBA(0.0,1.0,0.0,1.0));
1161 allColors.push_back(VIZ::VizHelperRVIZ::createColorRGBA(0.0,0.0,1.0,1.0));
1162 allColors.push_back(VIZ::VizHelperRVIZ::createColorRGBA(0.5,0.2,0.9,1.0));
1163 allColors.push_back(VIZ::VizHelperRVIZ::createColorRGBA(0.3,0.8,0.8,1.0));
1164 allColors.push_back(VIZ::VizHelperRVIZ::createColorRGBA(0.3,0.5,0.5,1.0));
1165 allColors.push_back(VIZ::VizHelperRVIZ::createColorRGBA(0.5,0.3,0.1,1.0));
1167 std::map<std::pair<std::string,std::string>, std_msgs::ColorRGBA > typeIdToColor;
std::map< std::string, std::string > mPatternToRef
virtual void applyAndGotoNextTimestep()
std::vector< ISM::TrackPtr > mTracks
OrientCalcType orientCalcTypeFromString(const std::string &s)
boost::mt19937 mRandomGenOrient
RecordGenPoint(std::string name, int32_t id, RecGenPointType type, double posX, double posY, double posZ, double orientW, double orientX, double orientY, double orientZ, OrientCalcType orientCalcType, double posErr, double orientDerivation, unsigned int from, unsigned int to, double linearDegX, double linearDegY, double linearDegZ)
void parseXml(path xmlFile)
dynamic_reconfigure::Server< asr_ism::recordGenConfig > mDynReconfServer
std::vector< double > values
boost::shared_ptr< RecordGenPoint > RecordGenPointPtr
virtual void calcCurrObPos()
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
virtual ~RecordGenPoint()
void applyAndGotoNextTimestep(const uint32_t n)
virtual void calcCurrObPos()
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
boost::uniform_real mUniform
std::tuple< uint32_t, uint32_t, RecordGenPointPtr > FromToPointTuple
RecGenPointType recGenPointTypeFromString(const std::string &s)
std::vector< ISM::ObjectPtr > getCurrentInvisibleObjects()
MidSplinePoint(std::string name, int32_t id, double xs, double ys, double zs, double xe, double ye, double ze, double degree, double timeSpan, double orientW, double orientX, double orientY, double orientZ, OrientCalcType orientCalcType, double posErr, double orientErr, unsigned int from, unsigned int to, double linearDegX, double linearDegY, double linearDegZ)
void applyAndGotoNextTimestep()
std::map< std::pair< std::string, std::string >, std::set< uint32_t > > mPatternTypeToVoxelReps
double frand(double min, double max)
void showFromTo(const std_msgs::Float64MultiArray::ConstPtr &msg)
virtual void calcCurrObOrient()
void setNewParams(double xs, double ys, double zs, double xe, double ye, double ze, double degree, double timeSpan)
MidSplinePointAlt(std::string name, int32_t id, double xs, double ys, double zs, double xe, double ye, double ze, double degree, double timeSpan, double orientW, double orientX, double orientY, double orientZ, OrientCalcType orientCalcType, double posErr, double orientErr, unsigned int from, unsigned int to, double linearDegX, double linearDegY, double linearDegZ)
void filterViaVgOut(boost::filesystem::path vgOutFile)
boost::variate_generator< boost::mt19937, boost::uniform_real<> > * mVariantGen
virtual ~MidSplinePoint()
std::set< std::tuple< uint32_t, uint32_t, RecordGenPointPtr >, cmpFromToPointTuple > mPoints
TFSIMD_FORCE_INLINE const tfScalar & x() const
void dynamicReconfCallback(asr_ism::recordGenConfig &config, uint32_t level)
virtual void calcCurrObPos()
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int main(int argc, char **argv)
std::vector< int32_t > mIdXmlPoints
OrientCalcType mOrientCalcType
std_msgs::ColorRGBA getColorForTypeId(std::map< std::pair< std::string, std::string >, std_msgs::ColorRGBA > &typeIdToColor, std::vector< std_msgs::ColorRGBA > &allColors, uint32_t &availColorIndex, std::string &type, std::string &id)
auto contains(const C &v, const T &x) -> decltype(end(v), true)
void writeToDb(const std_msgs::Empty)
#define ROS_INFO_STREAM(args)
FixRecordGenPoint(std::string name, int32_t id, double x, double y, double z, double orientW, double orientX, double orientY, double orientZ, OrientCalcType orientCalcType, double posErr, double orientErr, unsigned int from, unsigned int to, double linearDegX, double linearDegY, double linearDegZ)
bool getParam(const std::string &key, std::string &s) const
virtual ~FixRecordGenPoint()
boost::normal_distribution mNormal
std::vector< ISM::ObjectPtr > getOldObjects()
std::vector< ISM::ObjectPtr > getCurrentVisibleObjects()
virtual void forceInvisible(bool b)
void setCol(Eigen::MatrixXd &m, int col, Eigen::Vector3d &v, double time)
std::map< RecordGenPointPtr, std::vector< unsigned int > > mTimestampVisibleXmlPoints
Eigen::Spline< double, 4 > mSpline
std::vector< ISM::ObjectPtr > getObjects(unsigned int from, unsigned int to)
boost::mt19937 mRandomGen
RecordGenerator(std::string dbFile, std::string patternName="pattern0", bool doPublish=false)
boost::variate_generator< boost::mt19937, boost::normal_distribution<> > * mVarGenOrient
bool operator()(const FromToPointTuple &a, const FromToPointTuple &b) const
void setNewParams(double x, double y, double z)
virtual void forceInvisible(bool b)