MCPcopy Create free account
hub / github.com/AutonomousFieldRoboticsLab/SVIn / main

Function main

pose_graph/src/pose_graph_node.cpp:97–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97int main(int argc, char** argv) {
98 rclcpp::init(argc, argv);
99 rclcpp::NodeOptions options;
100 options.allow_undeclared_parameters(true);
101 options.automatically_declare_parameters_from_overrides(true);
102
103 auto node = std::make_shared<rclcpp::Node>("pose_graph_node");
104
105 // Initialize Google's logging library.
106 google::InitGoogleLogging(argv[0]);
107
108 FLAGS_stderrthreshold = 0; // INFO: 0, WARNING: 1, ERROR: 2, FATAL: 3
109 FLAGS_colorlogtostderr = 1;
110
111 // read parameters
112 std::string config_file;
113
114 node->declare_parameter<std::string>("config_file", "");
115 node->get_parameter<std::string>("config_file", config_file);
116
117 if (config_file.empty()) {
118 LOG(ERROR) << "Config file not provided";
119 return EXIT_FAILURE;
120 }
121
122 Parameters params;
123 params.loadParameters(config_file);
124
125 if (params.debug_mode_) {
126 setupOutputLogDirectories(params.debug_output_path_);
127 FLAGS_v = 0;
128 }
129
130 auto subscriber = std::make_unique<Subscriber>(node, params);
131 auto loop_closure = std::make_unique<LoopClosure>(params);
132 auto publisher = std::make_unique<Publisher>(node, params.debug_mode_);
133
134 loop_closure->setKeyframePoseCallback(
135 std::bind(&Publisher::publishKeyframePath, publisher.get(), std::placeholders::_1, std::placeholders::_2));
136 loop_closure->setLoopClosureCallback(
137 std::bind(&Publisher::publishLoopClosurePath, publisher.get(), std::placeholders::_1, std::placeholders::_2));
138
139 if (params.debug_mode_) {
140 loop_closure->setPrimitivePublishCallback(
141 std::bind(&Publisher::publishPrimitiveEstimator, publisher.get(), std::placeholders::_1));
142 }
143
144 subscriber->registerKeyframeCallback(
145 std::bind(&LoopClosure::fillKeyframeTrackingQueue, loop_closure.get(), std::placeholders::_1));
146
147 if (params.health_params_.enabled) {
148 subscriber->registerPrimitiveEstimatorCallback(
149 std::bind(&LoopClosure::fillPrimitiveEstimatorBuffer, loop_closure.get(), std::placeholders::_1));
150 }
151
152 rclcpp::TimerBase::SharedPtr timer;
153 rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr pointcloud_service;
154 rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr save_trajectory_service;

Callers

nothing calls this directly

Calls 15

loadParametersMethod · 0.80
getMethod · 0.80
saveTrajectoryMethod · 0.80
whatMethod · 0.80
getKeyframesDumpMethod · 0.80
saveKeyframesMethod · 0.80

Tested by

no test coverage detected