38 #include <grasping_msgs/FindGraspableObjectsAction.h> 42 #include <pcl/filters/passthrough.h> 96 ROS_INFO(
"basic_grasping_perception initialized");
100 void cloudCallback(
const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr& cloud)
106 ROS_DEBUG(
"Cloud recieved with %d points.", static_cast<int>(cloud->points.size()));
109 pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_filtered(
new pcl::PointCloud<pcl::PointXYZRGB>);
112 ROS_DEBUG(
"Filtered for range, now %d points.", static_cast<int>(cloud_filtered->points.size()));
115 pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud_transformed(
new pcl::PointCloud<pcl::PointXYZRGB>);
125 pcl::PointCloud<pcl::PointXYZRGB> object_cloud;
126 pcl::PointCloud<pcl::PointXYZRGB> support_cloud;
129 object_cloud.header.frame_id = cloud_transformed->header.frame_id;
130 support_cloud.header.frame_id = cloud_transformed->header.frame_id;
146 grasping_msgs::FindGraspableObjectsResult result;
157 server_->setAborted(result,
"Failed to get camera data in alloted time.");
158 ROS_ERROR(
"Failed to get camera data in alloted time.");
164 for (
size_t i = 0; i <
objects_.size(); ++i)
166 grasping_msgs::GraspableObject g;
168 if (goal->plan_grasps)
173 result.objects.push_back(g);
178 server_->setSucceeded(result,
"Succeeded.");
206 int main(
int argc,
char* argv[])
208 ros::init(argc, argv,
"basic_grasping_perception");
ROS wrapper for shape grasp planner + object support segmentation.
boost::shared_ptr< server_t > server_
void publish(const boost::shared_ptr< M > &message) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ros::Publisher object_cloud_pub_
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Class that segments a point cloud into objects and supporting surfaces.
ROSCPP_DECL void spin(Spinner &spinner)
pcl::PassThrough< pcl::PointXYZRGB > range_filter_
void executeCallback(const grasping_msgs::FindGraspableObjectsGoalConstPtr &goal)
std::vector< grasping_msgs::Object > objects_
int main(int argc, char *argv[])
ros::Subscriber cloud_sub_
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
BasicGraspingPerception(ros::NodeHandle n)
boost::shared_ptr< ObjectSupportSegmentation > segmentation_
boost::shared_ptr< ShapeGraspPlanner > planner_
void transformPointCloud(const pcl::PointCloud< PointT > &cloud_in, pcl::PointCloud< PointT > &cloud_out, const tf::Transform &transform)
actionlib::SimpleActionServer< grasping_msgs::FindGraspableObjectsAction > server_t
bool getParam(const std::string &key, std::string &s) const
std::vector< grasping_msgs::Object > supports_
tf::TransformListener listener_
void cloudCallback(const pcl::PointCloud< pcl::PointXYZRGB >::ConstPtr &cloud)
ros::Publisher support_cloud_pub_
A simple grasp planner that uses the bounding box shape to generate viable grasps.