From cc7df79e28c21efa8f0e1af95cd583f17e72cff3 Mon Sep 17 00:00:00 2001 From: Yu Asabe Date: Wed, 8 Dec 2021 20:32:39 +0900 Subject: [PATCH 1/3] Add network_interface parameter --- launch/v2x.launch.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/launch/v2x.launch.xml b/launch/v2x.launch.xml index 07a5bcc..f306eb4 100644 --- a/launch/v2x.launch.xml +++ b/launch/v2x.launch.xml @@ -1,3 +1,5 @@ - + + + \ No newline at end of file From b8b38afdae135c49c28b5c31f9d143fccad4d699 Mon Sep 17 00:00:00 2001 From: Yu Asabe Date: Wed, 8 Dec 2021 20:32:54 +0900 Subject: [PATCH 2/3] Use network_interface parameter in v2x_app --- src/v2x_app.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/v2x_app.cpp b/src/v2x_app.cpp index 404b554..8491160 100644 --- a/src/v2x_app.cpp +++ b/src/v2x_app.cpp @@ -106,8 +106,11 @@ namespace v2x boost::asio::io_service io_service; TimeTrigger trigger(io_service); - const char* device_name = "vmnet1"; - EthernetDevice device(device_name); + std::string network_interface; + node_->get_parameter("network_interface", network_interface); + RCLCPP_INFO(node_->get_logger(), "Network Interface: %s", network_interface.c_str()); + + EthernetDevice device(network_interface.c_str()); vanetza::MacAddress mac_address = device.address(); std::stringstream sout; From ac296d2dc9a31820913229caff148feb8eb3cb7e Mon Sep 17 00:00:00 2001 From: Yu Asabe Date: Wed, 8 Dec 2021 20:33:06 +0900 Subject: [PATCH 3/3] declare_parameter in v2x_node --- src/v2x_node.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/v2x_node.cpp b/src/v2x_node.cpp index 59254a9..e44aed2 100644 --- a/src/v2x_node.cpp +++ b/src/v2x_node.cpp @@ -34,6 +34,8 @@ namespace v2x publisher_ = create_publisher("/perception/object_recognition/objects", rclcpp::QoS{10}); + this->declare_parameter("network_interface", "vmnet1"); + app = new V2XApp(this); boost::thread v2xApp(boost::bind(&V2XApp::start, app));