33 int main (
int argc,
char** argv)
35 ros::init(argc, argv,
"PolarScanMatching Node");
42 ROS_INFO(
"Creating PolarScanMatching node");
61 ROS_INFO(
"Destroying PolarScanMatching node");
68 std::string odometryType;
80 if (!nh_private.
getParam (
"odometry_type", odometryType))
81 odometryType =
"none";
83 if (odometryType.compare(
"none") == 0)
88 else if (odometryType.compare(
"tf") == 0)
93 else if (odometryType.compare(
"imu") == 0)
100 ROS_WARN(
"Unknown value of odometry_type parameter passed to psm_node. \ 101 Using default value (\"none\")");
134 ROS_WARN(
"ScanMatcherNode: Could get initial laser transform, skipping scan (%s)", ex.what());
144 matcher_.
PM_FOV = (scan.angle_max - scan.angle_min) * 180.0 / M_PI;
177 tf::Quaternion q(imuMsg.orientation.x, imuMsg.orientation.y, imuMsg.orientation.z, imuMsg.orientation.w);
189 struct timeval start, end;
190 gettimeofday(&start, NULL);
256 double da = currPMScan->
th;
280 gettimeofday(&end, NULL);
281 double dur = ((end.tv_sec * 1000000 + end.tv_usec ) -
282 (start.tv_sec * 1000000 + start.tv_usec)) / 1000.0;
286 ROS_INFO(
"dur:\t %.3f ms \t ave:\t %.3f ms", dur, ave);
298 geometry_msgs::Pose2D pose;
308 geometry_msgs::Pose2D pose;
315 pmScan->
th = pose.theta;
317 for (
int i = 0; i < scan.ranges.size(); ++i)
319 if (scan.ranges[i] == 0)
321 pmScan->
r[i] = 99999;
340 const sensor_msgs::LaserScan& scanMsg)
350 ROS_WARN(
"Transform unavailable, using last estimated pose (%s)", ex.what());
354 worldToBase = worldToBaseTf;
361 q.
setRPY(0, 0, pose.theta);
368 double roll, pitch, yaw;
369 m.
getRPY(roll, pitch, yaw);
int main(int argc, char **argv)
PM_TYPE pm_psm(PMScan *lsr, PMScan *lsa)
int PM_MAX_ITER
stopping condition; the pose change has to be smaller than ...
ros::Subscriber scanSubscriber_
void pm_init()
Initialises internar variables.
void pm_median_filter(PMScan *ls)
void publish(const boost::shared_ptr< M > &message) const
tf::Transform baseToLaser_
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void pm_segment_scan(PMScan *ls)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
TFSIMD_FORCE_INLINE const tfScalar & getY() const
void tfToPose2D(const tf::Transform &t, geometry_msgs::Pose2D &pose)
int PM_STOP_COND_ICP
maximum number of iterations for ICP,MBICP
void rosToPMScan(const sensor_msgs::LaserScan &scan, const tf::Transform &change, PMScan *pmScan)
ROSCPP_DECL void spin(Spinner &spinner)
int PM_SEARCH_WINDOW
minimum number of valid points for scanmatching
void pm_find_far_points(PMScan *ls)
tf::TransformBroadcaster tfBroadcaster_
tf::Transform prevWorldToBase_
void setRPY(const tfScalar &roll, const tfScalar &pitch, const tfScalar &yaw)
void getRPY(tfScalar &roll, tfScalar &pitch, tfScalar &yaw, unsigned int solution_number=1) const
void pose2DToTf(const geometry_msgs::Pose2D &pose, tf::Transform &t)
double PM_TIME_DELAY
half window size which is searched for correct orientation
ros::Publisher posePublisher_
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
void publishTf(const tf::Transform &transform, const ros::Time &time)
std::vector< PM_TYPE > pm_si
tf::TransformListener tfListener_
tf::Transform laserToBase_
const std::string scanTopic_
void scanCallback(const sensor_msgs::LaserScan &scan)
const std::string poseTopic_
bool getParam(const std::string &key, std::string &s) const
int PM_MAX_ITER_ICP
maximum number of iterations for PSM.PSM_C
TFSIMD_FORCE_INLINE const tfScalar & getX() const
void publishPose(const tf::Transform &transform)
double PM_MAX_RANGE
field of view of the laser range finder in degrees
void getCurrentEstimatedPose(tf::Transform &worldToBase, const sensor_msgs::LaserScan &scanMsg)
int PM_MIN_VALID_POINTS
[cm] max valid laser range (set this to about 400 for the Hokuyo URG)
std::vector< PM_TYPE > pm_co
void imuCallback(const sensor_msgs::Imu &imuMsg)
bool initialize(const sensor_msgs::LaserScan &scan)
ros::Subscriber imuSubscriber_
const std::string imuTopic_