visualization.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Roboception GmbH
3  *
4  * Author: Monika Florek-Jasinska
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above copyright notice,
13  * this list of conditions and the following disclaimer in the documentation
14  * and/or other materials provided with the distribution.
15  *
16  * 3. Neither the name of the copyright holder nor the names of its contributors
17  * may be used to endorse or promote products derived from this software without
18  * specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef RC_PICK_CLIENT_PUBLISH_PICK_VISULIZATION_H
34 #define RC_PICK_CLIENT_PUBLISH_PICK_VISULIZATION_H
35 
36 #include <ros/ros.h>
37 #include <rc_pick_client/SuctionGrasp.h>
38 #include <visualization_msgs/MarkerArray.h>
40 #include <rc_pick_client/LoadCarrier.h>
41 #include <rc_pick_client/Item.h>
42 
44 
45 namespace pick_visualization
46 {
48 {
49 public:
50  explicit Visualization(const ros::NodeHandle& nh);
51 
53 
54  /*
55  * Remove previously published markers of this type.
56  * Publish grasps as tf frames (name: node_namespace/grasp_#) and marker spheres on topic grasp in node_namespace
57  * of size (max_suction_surface_length, max_suction_surface_width, 0)
58  */
59  void visualizeGrasps(const std::vector<rc_pick_client::SuctionGrasp>& ros_grasps);
60 
61  /*
62  * Remove previously published markers of this type.
63  * Publish load carrier position as tf frame (name: lc_#) and load carrier model as 5 cube markers on topic
64  * on topic lc in node_namespace
65  */
66  void visualizeLoadCarriers(const std::vector<rc_pick_client::LoadCarrier>& ros_lcs);
67 
68  /*
69  * Remove previously published markers of this type.
70  * Publish box item position as tf frame (name: boxitem_#) and cube markers on topic boxitem in node_namespace
71  */
72  void visualizeDetectedBoxes(const std::vector<rc_pick_client::Item>& ros_boxitems);
73 
74  /*
75  * Remove previously published box item markers.
76  */
77  void deleteBoxItemMarkers();
78 
79  /*
80  * Remove previously published load carrier markers.
81  */
83 
84  /*
85  * Remove previously published grasp markers.
86  */
87  void deleteGraspMarkers();
88 
89 private:
91 
96  visualization_msgs::MarkerArray markers_lcs_;
97  visualization_msgs::MarkerArray markers_grasps_;
98  visualization_msgs::MarkerArray markers_boxes_;
99  /*
100  * Construct model of the load carrier that consist of 5 cube meshes representing 5 walls of the load carrier and
101  * append it to marker_array
102  */
103  static void constructLoadCarrier(visualization_msgs::MarkerArray& marker_array, const rc_pick_client::LoadCarrier& lc,
104  const int& lc_no);
105  /*
106  * Set markers characteristics
107  */
108  void setMarker(visualization_msgs::Marker& marker, const geometry_msgs::Pose& item_pose,
109  const rc_pick_client::Rectangle& rectangle, std::string frame_id, int marker_id);
110 
111  /*
112  * Publish given pose as tf frame
113  */
114  void publishTf(const geometry_msgs::Pose& ros_pose, std::string frame_id, std::string id);
115 };
116 } // namespace pick_visualization
117 
118 #endif // RC_PICK_CLIENT_PUBLISH_PICK_VISULIZATION_H
pick_visualization::Visualization::setMarker
void setMarker(visualization_msgs::Marker &marker, const geometry_msgs::Pose &item_pose, const rc_pick_client::Rectangle &rectangle, std::string frame_id, int marker_id)
Definition: visualization.cpp:228
pick_visualization::Visualization::markers_grasps_
visualization_msgs::MarkerArray markers_grasps_
Definition: visualization.h:97
pick_visualization::Visualization::markers_boxes_
visualization_msgs::MarkerArray markers_boxes_
Definition: visualization.h:98
ros::Publisher
pick_visualization::Visualization::Visualization
Visualization(const ros::NodeHandle &nh)
Definition: visualization.cpp:37
ros.h
pick_visualization::Visualization::markers_lcs_
visualization_msgs::MarkerArray markers_lcs_
Definition: visualization.h:96
pick_visualization::Visualization::publishTf
void publishTf(const geometry_msgs::Pose &ros_pose, std::string frame_id, std::string id)
Definition: visualization.cpp:244
transform_broadcaster.h
pick_visualization::Visualization::nh_
ros::NodeHandle nh_
Definition: visualization.h:90
pick_visualization::Visualization::box_marker_pub_
ros::Publisher box_marker_pub_
Definition: visualization.h:94
pick_visualization::Visualization
Definition: visualization.h:47
pick_visualization::Visualization::deleteBoxItemMarkers
void deleteBoxItemMarkers()
Definition: visualization.cpp:160
pick_visualization::Visualization::visualizeLoadCarriers
void visualizeLoadCarriers(const std::vector< rc_pick_client::LoadCarrier > &ros_lcs)
Definition: visualization.cpp:170
tf::TransformBroadcaster
pick_visualization::Visualization::deleteLoadCarrierMarkers
void deleteLoadCarrierMarkers()
Definition: visualization.cpp:140
pick_visualization::Visualization::deleteGraspMarkers
void deleteGraspMarkers()
Definition: visualization.cpp:150
pick_visualization::Visualization::visualizeGrasps
void visualizeGrasps(const std::vector< rc_pick_client::SuctionGrasp > &ros_grasps)
Definition: visualization.cpp:186
pick_visualization
Definition: visualization.cpp:35
pick_visualization::Visualization::~Visualization
~Visualization()
Definition: visualization.cpp:44
pick_visualization::Visualization::br_
tf::TransformBroadcaster br_
Definition: visualization.h:95
tf2_geometry_msgs.h
pick_visualization::Visualization::lc_marker_pub_
ros::Publisher lc_marker_pub_
Definition: visualization.h:93
pick_visualization::Visualization::constructLoadCarrier
static void constructLoadCarrier(visualization_msgs::MarkerArray &marker_array, const rc_pick_client::LoadCarrier &lc, const int &lc_no)
Definition: visualization.cpp:61
ros::NodeHandle
pick_visualization::Visualization::visualizeDetectedBoxes
void visualizeDetectedBoxes(const std::vector< rc_pick_client::Item > &ros_boxitems)
Definition: visualization.cpp:209
pick_visualization::Visualization::grasp_marker_pub_
ros::Publisher grasp_marker_pub_
Definition: visualization.h:92


rc_pick_client
Author(s): Monika Florek-Jasinska
autogenerated on Sun May 15 2022 02:24:50