Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nebula_hw_interfaces): better UDP socket #231

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
210a89a
feat(udp): a new UDP socket implementation
mojomex Nov 19, 2024
9d8ee7c
chore(udp): more error handling and doc comments
mojomex Nov 19, 2024
49ba10c
chore(udp): always enable socket reuse
mojomex Nov 19, 2024
c2819b9
chore(udp): clean up C-style code
mojomex Nov 19, 2024
dfb64c5
chore(udp): remove unnecessary double parens
mojomex Nov 19, 2024
fb11beb
feat(udp): use poll to prevent blocking when there is no received data
mojomex Nov 19, 2024
56afd43
chore(udp): differentiate between socket and usage-related errors
mojomex Nov 19, 2024
55bed26
feat(udp): allow setting receive buffer size
mojomex Nov 19, 2024
1bb6bc6
chore(udp): use uint8_t because std::byte is annoying to refactor int…
mojomex Nov 19, 2024
9c6522c
fix(udp): update state correctly when `bind()` is called
mojomex Nov 19, 2024
65ef33d
feat(udp): monitor socket packet drops
mojomex Nov 19, 2024
84e5493
feat(udp): add explicit unsubscribe function to facilitate clean shut…
mojomex Nov 19, 2024
8e2f7cd
chore(expected): add stdexcept include
mojomex Nov 22, 2024
78f3641
feat(udp): report when messages have been truncated
mojomex Nov 22, 2024
dabdb09
chore(udp): relax some usage requirements
mojomex Nov 22, 2024
df40395
test(udp): add most of the unit tests for udp socket
mojomex Nov 22, 2024
23311cb
ci(pre-commit): autofix
pre-commit-ci[bot] Nov 22, 2024
95eb54f
chore(cspell): add OVFL to dictionary
mojomex Nov 22, 2024
86961ef
Merge branch 'feat/better-udp-socket' of github.com:tier4/nebula into…
mojomex Nov 22, 2024
205c5dc
fix(udp): return correctly truncated buffer when oversized packet is …
mojomex Nov 22, 2024
9ea3a90
chore(udp): uniform initialization for buffer_size_
mojomex Dec 13, 2024
674b960
chore(udp): disallow re-initializing socket
mojomex Dec 13, 2024
193bf6e
chore(udp): make error value checking consistent (== -1)
mojomex Dec 13, 2024
044208b
chore(udp): add explanatory comment on handling of 0-length datagrams
mojomex Dec 13, 2024
d60855f
chore(udp): disallow binding to broadcast IP
mojomex Dec 13, 2024
237c2b0
chore(udp): bind to host IP instead of INADDR_ANY in non-multicast case
mojomex Dec 13, 2024
11ed243
feat(udp): make polling interval configurable
mojomex Dec 13, 2024
ed904bd
chore(udp): rename ReceiveMetadata to RxMetadata
mojomex Dec 13, 2024
d831f61
chore(udp): parse IP addresses with error checking
mojomex Dec 13, 2024
3124948
test(udp): update and fix tests after changes of recent commits
mojomex Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"nproc",
"nsec",
"ntoa",
"OVFL",
"pandar",
"PANDAR",
"PANDARAT",
Expand Down
1 change: 1 addition & 0 deletions nebula_common/include/nebula_common/util/expected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#pragma once

#include <exception>
#include <stdexcept>
#include <string>
#include <variant>

Expand Down
21 changes: 15 additions & 6 deletions nebula_hw_interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ cmake_minimum_required(VERSION 3.14)
project(nebula_hw_interfaces)

# Default to C++17
if (NOT CMAKE_CXX_STANDARD)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif ()
endif()

if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Wunused-function)
endif ()
endif()

find_package(ament_cmake_auto REQUIRED)
find_package(boost_tcp_driver)
Expand Down Expand Up @@ -53,7 +53,6 @@ target_link_libraries(nebula_hw_interfaces_velodyne PUBLIC
${boost_tcp_driver_LIBRARIES}
${boost_udp_driver_LIBRARIES}
${velodyne_msgs_TARGETS}

)
target_include_directories(nebula_hw_interfaces_velodyne PUBLIC
${boost_udp_driver_INCLUDE_DIRS}
Expand All @@ -68,7 +67,6 @@ target_link_libraries(nebula_hw_interfaces_robosense PUBLIC
${boost_tcp_driver_LIBRARIES}
${boost_udp_driver_LIBRARIES}
${robosense_msgs_TARGETS}

)
target_include_directories(nebula_hw_interfaces_robosense PUBLIC
${boost_udp_driver_INCLUDE_DIRS}
Expand Down Expand Up @@ -100,6 +98,17 @@ install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

find_package(ament_cmake_gtest REQUIRED)

ament_add_gtest(test_udp
test/common/test_udp.cpp
)

target_include_directories(test_udp PUBLIC
${nebula_common_INCLUDE_DIRS}
include
test)
endif()

ament_export_include_directories("include/${PROJECT_NAME}")
Expand Down
Loading
Loading