Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ jobs:
include:
- ros: humble
ubuntu: jammy
# TODO(Zeerek): Enable once socketcan adapter supports them
# - ros: jazzy
# ubuntu: noble
# - ros: rolling
# ubuntu: noble
- ros: jazzy
ubuntu: noble
- ros: kilted
ubuntu: noble
- ros: rolling
ubuntu: noble
name: ROS 2 ${{ matrix.ros }}
container:
image: ghcr.io/ros-tooling/setup-ros-docker/setup-ros-docker-ubuntu-${{ matrix.ubuntu }}:latest
Expand Down
51 changes: 40 additions & 11 deletions mvec/mvec_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_link_options("-Wl,--no-undefined")
endif()

find_package(ament_cmake REQUIRED)
find_package(socketcan_adapter REQUIRED)

# socketcan adapter's improperly configured dependencies
# TODO (Zeerek): Remove when socketcan adapter's dependencies are cleaned up
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()

add_library(
${PROJECT_NAME} SHARED
Expand Down Expand Up @@ -79,32 +76,56 @@ ament_export_dependencies(
)

if(BUILD_TESTING)
find_package(Catch2 2 REQUIRED)
include(Catch)
ament_auto_find_test_dependencies()
find_package(Catch2 REQUIRED)

add_executable(relay_tests
test/mvec_relay.cpp
)
target_link_libraries(relay_tests
PRIVATE ${PROJECT_NAME} Catch2::Catch2WithMain
)
catch_discover_tests(relay_tests)
ament_add_test(
relay_tests
GENERATE_RESULT_FOR_RETURN_CODE_ZERO
COMMAND "$<TARGET_FILE:relay_tests>"
-r junit -s
-o test_results/${PROJECT_NAME}/relay_tests_output.xml
ENV CATCH_CONFIG_CONSOLE_WIDTH=120
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)

add_executable(status_messages_tests
test/status_messages.cpp
)
target_link_libraries(status_messages_tests
PRIVATE ${PROJECT_NAME} Catch2::Catch2WithMain
)
catch_discover_tests(status_messages_tests)
ament_add_test(
status_messages_tests
GENERATE_RESULT_FOR_RETURN_CODE_ZERO
COMMAND "$<TARGET_FILE:status_messages_tests>"
-r junit -s
-o test_results/${PROJECT_NAME}/status_messages_tests_output.xml
ENV CATCH_CONFIG_CONSOLE_WIDTH=120
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)

add_executable(status_enums_tests
test/status_enums.cpp
)
target_link_libraries(status_enums_tests
PRIVATE ${PROJECT_NAME} Catch2::Catch2WithMain
)
catch_discover_tests(status_enums_tests)
ament_add_test(
status_enums_tests
GENERATE_RESULT_FOR_RETURN_CODE_ZERO
COMMAND "$<TARGET_FILE:status_enums_tests>"
-r junit -s
-o test_results/${PROJECT_NAME}/status_enums_tests_output.xml
ENV CATCH_CONFIG_CONSOLE_WIDTH=120
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)

# Only build hardware tests if CAN_AVAILABLE is set in the environment
if(DEFINED ENV{CAN_AVAILABLE})
Expand All @@ -114,7 +135,15 @@ if(BUILD_TESTING)
target_link_libraries(socketcan_hardware_tests
PRIVATE ${PROJECT_NAME} Catch2::Catch2WithMain
)
catch_discover_tests(socketcan_hardware_tests)
ament_add_test(
socketcan_hardware_tests
GENERATE_RESULT_FOR_RETURN_CODE_ZERO
COMMAND "$<TARGET_FILE:socketcan_hardware_tests>"
-r junit -s
-o test_results/${PROJECT_NAME}/socketcan_hardware_tests_output.xml
ENV CATCH_CONFIG_CONSOLE_WIDTH=120
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
message(STATUS "CAN_AVAILABLE set - including hardware tests")
else()
message(STATUS "CAN_AVAILABLE not set - skipping hardware tests (set CAN_AVAILABLE=1 to enable)")
Expand Down
3 changes: 3 additions & 0 deletions mvec/mvec_lib/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
<license>Apache-2.0</license>
<author email="zeerekahmad@hotmail.com">Zeerek Ahmad</author>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_auto</buildtool_depend>
<depend>socketcan_adapter</depend>

<test_depend>ament_cmake_test</test_depend>
<test_depend>catch2</test_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down
8 changes: 7 additions & 1 deletion mvec/mvec_lib/test/mvec_relay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
#include <memory>
#include <vector>

#include <catch2/catch.hpp>
#if __has_include(<catch2/catch_all.hpp>)
#include <catch2/catch_all.hpp>
#elif __has_include(<catch2/catch.hpp>)
#include <catch2/catch.hpp>
#else
#error "Catch2 headers not found. Please install Catch2 (v2 or v3)."
#endif

#include "mvec_lib/core/mvec_constants.hpp"
#include "socketcan_adapter/can_frame.hpp"
Expand Down
8 changes: 7 additions & 1 deletion mvec/mvec_lib/test/mvec_socketcan_hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@
#include <memory>
#include <thread>

#include <catch2/catch.hpp>
#if __has_include(<catch2/catch_all.hpp>)
#include <catch2/catch_all.hpp>
#elif __has_include(<catch2/catch.hpp>)
#include <catch2/catch.hpp>
#else
#error "Catch2 headers not found. Please install Catch2 (v2 or v3)."
#endif

#include "mvec_lib/mvec_relay_socketcan.hpp"
#include "socketcan_adapter/socketcan_adapter.hpp"
Expand Down
8 changes: 7 additions & 1 deletion mvec/mvec_lib/test/status_enums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@

#include <vector>

#include <catch2/catch.hpp>
#if __has_include(<catch2/catch_all.hpp>)
#include <catch2/catch_all.hpp>
#elif __has_include(<catch2/catch.hpp>)
#include <catch2/catch.hpp>
#else
#error "Catch2 headers not found. Please install Catch2 (v2 or v3)."
#endif

#include "mvec_lib/core/mvec_constants.hpp"
#include "mvec_lib/status_messages/mvec_error_status_message.hpp"
Expand Down
8 changes: 7 additions & 1 deletion mvec/mvec_lib/test/status_messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@

#include <vector>

#include <catch2/catch.hpp>
#if __has_include(<catch2/catch_all.hpp>)
#include <catch2/catch_all.hpp>
#elif __has_include(<catch2/catch.hpp>)
#include <catch2/catch.hpp>
#else
#error "Catch2 headers not found. Please install Catch2 (v2 or v3)."
#endif

#include "mvec_lib/core/mvec_constants.hpp"
#include "mvec_lib/status_messages/mvec_error_status_message.hpp"
Expand Down
6 changes: 2 additions & 4 deletions mvec/mvec_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
cmake_minimum_required(VERSION 3.8)
project(mvec_msgs)

find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(std_msgs REQUIRED)
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()

set(msg_files
"msg/Relay.msg"
Expand Down
3 changes: 3 additions & 0 deletions mvec/mvec_msgs/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
<license>Apache-2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_auto</buildtool_depend>

<depend>rosidl_default_generators</depend>
<depend>builtin_interfaces</depend>
<depend>std_msgs</depend>

<member_of_group>rosidl_interface_packages</member_of_group>

Expand Down
8 changes: 7 additions & 1 deletion mvec/mvec_ros2/src/mvec_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
#include <utility>
#include <vector>

#include <magic_enum.hpp>
#if __has_include(<magic_enum/magic_enum.hpp>)
#include <magic_enum/magic_enum.hpp>
#elif __has_include(<magic_enum.hpp>)
#include <magic_enum.hpp>
#else
#error "magic_enum headers not found. Please install magic_enum."
#endif

#include "mvec_lib/core/mvec_constants.hpp"

Expand Down
45 changes: 34 additions & 11 deletions sygnal_can_interface/sygnal_can_interface_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_link_options("-Wl,--no-undefined")
endif()

find_package(ament_cmake REQUIRED)
find_package(socketcan_adapter REQUIRED)
find_package(sygnal_dbc REQUIRED)
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()

add_library(
${PROJECT_NAME} SHARED
Expand All @@ -42,11 +41,11 @@ target_include_directories(${PROJECT_NAME} PUBLIC
)

target_link_libraries(${PROJECT_NAME}
PUBLIC socketcan_adapter::socketcan_adapter
PUBLIC
socketcan_adapter::socketcan_adapter
sygnal_dbc::sygnal_dbc
)

ament_target_dependencies(${PROJECT_NAME} PUBLIC sygnal_dbc)

install(
DIRECTORY include/
DESTINATION include
Expand Down Expand Up @@ -74,24 +73,40 @@ ament_export_dependencies(
)

if(BUILD_TESTING)
find_package(Catch2 2 REQUIRED)
include(Catch)
ament_auto_find_test_dependencies()
find_package(Catch2 REQUIRED)

add_executable(sygnal_mcm_interface_tests
test/sygnal_mcm_interface_test.cpp
)
target_link_libraries(sygnal_mcm_interface_tests
PRIVATE ${PROJECT_NAME} Catch2::Catch2WithMain
)
catch_discover_tests(sygnal_mcm_interface_tests)
ament_add_test(
sygnal_mcm_interface_tests
GENERATE_RESULT_FOR_RETURN_CODE_ZERO
COMMAND "$<TARGET_FILE:sygnal_mcm_interface_tests>"
-r junit -s
-o test_results/${PROJECT_NAME}/sygnal_mcm_interface_tests_output.xml
ENV CATCH_CONFIG_CONSOLE_WIDTH=120
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)

add_executable(sygnal_command_interface_tests
test/sygnal_command_interface_test.cpp
)
target_link_libraries(sygnal_command_interface_tests
PRIVATE ${PROJECT_NAME} Catch2::Catch2WithMain
)
catch_discover_tests(sygnal_command_interface_tests)
ament_add_test(
sygnal_command_interface_tests
GENERATE_RESULT_FOR_RETURN_CODE_ZERO
COMMAND "$<TARGET_FILE:sygnal_command_interface_tests>"
-r junit -s
-o test_results/${PROJECT_NAME}/sygnal_command_interface_tests_output.xml
ENV CATCH_CONFIG_CONSOLE_WIDTH=120
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)

if(DEFINED ENV{CAN_AVAILABLE})
add_executable(sygnal_interface_socketcan_tests
Expand All @@ -100,7 +115,15 @@ if(BUILD_TESTING)
target_link_libraries(sygnal_interface_socketcan_tests
PRIVATE ${PROJECT_NAME} Catch2::Catch2WithMain
)
catch_discover_tests(sygnal_interface_socketcan_tests)
ament_add_test(
sygnal_interface_socketcan_tests
GENERATE_RESULT_FOR_RETURN_CODE_ZERO
COMMAND "$<TARGET_FILE:sygnal_interface_socketcan_tests>"
-r junit -s
-o test_results/${PROJECT_NAME}/sygnal_interface_socketcan_tests_output.xml
ENV CATCH_CONFIG_CONSOLE_WIDTH=120
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
message(STATUS "CAN_AVAILABLE set - including hardware tests")
endif()
endif()
Expand Down
3 changes: 3 additions & 0 deletions sygnal_can_interface/sygnal_can_interface_lib/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
<author email="zeerekahmad@hotmail.com">Zeerek Ahmad</author>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_auto</buildtool_depend>
<depend>socketcan_adapter</depend>
<depend>sygnal_dbc</depend>

<test_depend>catch2</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ SendCommandResult SygnalInterfaceSocketcan::sendControlStateCommand(
return {false, std::nullopt};
}

auto data = frame_opt->get_data();
Comment thread
davidt315 marked this conversation as resolved.

std::optional<std::future<SygnalControlCommandResponse>> future_opt;
if (expect_reply) {
std::promise<SygnalControlCommandResponse> promise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
#include <string>
#include <vector>

#include <catch2/catch.hpp>
#if __has_include(<catch2/catch_all.hpp>)
#include <catch2/catch_all.hpp>
#elif __has_include(<catch2/catch.hpp>)
#include <catch2/catch.hpp>
#else
#error "Catch2 headers not found. Please install Catch2 (v2 or v3)."
#endif

#include "socketcan_adapter/can_frame.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@

#if __has_include(<catch2/catch_all.hpp>)
#include <catch2/catch_all.hpp>
#else
#include <catch2/catch_approx.hpp>
using Catch::Approx;
#elif __has_include(<catch2/catch.hpp>)
#include <catch2/catch.hpp>
#else
#error "Catch2 headers not found. Please install Catch2 (v2 or v3)."
#endif

#include <algorithm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
#include <string>
#include <vector>

#include <catch2/catch.hpp>
#if __has_include(<catch2/catch_all.hpp>)
#include <catch2/catch_all.hpp>
#elif __has_include(<catch2/catch.hpp>)
#include <catch2/catch.hpp>
#else
#error "Catch2 headers not found. Please install Catch2 (v2 or v3)."
#endif

#include "socketcan_adapter/can_frame.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@
#include <string>
#include <utility>

#include <magic_enum.hpp>
#if __has_include(<magic_enum/magic_enum.hpp>)
#include <magic_enum/magic_enum.hpp>
#elif __has_include(<magic_enum.hpp>)
#include <magic_enum.hpp>
#else
#error "magic_enum headers not found. Please install magic_enum."
#endif

#include "sygnal_can_interface_lib/sygnal_command_interface.hpp"
#include "sygnal_can_interface_lib/sygnal_mcm_interface.hpp"
Expand Down
Loading