MCPcopy Create free account
hub / github.com/ROBOTIS-GIT/turtlebot3 / main

Function main

turtlebot3_node/src/node_main.cpp:37–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37int main(int argc, char * argv[])
38{
39 setvbuf(stdout, NULL, _IONBF, BUFSIZ);
40
41 if (rcutils_cli_option_exist(argv, argv + argc, "-h")) {
42 help_print();
43 return 0;
44 }
45
46 rclcpp::init(argc, argv);
47
48 std::string usb_port = "/dev/ttyACM0";
49 char * cli_options;
50 cli_options = rcutils_cli_get_option(argv, argv + argc, "-i");
51 if (nullptr != cli_options) {
52 usb_port = std::string(cli_options);
53 }
54
55 rclcpp::executors::SingleThreadedExecutor executor;
56
57 auto turtlebot3 = std::make_shared<robotis::turtlebot3::TurtleBot3>(usb_port);
58 auto diff_drive_controller =
59 std::make_shared<robotis::turtlebot3::DiffDriveController>(
60 turtlebot3->get_wheels()->separation,
61 turtlebot3->get_wheels()->radius);
62
63 executor.add_node(turtlebot3);
64 executor.add_node(diff_drive_controller);
65 executor.spin();
66
67 rclcpp::shutdown();
68
69 return 0;
70}

Callers

nothing calls this directly

Calls 2

help_printFunction · 0.85
get_wheelsMethod · 0.80

Tested by

no test coverage detected