VizHelperRVIZ.hpp
Go to the documentation of this file.
1 
18 #pragma once
19 
20 //Global includes
21 #include <Eigen/Geometry>
22 #include <ros/ros.h>
23 
24 //Global includes
25 
26 //Package includes
27 #include <visualization_msgs/Marker.h>
28 #include <visualization_msgs/MarkerArray.h>
29 
30 //ISM includes
31 #include "ISM/recognizer/VotingSpace.hpp"
32 
33 #include <ISM/common_type/Point.hpp>
34 #include <ISM/common_type/Quaternion.hpp>
35 #include <ISM/common_type/Pose.hpp>
36 #include <ISM/common_type/Track.hpp>
37 #include <ISM/common_type/VoteSpecifier.hpp>
38 
39 #include <boost/random/uniform_real.hpp>
40 #include <boost/random/mersenne_twister.hpp>
41 #include <boost/random/variate_generator.hpp>
42 //Local includes
43 
44 
45 namespace VIZ
46 {
47  typedef boost::variate_generator<boost::mt19937, boost::uniform_real<> > UniformDistributionGenerator;
51 
52 
53  struct cmpVector3i
54  {
55  bool operator()(const Eigen::Vector3i& a, const Eigen::Vector3i& b) const {
56  if(a.x() != b.x() || a.y() != b.y() || a.z() != b.z())
57  {
58  return true;
59  }
60  return false;
61  }
62  };
63 
64  class VizHelperRVIZ {
65  public:
66 
67  static geometry_msgs::Point pointToPointMsg(ISM::PointPtr point);
68  static geometry_msgs::Quaternion quatToQuaternionMsg(ISM::QuaternionPtr quat);
69  static std::vector<ISM::PosePtr> posesFromTrack(ISM::TrackPtr track);
70  static geometry_msgs::Point EVector3DToPointMsg(ISM::PointPtr point, Eigen::Vector3d v3d);
71 
75  static ColorRGBA createColorRGBA(float red, float green, float blue, float alpha);
76  static ColorRGBA createColorRGBA(std::vector<float> rgba);
77 
81  static ColorRGBA hsvToRGBA(double hue, double saturation, double value);
82 
86  static ColorRGBA confidenceToColor(double confidence);
87 
88  static ColorRGBA getColorOfObject(const ISM::Object& object);
89  static ColorRGBA getColorOfObject(const ISM::ObjectPtr object_ptr);
90 
94  static Marker createMarkerWithoutTypeAndPose(std::string baseFrame, std::string markerNamespace, int id, float xScale, float yScale, float zScale, ColorRGBA color, double markerLifetime);
95 
96  static Marker createSphereMarker(ISM::PointPtr point, std::string baseFrame, std::string markerNamespace, int id, float radius, ColorRGBA color, double markerLifetime);
97 
98  static Marker createConeMarker(ISM::PosePtr pose, std::string baseFrame, std::string markerNamespace, int id, float radius, ColorRGBA color, double markerLifetime);
99 
100  static Marker createCylinderMarker(ISM::PosePtr pose, std::string baseFrame, std::string markerNamespace, int id, float radius, float height, ColorRGBA color, double markerLifetime);
101 
102  static Marker createArrowMarkerToPoint(ISM::PointPtr fromPoint, ISM::PointPtr to, std::string baseFrame, std::string markerNamespace, int id, float xScale, float yScale, float zScale, ColorRGBA color, double markerLifetime);
103 
104  static Marker createArrowMarkerToPoint(ISM::PointPtr fromPoint, ISM::PointPtr to, std::string baseFrame, std::string markerNamespace, int id, float xScale, float yScale, float zScale, ColorRGBA color, double markerLifetime, double minLength);
105 
106  static Marker createMeshMarker(ISM::PosePtr pose, std::string baseFrame, std::string markerNamespace, int id, ColorRGBA color, double markerLifetime, std::string resourcePath);
107 
108  static MarkerArray createTrackMarkers(std::vector<ISM::PosePtr> trackPoses, std::string baseFrame, std::string markerNamespace, float lineWidth, ColorRGBA color, double markerLifetime);
109 
110  static visualization_msgs::MarkerArray createSphereMarkerWithOrientation
111  (ISM::PosePtr pose, std::string baseFrame, std::string markerNamespace, int id,
112  float radius, std_msgs::ColorRGBA color, double markerLifetime, int axesFirstId);
113 
114  static Marker createLineMarkerFormPair(std::vector<std::pair<ISM::PointPtr, ISM::PointPtr>> pointPair, std::string baseFrame, std::string markerNamespace, float arrowScale, ColorRGBA color, double markerLifetime);
115 
116  static std::vector<geometry_msgs::Point> calculateAxesPoints(ISM::PointPtr point, ISM::QuaternionPtr quat, float scale);
117 
118  static MarkerArray createCoordinateArrow(std::vector<std::pair<ISM::PointPtr, std::vector<ISM::PosePtr> > > poses_vec, std::string baseFrame, std::string markerNamespace, float arrowScale, float axisScale, ColorRGBA color, double markerLifetime);
119 
120  static MarkerArray createCoordinateMarkerWithAngle(ISM::PosePtr pose, std::string baseFrame, std::string markerNamespace, int id, float length, float openAngle, double markerLifetime);
121 
122  static MarkerArray createRingMarker(ISM::PosePtr pose, std::string baseFrame, std::string markerNamespace, float scale, ColorRGBA x, ColorRGBA y, ColorRGBA z, ColorRGBA a, ColorRGBA b, ColorRGBA g, double markerLifetime);
123 
124  static Marker createLineArrow(ISM::PointPtr fromPoint, std::vector<ISM::PosePtr> toPoses, std::string baseFrame, std::string markerNamespace, int &id, float arrowScale, ColorRGBA color, double markerLifetime);
125 
126  static MarkerArray createCubeArrow(ISM::PosePtr pose, std::string baseFrame, std::string markerNamespace, int &id, float scale, ColorRGBA cubeColor, ColorRGBA arrowColor, double markerLifetime);
127 
128  static Marker createCylinderLine(ISM::PosePtr pose, std::string baseFrame, std::string markerNamespace, float scale, float length, ColorRGBA color, double markerLifetime);
129 
130  static MarkerArray createPositionVector(ISM::PosePtr pose, std::string baseFrame, std::string markerNamespace, ColorRGBA color, UniformDistributionGenerator* udg, int sampels, int axis, int id, float length, float openAngle, float sphereRadius, double markerLifetime);
131 
132  static geometry_msgs::Point createPoint(double x, double y, double z);
133 
134  static visualization_msgs::MarkerArray createArrowMarkerFromVote(ISM::VoteSpecifierPtr vote,
135  ISM::ObjectPtr o, std::string baseFrame, std::string ns, int32_t id, double bin_size,
136  std_msgs::ColorRGBA binColor, std_msgs::ColorRGBA voteColor = VizHelperRVIZ::createColorRGBA(1.0, 0.0, 1.0, 0.5));
137  static MarkerArray createCoordinateMarker(ISM::PosePtr pose, std::string baseFrame, std::string markerNamespace, int id, float length, float radius, double markerLifetime);
138 
139  static Marker pointToCuboid(std::string ns, int32_t id, std::string frame,
140  double x, double y, double z, double xwitdh, double ywidth, double zwidth,
141  std_msgs::ColorRGBA color);
142 
143  static geometry_msgs::Point genCuboidPoint(int xp, int yp, int zp, double x, double y, double z, double xwidth, double ywidth, double zwidth);
144 
145  static Marker pointToCube(std::string ns, int id, std::string frame,
146  double x, double y, double z, double bin_size, std_msgs::ColorRGBA color);
147 
148  static Marker getBinMarker(Eigen::Vector3i bin, double bin_size,
149  std::string desc, int id, std::string baseFrame, std_msgs::ColorRGBA color);
150 
151  static Marker getBinMarker(int x, int y, int z, double bin_size,
152  std::string desc, int id, std::string baseFrame, std_msgs::ColorRGBA color);
153 
154  static MarkerArray getBinFromPoint (const ISM::PointPtr point,
155  double sensivity, std::string baseFrame, std_msgs::ColorRGBA color);
156 
157  static std::map<Eigen::Vector3i, bool, cmpVector3i > binDrawn;
158 
159  static Marker createLine(ISM::PointPtr fromPoint, ISM::PointPtr toPoint, float width, int id, std::string baseFrame, std::string markerNamespace, std_msgs::ColorRGBA color, double markerLifetime);
160  };
161 }
static std::map< Eigen::Vector3i, bool, cmpVector3i > binDrawn
visualization_msgs::Marker Marker
TFSIMD_FORCE_INLINE const tfScalar & y() const
static ColorRGBA createColorRGBA(float red, float green, float blue, float alpha)
std_msgs::ColorRGBA ColorRGBA
TFSIMD_FORCE_INLINE const tfScalar & x() const
visualization_msgs::MarkerArray MarkerArray
TFSIMD_FORCE_INLINE const tfScalar & z() const
bool operator()(const Eigen::Vector3i &a, const Eigen::Vector3i &b) const
boost::variate_generator< boost::mt19937, boost::uniform_real<> > UniformDistributionGenerator
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)


asr_ism_visualizations
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Meißner Pascal, Reckling Reno, Stöckle Patrick, Trautmann Jeremias
autogenerated on Fri Nov 8 2019 03:28:47