builder.h
Go to the documentation of this file.
00001 #ifndef _ROBOT_MARKERS_BUILDER_H_
00002 #define _ROBOT_MARKERS_BUILDER_H_
00003 
00004 #include <map>
00005 #include <set>
00006 #include <string>
00007 
00008 #include "geometry_msgs/Pose.h"
00009 #include "ros/duration.h"
00010 #include "ros/time.h"
00011 #include "std_msgs/ColorRGBA.h"
00012 #include "transform_graph/transform_graph.h"
00013 #include "urdf/model.h"
00014 #include "visualization_msgs/Marker.h"
00015 #include "visualization_msgs/MarkerArray.h"
00016 
00017 #include "robot_markers/forward_kinematics.h"
00018 
00019 namespace robot_markers {
00081 class Builder {
00082  public:
00084   explicit Builder(const urdf::Model& model);
00085 
00090   void Init();
00091 
00099   void SetJointPositions(const std::map<std::string, double> joint_positions);
00100 
00106   void SetFrameId(const std::string& frame_id);
00107 
00113   void SetTime(const ros::Time& stamp);
00114 
00121   void SetNamespace(const std::string& ns);
00122 
00126   void SetPose(const geometry_msgs::Pose& pose);
00127 
00138   void SetColor(float r, float g, float b, float a);
00139 
00143   void SetLifetime(const ros::Duration& lifetime);
00144 
00151   void SetFrameLocked(bool frame_locked);
00152 
00160   void Build(visualization_msgs::MarkerArray* marker_array);
00161 
00170   void Build(const std::set<std::string>& link_names,
00171              visualization_msgs::MarkerArray* marker_array);
00172 
00173  private:
00174   // Sets everything in the marker except the pose.
00175   void BuildMarker(const urdf::Link& link, int id,
00176                    visualization_msgs::Marker* output);
00177   std::string NodeName(const std::string& name);
00178 
00179   urdf::Model model_;
00180   ForwardKinematics fk_;
00181   transform_graph::Graph tf_graph_;
00182 
00183   // Marker fields
00184   std::string frame_id_;
00185   ros::Time stamp_;
00186   std::string ns_;
00187   geometry_msgs::Pose pose_;
00188   std_msgs::ColorRGBA color_;
00189   ros::Duration lifetime_;
00190   bool frame_locked_;
00191 
00192   bool has_initialized_;
00193 };
00194 }  // namespace robot_markers
00195 
00196 #endif  // _ROBOT_MARKERS_BUILDER_H_


robot_markers
Author(s):
autogenerated on Sat Jun 8 2019 20:39:25