14 const std::string& name)
18 node->setName(name.c_str());
22 node->setModeOperational();
36 bool i_am_master =
false;
37 if (tsslave.isActive())
41 if (node->getNodeID() < master_node)
43 std::cout <<
"Overriding the lower priority master " <<
int(master_node.
get()) << std::endl;
48 std::cout <<
"There is other master of higher priority " <<
int(master_node.
get()) << std::endl;
53 std::cout <<
"No other masters present" << std::endl;
58 tsslave.suppress(i_am_master);
73 node->logError(
"spin",
"Error %*", res);
78 int main(
int argc,
const char** argv)
84 std::cerr <<
"Usage:\n\t" << argv[0] <<
" <node-id> <can-iface-name-1> [can-iface-name-N...]" << std::endl;
87 const int self_node_id = std::stoi(argv[1]);
88 std::vector<std::string> iface_names;
89 for (
int i = 2; i < argc; i++)
91 iface_names.emplace_back(argv[i]);
97 catch (
const std::exception& ex)
99 std::cerr <<
"Exception: " << ex.what() << std::endl;
static MonotonicDuration getInfinite()
std::shared_ptr< Node > NodePtr
static void runForever(const uavcan_linux::NodePtr &node)
int init(const TransferPriority priority=TransferPriority::OneLowerThanHighest)
static uavcan_linux::NodePtr initNode(const std::vector< std::string > &ifaces, uavcan::NodeID nid, const std::string &name)
int main(int argc, const char **argv)
static NodePtr makeNode(const std::vector< std::string > &iface_names, ClockAdjustmentMode clock_adjustment_mode=SystemClock::detectPreferredClockAdjustmentMode())
static MonotonicDuration fromMSec(int64_t ms)