37 tf_listener_(tf_buffer_), waiting_(false)
48 std::string topic_name;
49 nh.
param<std::string>(
"topic", topic_name,
"/scan");
120 sensor_msgs::PointCloud2 cloud;
147 size_t line_point_count = 0;
148 for (
size_t i = 0; i <
scan_.ranges.size(); ++i)
151 if (!std::isfinite(
scan_.ranges[i]))
160 geometry_msgs::PointStamped p;
161 p.point.x =
cos(angle) *
scan_.ranges[i];
162 p.point.y =
sin(angle) *
scan_.ranges[i];
174 geometry_msgs::PointStamped p_out;
178 p.header.frame_id =
scan_.header.frame_id;
197 (cloud_iter + line_point_count)[X] = p_out.point.x;
198 (cloud_iter + line_point_count)[
Y] = p_out.point.y;
199 (cloud_iter + line_point_count)[Z] = p_out.point.z;
206 cloud.width = line_point_count;
210 robot_calibration_msgs::CalibrationData * msg)
212 if (static_cast<int>(cloud.width) == 0)
214 ROS_WARN(
"No points in observation, skipping");
221 sensor_msgs::PointCloud2 viz_cloud;
223 viz_cloud.height = 0;
225 viz_cloud.header.frame_id = cloud.header.frame_id;
228 cloud_mod.
resize(cloud.width);
231 int idx_cam = msg->observations.size();
232 msg->observations.resize(msg->observations.size() + 1);
238 for (
size_t i = 0; i < cloud.width; ++i)
241 geometry_msgs::PointStamped rgbd;
242 rgbd.point.x = (xyz + i)[X];
243 rgbd.point.y = (xyz + i)[Y];
244 rgbd.point.z = (xyz + i)[Z];
247 msg->observations[idx_cam].features.push_back(rgbd);
250 viz_cloud_iter[0] = rgbd.point.x;
251 viz_cloud_iter[1] = rgbd.point.y;
252 viz_cloud_iter[2] = rgbd.point.z;
259 msg->observations[idx_cam].cloud = cloud;
T & transform(const T &in, T &out, const std::string &target_frame, ros::Duration timeout=ros::Duration(0.0)) const
Base class for a feature finder.
tf2_ros::Buffer tf_buffer_
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
virtual bool waitForScan()
Wait until a new scan has arrived.
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
virtual bool find(robot_calibration_msgs::CalibrationData *msg)
Once the robot has been moved into the proper position and settled, this function will be called...
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
void publish(const boost::shared_ptr< M > &message) const
sensor_msgs::LaserScan scan_
virtual bool init(const std::string &name, ros::NodeHandle &n)
Initialize the feature finder.
void extractObservation(const sensor_msgs::PointCloud2 &cloud, robot_calibration_msgs::CalibrationData *msg)
Extract the point cloud into a calibration message.
virtual bool init(const std::string &name, ros::NodeHandle &nh)
Initialize the feature finder.
std::string transform_frame_
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
std::string getName()
Get the name of this feature finder.
The scan finder is useful for aligning a laser scanner with other sensors. In particular, the laser scan be multiplied in the Z direction in order to create a plane for plane to plane calibration.
Calibration code lives under this namespace.
#define ROS_INFO_STREAM(args)
ros::Subscriber subscriber_
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
std::string laser_sensor_name_
ROSCPP_DECL void spinOnce()
void setPointCloud2FieldsByString(int n_fields,...)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
virtual void scanCallback(const sensor_msgs::LaserScan &scan)
ROS callback - updates scan_ and resets waiting_ to false.
void extractPoints(sensor_msgs::PointCloud2 &cloud)
Extract a point cloud from laser scan points that meet criteria.
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
ros::Publisher publisher_