choreo_visual_tools.h
Go to the documentation of this file.
1 #ifndef CHOREO_VISUAL_TOOL_H
2 #define CHOREO_VISUAL_TOOL_H
3 
4 // C++
5 #include <string>
6 #include <vector>
7 
8 // ROS
9 #include <ros/ros.h>
10 
11 #include <Eigen/Core>
12 #include <Eigen/Geometry>
13 
14 // For visualizing things in rviz
16 
17 #include <choreo_msgs/ElementCandidatePoses.h>
18 #include <choreo_msgs/AssemblySequencePickNPlace.h>
19 
21 {
22 // TODO: not used in picknplace
24 {
26  CREATE=1,
28 };
29 
31 {
32  Eigen::Vector3d start_pt;
33  Eigen::Vector3d end_pt;
34 
35  std::vector<Eigen::Vector3d> oriented_st_pts;
36  Eigen::Vector3d avr_orient_vec;
37 
39  double diameter;
40  int layer_id;
41 };
42 
44 {
45  typedef std::vector<choreo_msgs::ElementCandidatePoses> PathArray;
46  typedef std::vector<choreo_visual_tools::VisualUnitProcessPath> VisualPathArray;
47 
48  public:
50  virtual ~ChoreoVisualTools(){}
51 
52  // initiator: TODO: should merge into the constructor
53  // framename: common base for all visualization markers, usually "/world" or "/base_link"
54  // marker_topic - rostopic to publish markers to - your Rviz display should match
55  // robot_model: load robot model pointer so that we don't have do re-parse it here
56  void init(std::string frame_name,
57  std::string marker_topic,
58  robot_model::RobotModelConstPtr robot_model = robot_model::RobotModelConstPtr());
59 
60  // set visual wire frames
61  // visualize layer decomposition and wire frames
62  // when no assembly seq (with grasps) is inputted
63  void setVisualWireFrame(const PathArray& path_array)
64  {
65  path_array_ = path_array;
66  convertWireFrameVisual(path_array_, visual_path_array_);
67  }
68 
69  // set visual assembly seq for spatial extrusion
70  void setProcessPath(const PathArray& path_array)
71  {
72  path_array_ = path_array;
73  convertPathVisual(path_array_, visual_path_array_);
74  }
75 
76  int getPathArraySize() { return visual_path_array_.size(); }
77 
78  // VISUALIZE SEQUENCED EXTRUSIONS
79  //
80  // visualize all extrusion sequence at once, mark different types
81  // of process: blue: support, yellow: create, red: connect
82  void visualizeAllPaths();
83 
84  // visualize extrusion sequence until the given index
85  // all elements are painted grey except element No. index
86  void visualizePathUntil(int index);
87 
88  // visualize feasible orientations using green lines
89  void visualizeFeasibleOrientations(int index, bool solid);
90  //
91  // VISUALIZE SEQUENCED EXTRUSIONS END
92 
93  //
94  void visualizeAllWireFrame();
95 
96  //TODO: not implemented now
97  void visualizeWireFrameUntilLayer(int index);
98 
99  // PICKNPLACE
100  //
101  void setAssemblySequencePickNPlace(const choreo_msgs::AssemblySequencePickNPlace& as_pnp) { as_pnp_ = as_pnp; }
102 
103  void visualizeSequencePickNPlaceUntil(int index);
104 
105  void visualizeGraspPickNPlace(int index, int grasp_id, bool visualize_ee);
106 
107  void visualizeAllSequencePickNPlace();
108 
109  void visualizeSupportSurfaces();
110  void visualizeSupportSurfaces(const std::vector<std::string>& pick_contact_surf_names,
111  const std::vector<std::string>& place_contact_surf_names);
112  //
113  // PICKNPLACE END
114 
115  void cleanUpAllPaths();
116 
117  protected:
118  void convertPathVisual(const PathArray& path_array, VisualPathArray& visual_path_array);
119  void convertWireFrameVisual(const PathArray& path_array, VisualPathArray& visual_path_array);
120 
121  private:
123 
125 
126  PathArray path_array_;
127  VisualPathArray visual_path_array_;
128 
129  // TODO: should try to make two assembly type's function unites under one scheme
130  choreo_msgs::AssemblySequencePickNPlace as_pnp_;
131 
132  // Pointer to the robot model
133  moveit::core::RobotModelConstPtr robot_model_;
134 };
135 }
136 
137 #endif
std::shared_ptr< MoveItVisualTools > MoveItVisualToolsPtr
std::vector< Eigen::Vector3d > oriented_st_pts
std::vector< choreo_msgs::ElementCandidatePoses > PathArray
void setProcessPath(const PathArray &path_array)
std::vector< choreo_visual_tools::VisualUnitProcessPath > VisualPathArray
unsigned int index
void setAssemblySequencePickNPlace(const choreo_msgs::AssemblySequencePickNPlace &as_pnp)
void setVisualWireFrame(const PathArray &path_array)
moveit_visual_tools::MoveItVisualToolsPtr visual_tools_
moveit::core::RobotModelConstPtr robot_model_
choreo_msgs::AssemblySequencePickNPlace as_pnp_


choreo_visual_tools
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 03:59:34