int main(int argc, const char** argv) { try { if (argc < 3) { std::cerr << "Usage:\n\t" << argv[0] << " <node-id> <can-iface-name-1> [can-iface-name-N...]" << std::endl; return 1; } const int self_node_id = std::stoi(argv[1]); std::vector<std::string> iface_names; for (int i = 2; i < argc; i++) { iface_names.emplace_back(argv[i]); } uavcan_linux::NodePtr node = initNode(iface_names, self_node_id, "org.uavcan.linux_test_node"); std::cout << "Node initialized successfully" << std::endl; runForever(node); return 0; } catch (const std::exception& ex) { std::cerr << "Exception: " << ex.what() << std::endl; return 1; } }
int main(int argc, const char** argv) { try { auto options = parseOptions(argc, argv); std::cout << "Self node ID: " << int(options.node_id.get()) << "\n" "Num ifaces: " << options.ifaces.size() << "\n" #ifdef NDEBUG "Build mode: Release" #else "Build mode: Debug" #endif << std::endl; auto node = initNode(options.ifaces, options.node_id, "org.uavcan.linux_test_file_server"); runForever(node); return 0; } catch (const std::exception& ex) { std::cerr << "Error: " << ex.what() << std::endl; return 1; } }
int main(int argc, const char** argv) { if (argc < 3) { std::cout << "Usage:\n\t" << argv[0] << " <node-id> <can-iface-name-1> [can-iface-name-N...]" << std::endl; return 1; } const int self_node_id = std::stoi(argv[1]); std::vector<std::string> iface_names(argv + 2, argv + argc); uavcan_linux::NodePtr node = initNode(iface_names, self_node_id, "org.pixhawk.px4esc.uavcan_tool"); runForever(node); return 0; }
int main(int argc, const char** argv) { try { std::srand(std::time(nullptr)); if (isatty(STDOUT_FILENO) != 1) { std::cerr << "This application cannot run if stdout is not associated with a terminal" << std::endl; std::exit(1); } auto options = parseOptions(argc, argv); std::cout << "Self node ID: " << int(options.node_id.get()) << "\n" "Cluster size: " << int(options.cluster_size) << "\n" "Storage path: " << options.storage_path << "\n" "Num ifaces: " << options.ifaces.size() << "\n" #ifdef NDEBUG "Build mode: Release" #else "Build mode: Debug" #endif << std::endl; /* * Preparing the storage directory */ options.storage_path += "/node_" + std::to_string(options.node_id.get()); int system_res = std::system(("mkdir -p '" + options.storage_path + "' &>/dev/null").c_str()); (void)system_res; const auto event_log_file = options.storage_path + "/events.log"; const auto storage_path = options.storage_path + "/storage/"; /* * Starting the node */ auto node = initNode(options.ifaces, options.node_id, "org.uavcan.linux_app.dynamic_node_id_server"); runForever(node, options.cluster_size, event_log_file, storage_path); return 0; } catch (const std::exception& ex) { std::cerr << "Error: " << ex.what() << std::endl; return 1; } }
int main(int argc, const char** argv) { if (argc < 2) { std::cout << "Usage:\n\t" << argv[0] << " <can-iface-name-1> [can-iface-name-N...]" << std::endl; return 1; } std::vector<std::string> iface_names; for (int i = 1; i < argc; i++) { iface_names.emplace_back(argv[i]); } uavcan_linux::NodePtr node = initNodeInPassiveMode(iface_names, "org.uavcan.status_monitor"); runForever(node); return 0; }
int main(int argc, const char** argv) { if (argc < 3) { std::cout << "Usage:\n\t" << argv[0] << " <node-id> <can-iface-name-1> [can-iface-name-N...]" << std::endl; return 1; } const int self_node_id = std::stoi(argv[1]); std::vector<std::string> iface_names; for (int i = 2; i < argc; i++) { iface_names.emplace_back(argv[i]); } uavcan_linux::NodePtr node = initNode(iface_names, self_node_id, "org.uavcan.linux_test_node_status_monitor"); runForever(node); return 0; }
int main(int argc, const char** argv) { try { if (argc < 3) { std::cerr << "Usage:\n\t" << argv[0] << " <node-id> <can-iface-name-1> [can-iface-name-N...]" << std::endl; return 1; } const int self_node_id = std::stoi(argv[1]); const std::vector<std::string> iface_names(argv + 2, argv + argc); uavcan_linux::NodePtr node = initNode(iface_names, self_node_id, "org.uavcan.linux_app.nodetool"); runForever(node); return 0; } catch (const std::exception& ex) { std::cerr << "Error: " << ex.what() << std::endl; return 1; } }
int main(int argc, const char** argv) { try { if (argc < 2) { std::cerr << "Usage:\n\t" << argv[0] << " <can-iface-name-1> [can-iface-name-N...]" << std::endl; return 1; } std::vector<std::string> iface_names; for (int i = 1; i < argc; i++) { iface_names.emplace_back(argv[i]); } uavcan_linux::NodePtr node = initNodeInPassiveMode(iface_names, "org.uavcan.linux_app.node_status_monitor"); runForever(node); return 0; } catch (const std::exception& ex) { std::cerr << "Error: " << ex.what() << std::endl; return 1; } }