localize.hh
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2010
4  * Alejandro R. Mosteo
5  *
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef LOCALIZE_HH_
23 #define LOCALIZE_HH_
24 
25 #include "robot_location.hh"
26 #include "scan.hh"
27 #include "segment_map.hh"
28 
29 class Localize
30 {
31 public:
33  Localize(double laser_max_range,
34  double laser_pose_x,
35  double laser_pose_y,
36  double laser_pose_angle,
37  double laser_noise_range, // uncertainty in distance measured (2sigma)
38  double laser_noise_bearing, // uncertainty in sample bearing (2sigma)
39  double odom_noise_x,
40  double odom_noise_y,
41  double odom_noise_angle // uncertainty for odometry model
42  );
43 
45  void SetRobotPose(double x, double y, double angle);
47  void SetPoses(double ox, double oy, double oth,
48  double gx, double gy, double gth);
50  void SetRobotPoseError(double ex, double ey, double eth);
51 
54  void SetLaserPose(double x, double y, double a);
55 
56  void LoadMap(const char* filename);
57  void SetMap(const SegmentsVector& map);
58  void AddSegment(const Segment& segment);
59  const SegmentMap &Map(void) const;
60 
63  bool Update(double robot_x, double robot_y, double robot_angle,
64  DoublesVector ranges, DoublesVector bearings);
65 
66  Pose pose(void) const;
67  MatrixXd GetCovariance(void) const { return robot_.Covariance(); };
68 private:
69  Scan scan_;
70  RobotLocation robot_;
71  bool has_pose_;
72 };
73 
74 #endif /* LOCALIZE_HH_ */
void SetLaserPose(double x, double y, double a)
Update laser pose (limited to x, y ,a for now, though) m m rad.
Definition: localize.cc:44
Definition: robot_location.hh:31
void SetPoses(double ox, double oy, double oth, double gx, double gy, double gth)
Initialize both odometry (if it is not zero) and global (map) pose.
Definition: localize.cc:54
Localize(double laser_max_range, double laser_pose_x, double laser_pose_y, double laser_pose_angle, double laser_noise_range, double laser_noise_bearing, double odom_noise_x, double odom_noise_y, double odom_noise_angle)
Initialize parameters.
Definition: localize.cc:26
Definition: gridmap.h:111
Definition: localize.hh:29
Definition: types.hh:29
bool Update(double robot_x, double robot_y, double robot_angle, DoublesVector ranges, DoublesVector bearings)
Compute actualization from robot accumulated odometry and laser reading Returns true if the update wa...
Definition: localize.cc:93
Definition: types.hh:42
void SetRobotPose(double x, double y, double angle)
Initialize robot map pose, and reset odometry to zero.
Definition: localize.cc:49
Definition: segment_map.hh:29
Definition: scan.hh:30
void SetRobotPoseError(double ex, double ey, double eth)
Initial pose error.
Definition: localize.cc:61