rapid
A ROS robotics library.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
hsurface.h
Go to the documentation of this file.
1 #ifndef _RAPID_PERCEPTION_HSURFACE_H_
2 #define _RAPID_PERCEPTION_HSURFACE_H_
3 
4 #include <string>
5 #include <vector>
6 
7 #include "geometry_msgs/PoseStamped.h"
8 #include "geometry_msgs/Vector3.h"
9 #include "pcl/PointIndices.h"
10 #include "pcl/point_cloud.h"
11 #include "pcl/point_types.h"
12 
14 
15 namespace rapid {
16 namespace perception {
17 // An HSurface is a horizontal surface that objects can rest on.
18 // Like an rviz marker, the position of an HSurface refers to its center, and
19 // its scale gives the dimensions in the x, y, and z directions.
20 class HSurface {
21  public:
22  HSurface();
23 
24  // Add an object to this HSurface.
25  void AddObject(const Object& object);
26 
27  // Get a PointCloud representation of this HSurface.
28  pcl::PointCloud<pcl::PointXYZRGB>::Ptr GetCloud() const;
29 
30  // Set the point cloud containing this HSurface, and the indices of that point
31  // cloud representing this HSurface.
32  void SetCloud(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr& cloud,
33  const pcl::PointIndices::ConstPtr& indices);
34 
35  // Finds an object by name. Returns false if the object does not exist.
36  bool GetObject(const std::string& name, Object* object);
37 
38  // Getters / setters.
39  std::string name() const;
40  geometry_msgs::PoseStamped pose() const;
41  geometry_msgs::Vector3 scale() const;
42 
43  void set_name(const std::string& name);
44  void set_pose(const geometry_msgs::PoseStamped& ps);
45  void set_scale(const geometry_msgs::Vector3& scale);
46  std::vector<Object> objects() const;
47 
48  // void Visualize();
49 
50  private:
51  pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr cloud_;
52  pcl::PointIndices::ConstPtr indices_;
53 
54  std::string name_; // Name of this HSurface, e.g., "table"
55  geometry_msgs::PoseStamped pose_stamped_; // Pose of table's center.
56  geometry_msgs::Vector3 scale_; // Dimensions along x, y, and z, in meters.
57 
58  std::vector<Object> objects_;
59 
60  // Visualization
61  // ros::Publisher viz_pub_;
62  // rapid::viz::Marker marker_;
63 };
64 
65 } // namespace perception
66 } // namespace rapid
67 
68 #endif // _RAPID_PERCEPTION_HSURFACE_H_
std::string name() const
pcl::PointCloud< pcl::PointXYZRGB >::Ptr GetCloud() const
void set_name(const std::string &name)
void set_pose(const geometry_msgs::PoseStamped &ps)
void set_scale(const geometry_msgs::Vector3 &scale)
geometry_msgs::Vector3 scale() const
geometry_msgs::PoseStamped pose() const
bool GetObject(const std::string &name, Object *object)
std::vector< Object > objects() const
void AddObject(const Object &object)
void SetCloud(const pcl::PointCloud< pcl::PointXYZRGB >::ConstPtr &cloud, const pcl::PointIndices::ConstPtr &indices)