12 #include <sensor_msgs/LaserScan.h> 15 #include <nav_msgs/OccupancyGrid.h> 19 #include "../core/sensor_data.h" 20 #include "../ros/topic_with_transform.h" 21 #include "../ros/rviz_grid_viewer.h" 22 #include "../ros/utils.h" 23 #include "../core/maps/area_occupancy_estimator.h" 24 #include "../core/maps/const_occupancy_estimator.h" 25 #include "../core/maps/grid_cell_strategy.h" 44 double score)
override {
53 double score)
override {
70 std::string cell_type;
71 ros::param::param<std::string>(
"~cell_type", cell_type,
"avg");
73 if (cell_type ==
"base") {
77 }
else if (cell_type ==
"avg") {
82 std::cerr <<
"Unknown cell type: " << cell_type << std::endl;
93 double occ_prob, empty_prob;
94 ros::param::param<double>(
"~base_occupied_prob", occ_prob, 0.95);
95 ros::param::param<double>(
"~base_empty_prob", empty_prob, 0.01);
97 using OccEstPtr = std::shared_ptr<CellOccupancyEstimator>;
99 ros::param::param<std::string>(
"~occupancy_estimator", est_type,
"const");
101 if (est_type ==
"const") {
103 }
else if (est_type ==
"area") {
106 std::cerr <<
"Unknown estimator type: " << est_type << std::endl;
117 ros::param::param<bool>(
"~skip_exceeding_lsr_vals", param_value,
false);
126 double sig_XY, sig_T, width;
127 int lim_bad, lim_totl;
128 ros::param::param<double>(
"~scmtch_sigma_XY_MonteCarlo", sig_XY, 0.2);
129 ros::param::param<double>(
"~scmtch_sigma_theta_MonteCarlo", sig_T, 0.1);
130 ros::param::param<int>(
"~scmtch_limit_of_bad_attempts", lim_bad, 20);
131 ros::param::param<int>(
"~scmtch_limit_of_total_attempts", lim_totl, 100);
132 ros::param::param<double>(
"~hole_width", width,1.5);
143 ros::param::param<double>(
"~map_height_in_meters", params.
height, 20);
144 ros::param::param<double>(
"~map_width_in_meters", params.
width, 20);
145 ros::param::param<double>(
"~map_meters_per_cell", params.
meters_per_cell,
155 double &ros_map_rate,
156 int &ros_filter_queue,
157 int &ros_subscr_queue) {
158 ros::param::param<double>(
"~ros_tf_buffer_duration",ros_tf_buffer_size,5.0);
159 ros::param::param<double>(
"~ros_rviz_map_publishing_rate", ros_map_rate, 5.0);
160 ros::param::param<int>(
"~ros_filter_queue_size",ros_filter_queue,1000);
161 ros::param::param<int>(
"~ros_subscribers_queue_size",ros_subscr_queue,1000);
165 ros::param::param<std::string>(
"~odom", frame_odom,
"odom_combined");
166 ros::param::param<std::string>(
"~robot_pose", frame_robot_pose,
"robot_pose");
172 int main(
int argc,
char** argv) {
184 double ros_map_publishing_rate, ros_tf_buffer_size;
185 int ros_filter_queue, ros_subscr_queue;
186 std::string frame_odom, frame_robot_pose;
188 ros_filter_queue, ros_subscr_queue);
191 "laser_scan", frame_odom, ros_tf_buffer_size,
192 ros_filter_queue, ros_subscr_queue);
195 std::shared_ptr<RvizGridViewer> viewer(
197 ros_map_publishing_rate, frame_odom, frame_robot_pose));
198 slam->set_viewer(viewer);
202 slam->add_scan_matcher_observer(obs);
The class publishes information about robot's map and location in ROS-compatible format so it can be ...
An implementation of the scan cost function described in the original tinySLAM paper.
Definition of classes file: BaseTinyCell, AvgTinyCell (are inherited from GidCell), TinyBaseCellFactory, TinyAvgCellFactory (from GridCellFactory)
double localized_scan_quality
A strategy creates cells of the base tiny model (BaseTinyCell).
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Derived class from GridScanMatcherObserver to publish the robot pose.
TinyWorldParams init_common_world_params()
void init_frame_names(std::string &frame_odom, std::string &frame_robot_pose)
void init_constants_for_ros(double &ros_tf_buffer_size, double &ros_map_rate, int &ros_filter_queue, int &ros_subscr_queue)
int main(int argc, char **argv)
A container for the following tinySLAM parameters: TODO: params description.
ROSCPP_DECL void spin(Spinner &spinner)
double theta
The position of robot.
ConstEstimator is responsible for the occupancy estimation strategy that returns probability of being...
A strategy creates cells with the average probability calculation rule (AvgTinyCell).
Interface of scan matcher observer.
Defines a robot position in cartesian coordinates and an angle of rotation.
void publish_2D_transform(const std::string &target_frame, const std::string &base_frame, double x, double y, double th)
Converts internal a robot state to a 2D robot pose and publishes it.
A strategy that estimates a grid cell's occupancy based on how a laser beam passes through the cell...
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
std::shared_ptr< CellOccupancyEstimator > init_occ_estimator()
void publish_transform(const std::string &frame_id, std::string frame_odom, const RobotState &p)
A container for strategies specific to a grid cell model.
virtual void on_scan_test(const RobotState &pose, const TransformedLaserScan &scan, double score) override
bool init_skip_exceeding_lsr()
GridMapParams init_grid_map_params()
The TinySLAM access point. SLAM users are supposed to work with it.
std::shared_ptr< GridCellFactory > init_cell_factory(TinyWorldParams ¶ms)
virtual void on_pose_update(const RobotState &pose, const TransformedLaserScan &scan, double score) override