36 PlaneFinder::PlaneFinder() :
37 tfListener_(tfBuffer_), waiting_(false)
48 std::string topic_name;
49 nh.
param<std::string>(
"topic", topic_name,
"/points");
133 for (
size_t i = 0; i < num_points; i++)
135 geometry_msgs::PointStamped p;
136 p.point.x = (xyz + i)[X];
137 p.point.y = (xyz + i)[Y];
138 p.point.z = (xyz + i)[Z];
141 if (!std::isfinite(p.point.x) || !std::isfinite(p.point.y) || !std::isfinite(p.point.z))
150 geometry_msgs::PointStamped p_out;
154 p.header.frame_id =
cloud_.header.frame_id;
179 (cloud_iter + j)[X] = (xyz + i)[
X];
180 (cloud_iter + j)[Y] = (xyz + i)[
Y];
181 (cloud_iter + j)[Z] = (xyz + i)[
Z];
189 size_t points_total = std::min(static_cast<size_t>(
points_max_), j);
190 ROS_INFO_STREAM(
"Got " << j <<
" points from plane, using " << points_total);
193 sensor_msgs::PointCloud2 viz_cloud;
195 viz_cloud.height = 0;
197 viz_cloud.header.frame_id =
cloud_.header.frame_id;
200 cloud_mod.
resize(points_total);
204 int idx_cam = msg->observations.size();
205 msg->observations.resize(msg->observations.size() + 1);
211 size_t index = step / 2;
212 for (
size_t i = 0; index <
cloud_.width; i++)
215 geometry_msgs::PointStamped rgbd;
216 rgbd.point.x = (xyz + index)[X];
217 rgbd.point.y = (xyz + index)[Y];
218 rgbd.point.z = (xyz + index)[Z];
221 msg->observations[idx_cam].features.push_back(rgbd);
224 viz_cloud_iter[0] = rgbd.point.x;
225 viz_cloud_iter[1] = rgbd.point.y;
226 viz_cloud_iter[2] = rgbd.point.z;
236 msg->observations[idx_cam].cloud =
cloud_;
std::string camera_sensor_name_
ros::Publisher publisher_
void publish(const boost::shared_ptr< M > &message) const
bool init(const std::string &name, ros::NodeHandle &n)
Initialize the feature finder.
Base class for a feature finder.
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
DepthCameraInfoManager depth_camera_manager_
robot_calibration_msgs::ExtendedCameraInfo getDepthCameraInfo()
bool init(ros::NodeHandle &n)
virtual bool init(const std::string &name, ros::NodeHandle &nh)
Initialize the feature finder.
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
std::string transform_frame_
sensor_msgs::PointCloud2 cloud_
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
bool find(robot_calibration_msgs::CalibrationData *msg)
Once the robot has been moved into the proper position and settled, this function will be called...
std::string getName()
Get the name of this feature finder.
Calibration code lives under this namespace.
tf2_ros::Buffer tfBuffer_
#define ROS_INFO_STREAM(args)
ros::Subscriber subscriber_
T & transform(const T &in, T &out, const std::string &target_frame, ros::Duration timeout=ros::Duration(0.0)) const
ROSCPP_DECL void spinOnce()
void setPointCloud2FieldsByString(int n_fields,...)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
void cameraCallback(const sensor_msgs::PointCloud2 &cloud)