32 unsigned int& pMarkerId,
38 throw std::invalid_argument(
"Empty ros::publisher cannot be used to publish marker messages.");
42 throw std::invalid_argument(
"Invalid pointer: pose of coordinate frame.");
45 visualization_msgs::MarkerArray msg;
48 for(
unsigned int i = 0; i < 3; i++)
49 msg.markers.push_back(
generateAxis(pMarkerId++, i, pPose, pSize));
52 pPublisher->publish(msg);
56 const unsigned int pAxis,
60 visualization_msgs::Marker msg;
76 msg.type = visualization_msgs::Marker::ARROW;
79 msg.action = visualization_msgs::Marker::ADD;
82 msg.scale.x = msg.scale.y = 0.01 * pSize;
85 geometry_msgs::Point start;
89 msg.points.push_back(start);
92 double length = 0.05 * pSize;
93 geometry_msgs::Point stop;
94 stop.x = ((pAxis == 0) ? 1.0 : 0.0) * length;
95 stop.y = ((pAxis - 1 == 0) ? 1.0 : 0.0) * length;
96 stop.z = ((pAxis - 2 == 0) ? 1.0 : 0.0) * length;
97 msg.points.push_back(stop);
100 Eigen::Vector3d position = pPose->point->getEigen();
101 msg.pose.position.x = position[0];
102 msg.pose.position.y = position[1];
103 msg.pose.position.z = position[2];
105 Eigen::Quaternion<double> orientation = pPose->quat->getEigen();
106 msg.pose.orientation.w = orientation.w();
107 msg.pose.orientation.x = orientation.x();
108 msg.pose.orientation.y = orientation.y();
109 msg.pose.orientation.z = orientation.z();
112 msg.color.r = (pAxis == 0) ? 1.0 : 0.0;
113 msg.color.g = (pAxis - 1 == 0) ? 1.0 : 0.0;
114 msg.color.b = (pAxis - 2 == 0) ? 1.0 : 0.0;
void publishFrame(boost::shared_ptr< ros::Publisher > pPublisher, unsigned int &pMarkerId, const boost::shared_ptr< ISM::Pose > pPose, double pSize)
std::string getNamespace()
~CoordinateFrameVisualizer()
CoordinateFrameVisualizer()
visualization_msgs::Marker generateAxis(const unsigned int pMarkerId, const unsigned int pAxis, const boost::shared_ptr< ISM::Pose > pPose, double pSize)
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)