vinyx_slam.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <memory>
3 #include <random>
4 
5 #include <ros/ros.h>
6 #include <sensor_msgs/LaserScan.h>
7 #include <nav_msgs/OccupancyGrid.h>
8 
9 #include "../../ros/topic_with_transform.h"
10 #include "../../ros/laser_scan_observer.h"
11 #include "../../ros/init_utils.h"
12 
13 #include "../../core/scan_matchers/monte_carlo_scan_matcher.h"
14 #include "../../core/states/single_state_hypothesis_laser_scan_grid_world.h"
15 
16 #include "../../ros/launch_properties_provider.h"
17 #include "init_vinyx_slam.h"
18 
19 using ObservT = sensor_msgs::LaserScan;
21 
22 // FIXME: viny_slam.cpp code duplication
23 int main(int argc, char** argv) {
24  ros::init(argc, argv, "vinySLAM_plus");
25 
26  auto props = LaunchPropertiesProvider{};
27  auto slam = init_vinyx_slam(props);
28 
29  // connect the slam to a ros-topic based data provider
30  ros::NodeHandle nh;
31  double ros_map_publishing_rate, ros_tf_buffer_size;
32  int ros_filter_queue, ros_subscr_queue;
33  init_constants_for_ros(ros_tf_buffer_size, ros_map_publishing_rate,
34  ros_filter_queue, ros_subscr_queue);
35  auto scan_provider = std::make_unique<TopicWithTransform<ObservT>>(
37  ros_tf_buffer_size, ros_filter_queue, ros_subscr_queue
38  );
39  auto scan_obs = std::make_shared<LaserScanObserver>(
40  slam, get_skip_exceeding_lsr(props), get_use_trig_cache(props));
41  scan_provider->subscribe(scan_obs);
42 
43  auto occup_grid_pub_pin = create_occupancy_grid_publisher<VinySlamXMap>(
44  slam.get(), nh, ros_map_publishing_rate);
45 
46  auto pose_pb_pin = create_pose_correction_tf_publisher<ObservT, VinySlamXMap>(
47  slam.get(), scan_provider.get(), props);
48  auto rp_pb_pin = create_robot_pose_tf_publisher<VinySlamXMap>(slam.get());
49 
50  ros::spin();
51 }
std::string laser_scan_2D_ros_topic_name(const PropertiesProvider &props)
Definition: init_utils.h:25
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool get_use_trig_cache(const PropertiesProvider &props)
Definition: init_utils.h:56
sensor_msgs::LaserScan ObservT
Definition: gmapping.cpp:15
ROSCPP_DECL void spin(Spinner &spinner)
std::string tf_odom_frame_id(const PropertiesProvider &props)
Definition: init_utils.h:29
void init_constants_for_ros(double &ros_tf_buffer_size, double &ros_map_rate, int &ros_filter_queue, int &ros_subscr_queue)
Definition: init_utils.h:138
auto init_vinyx_slam(const PropertiesProvider &props)
bool get_skip_exceeding_lsr(const PropertiesProvider &props)
Definition: init_utils.h:49
int main(int argc, char **argv)
Definition: vinyx_slam.cpp:23
RescalableCachingGridMap< UnboundedLazyTiledGridMap > VinyXMapT
Definition: vinyx_world.h:36


slam_constructor
Author(s): JetBrains Research, OSLL team
autogenerated on Mon Jun 10 2019 15:08:25