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/tcp unit tests struct data validationtest(hesai): test interface field value #246

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c97d35e
feat(loggers): add a new generic dependency-injectable logger class
mojomex Nov 22, 2024
4d21fe0
feat(loggers): add a console logger implementation
mojomex Nov 22, 2024
c6fcf9b
feat(loggers): add an rclcpp logger implementation
mojomex Nov 22, 2024
3c08c51
chore(hesai_hw_interfaces): switch to the new loggers::Logger class, …
mojomex Nov 22, 2024
c59c9bd
feat(udp): a new UDP socket implementation
mojomex Nov 19, 2024
31cf927
chore(udp): more error handling and doc comments
mojomex Nov 19, 2024
7b01925
chore(udp): always enable socket reuse
mojomex Nov 19, 2024
2b10e16
chore(udp): clean up C-style code
mojomex Nov 19, 2024
8e61872
chore(udp): remove unnecessary double parens
mojomex Nov 19, 2024
5e01ad5
feat(udp): use poll to prevent blocking when there is no received data
mojomex Nov 19, 2024
ad11905
chore(udp): differentiate between socket and usage-related errors
mojomex Nov 19, 2024
a8d9f22
feat(udp): allow setting receive buffer size
mojomex Nov 19, 2024
72033a7
chore(udp): use uint8_t because std::byte is annoying to refactor int…
mojomex Nov 19, 2024
05bbcbb
fix(udp): update state correctly when `bind()` is called
mojomex Nov 19, 2024
cd79905
feat(udp): monitor socket packet drops
mojomex Nov 19, 2024
7431a01
feat(udp): add explicit unsubscribe function to facilitate clean shut…
mojomex Nov 19, 2024
115e31a
chore(expected): add stdexcept include
mojomex Nov 22, 2024
a506366
feat(udp): report when messages have been truncated
mojomex Nov 22, 2024
7d2ddca
chore(udp): relax some usage requirements
mojomex Nov 22, 2024
390930d
test(udp): add most of the unit tests for udp socket
mojomex Nov 22, 2024
cda257e
chore(cspell): add OVFL to dictionary
mojomex Nov 22, 2024
95b8b77
ci(pre-commit): autofix
pre-commit-ci[bot] Nov 22, 2024
e2b51eb
fix(udp): return correctly truncated buffer when oversized packet is …
mojomex Nov 22, 2024
7b55ecd
feat(hesai): add an easier-to-use TCP socket implementation (still us…
mojomex Nov 22, 2024
585f93b
chore(hesai): use new TCP implementation and dependency-inject concre…
mojomex Nov 22, 2024
81ad961
test(hesai): add basic tests for Hesai's PTC protocol
mojomex Nov 22, 2024
e35b856
WIP
mojomex Nov 25, 2024
2f6e8cd
WIP
mojomex Nov 27, 2024
8f02df4
Merge branch 'main' into feat/tcp-unit-tests
mojomex Nov 27, 2024
f436ae4
test(hesai): fix hex parsing
mojomex Nov 27, 2024
d2db773
test(hesai): remove unrecorded commands from test suite
mojomex Nov 27, 2024
6fe68f5
add hesai_tcp struct contents check function
ike-kazu Dec 9, 2024
26680fb
fix hesai_tcp struct contents check function
ike-kazu Dec 9, 2024
71dea6b
fix hesai_tcp struct contents check function
ike-kazu Dec 13, 2024
a7bcc1d
fix comment
ike-kazu Dec 13, 2024
355e7f8
fix hesai_tcp struct contents check function
ike-kazu Dec 13, 2024
b3e3283
del japanese comment
ike-kazu 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
43 changes: 37 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,39 @@ 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)
find_package(ament_cmake_gmock REQUIRED)
find_package(nlohmann_json)

add_definitions(-D_TEST_RESOURCES_PATH="${PROJECT_SOURCE_DIR}/test_resources/")

ament_add_gtest(test_udp
test/common/test_udp.cpp
)

target_include_directories(test_udp PUBLIC
${nebula_common_INCLUDE_DIRS}
include
test)

ament_add_gmock(hesai_test_ptc
test/hesai/test_ptc.cpp
)

target_include_directories(hesai_test_ptc PUBLIC
${nebula_common_INCLUDE_DIRS}
${nebula_hw_interfaces_hesai_INCLUDE_DIRS}
${boost_tcp_driver_INCLUDE_DIRS}
${boost_udp_driver_INCLUDE_DIRS}
${nlohmann_json_INCLUDE_DIRS}
include
test)

target_link_libraries(hesai_test_ptc
${nlohmann_json_LIBRARIES}
nebula_hw_interfaces_hesai
)
endif()

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