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

Function main

okvis_ros/src/dataset_convertor.cpp:346–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346int main(int argc, char** argv) {
347 cout << colouredString("Initializing ROS node:", RED, BOLD) << endl;
348
349 ros::init(argc, argv, "dataset_converter");
350
351 ros::NodeHandle nh;
352
353 cout << colouredString("DONE!", GREEN, BOLD) << endl;
354
355 cout << colouredString("Initializing sensor information:", RED, BOLD) << endl;
356
357 map<string, map<string, string>> topic2info_map = sensorInfo(nh);
358
359 cout << colouredString("DONE!", GREEN, BOLD) << endl;
360
361 cout << colouredString("Creating folders:", RED, BOLD) << endl;
362
363 string path(argv[1]);
364 size_t pos = path.find_last_of("/");
365 size_t pos_dot = path.find_last_of(".");
366
367 string bagname;
368 string bagpath;
369 if (pos == string::npos) {
370 cout << colouredString(
371 "Relative path are not supported. Use an absolute path instead."
372 "For example: roslaunch okvis_ros convert_datasert.launch bag:= /absolute/path/here",
373 RED,
374 BOLD)
375 << endl;
376 exit(EXIT_FAILURE);
377 } else {
378 bagname = path.substr(pos + 1, pos_dot - pos - 1);
379 bagpath = path.substr(0, pos + 1);
380 }
381
382 if (!createDirs(bagpath + bagname, topic2info_map)) {
383 cout << colouredString("FAILED!", RED, BACKGROUND);
384 exit(EXIT_FAILURE);
385 } else {
386 cout << colouredString("DONE!", GREEN, BOLD) << endl;
387 }
388 cout << colouredString("Reading bag:", RED, BOLD) << endl;
389
390 rosbag::Bag bag;
391 cout << colouredString("\tOpening bag...", RED, REGULAR);
392 bag.open(argv[1], rosbag::bagmode::Read);
393 cout << colouredString("\t[DONE!]", GREEN, REGULAR) << endl;
394
395 cout << colouredString("\tQuering topics bag...", RED, REGULAR);
396
397 vector<string> topic_list;
398
399 rosbag::View view(bag);
400
401 vector<const rosbag::ConnectionInfo*> bag_info = view.getConnections();
402 std::set<string> bag_topics;
403

Callers

nothing calls this directly

Calls 11

colouredStringFunction · 0.85
sensorInfoFunction · 0.85
createDirsFunction · 0.85
isTopicInMapFunction · 0.85
openFileStreamsFunction · 0.85
findTopicInMapFunction · 0.85
writeCSVCameraFunction · 0.85
writeCSVImuFunction · 0.85
writeCSVViconFunction · 0.85
sizeMethod · 0.45
toNSecMethod · 0.45

Tested by

no test coverage detected