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

port socketcan_interface to ROS2 #364

Draft
wants to merge 8 commits into
base: dashing-devel
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ env:
global:
- CCACHE_DIR=$HOME/.ccache
matrix:
- ROS_DISTRO="crystal" ROS_REPO=testing
- ROS_DISTRO="crystal" ROS_REPO=main
- ROS_DISTRO="crystal" ROS_REPO=testing UPSTREAM_WORKSPACE="github:ament/ament_lint#dashing"
- ROS_DISTRO="crystal" ROS_REPO=main UPSTREAM_WORKSPACE="github:ament/ament_lint#dashing"
- ROS_DISTRO="dashing" ROS_REPO=testing
- ROS_DISTRO="dashing" ROS_REPO=main
- ROS_DISTRO="eloquent" ROS_REPO=testing
Expand Down
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU LESSER GENERAL PUBLIC LICENSE
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -162,4 +162,4 @@ General Public License ever published by the Free Software Foundation.
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
Library.
1 change: 0 additions & 1 deletion canopen_master/include/canopen_master/canopen.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ class Node : public Layer{
bool prepare();

using StateFunc = std::function<void(const State&)>;
using StateDelegate [[deprecated("use StateFunc instead")]] = can::DelegateHelper<StateFunc>;

typedef can::Listener<const StateFunc, const State&> StateListener;
typedef StateListener::ListenerConstSharedPtr StateListenerConstSharedPtr;
Expand Down
5 changes: 0 additions & 5 deletions canopen_master/include/canopen_master/objdict.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ class ObjectDict{
typedef ObjectDict::ObjectDictSharedPtr ObjectDictSharedPtr;
typedef std::shared_ptr<const ObjectDict> ObjectDictConstSharedPtr;

[[deprecated]]
std::size_t hash_value(ObjectDict::Key const& k);

template<typename T> class NodeIdOffset{
T offset;
T (*adder)(const uint8_t &, const T &);
Expand Down Expand Up @@ -278,10 +275,8 @@ class AccessException : public Exception{
class ObjectStorage{
public:
using ReadFunc = std::function<void(const ObjectDict::Entry&, String &)>;
using ReadDelegate [[deprecated("use ReadFunc instead")]] = can::DelegateHelper<ReadFunc>;

using WriteFunc = std::function<void(const ObjectDict::Entry&, const String &)>;
using WriteDelegate [[deprecated("use WriteFunc instead")]] = can::DelegateHelper<WriteFunc>;

typedef std::shared_ptr<ObjectStorage> ObjectStorageSharedPtr;

Expand Down
1 change: 0 additions & 1 deletion canopen_master/include/canopen_master/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace canopen{
class Timer{
public:
using TimerFunc = std::function<bool(void)>;
using TimerDelegate [[deprecated("use TimerFunc instead")]] = can::DelegateHelper<TimerFunc>;

Timer():work(io), timer(io),thread(std::bind(
static_cast<size_t(boost::asio::io_service::*)(void)>(&boost::asio::io_service::run), &io))
Expand Down
Empty file removed socketcan_interface/AMENT_IGNORE
Empty file.
134 changes: 54 additions & 80 deletions socketcan_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,151 +1,125 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.5)
project(socketcan_interface)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
endif()

find_package(catkin REQUIRED
COMPONENTS
class_loader
)

find_package(console_bridge REQUIRED)

find_package(ament_cmake REQUIRED)
find_package(class_loader REQUIRED)
find_package(Boost REQUIRED
COMPONENTS
chrono
system
thread
)

find_package(Threads REQUIRED)

catkin_package(
INCLUDE_DIRS
include
LIBRARIES
${PROJECT_NAME}_string
CATKIN_DEPENDS
DEPENDS
Boost
console_bridge
)

include_directories(
include
include_directories(include
${class_loader_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
${console_bridge_INCLUDE_DIRS}
)

# ${PROJECT_NAME}_string
add_library(${PROJECT_NAME}_string
src/string.cpp
add_library(${PROJECT_NAME}_string SHARED
src/string.cpp
)

# socketcan_dump
add_executable(socketcan_dump
src/candump.cpp
)

add_executable(socketcan_dump src/candump.cpp)
target_link_libraries(socketcan_dump
${PROJECT_NAME}_string
${console_bridge_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${PROJECT_NAME}_string
${class_loader_LIBRARIES}
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)

# socketcan_bcm
add_executable(socketcan_bcm
src/canbcm.cpp
)

add_executable(socketcan_bcm src/canbcm.cpp)
target_link_libraries(socketcan_bcm
${PROJECT_NAME}_string
${console_bridge_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
${PROJECT_NAME}_string
${Boost_LIBRARIES}
)

# ${PROJECT_NAME}_plugin
add_library(${PROJECT_NAME}_plugin
add_library(${PROJECT_NAME}_plugin SHARED
src/${PROJECT_NAME}_plugin.cpp
)
target_link_libraries(${PROJECT_NAME}_plugin
${console_bridge_LIBRARIES}
${catkin_LIBRARIES}
${class_loader_LIBRARIES}
${Boost_LIBRARIES}
)

class_loader_hide_library_symbols(${PROJECT_NAME}_plugin)
install(FILES socketcan_interface_plugin.xml DESTINATION share/${PROJECT_NAME}/)
ament_index_register_resource(socketcan_interface__pluginlib__plugin CONTENT "share/${PROJECT_NAME}/socketcan_interface_plugin.xml\n")

ament_export_dependencies(
class_loader
Boost
)

ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME}_string)

install(
TARGETS
socketcan_bcm
socketcan_dump
${PROJECT_NAME}_plugin
${PROJECT_NAME}_string
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
${PROJECT_NAME}_plugin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)

install(
DIRECTORY
include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
DIRECTORY include/
DESTINATION include
)

install(
FILES
${PROJECT_NAME}_plugin.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
if(CATKIN_ENABLE_TESTING)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)

ament_lint_auto_find_test_dependencies()

catkin_add_gtest(${PROJECT_NAME}-test_dummy_interface
find_package(ament_cmake_gtest REQUIRED)

ament_add_gtest(${PROJECT_NAME}-test_dummy_interface
test/test_dummy_interface.cpp
)
target_link_libraries(${PROJECT_NAME}-test_dummy_interface
${PROJECT_NAME}_string
${console_bridge_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)

catkin_add_gtest(${PROJECT_NAME}-test_delegates
test/test_delegates.cpp
)
target_link_libraries(${PROJECT_NAME}-test_delegates
${PROJECT_NAME}_string
${catkin_LIBRARIES}
)

catkin_add_gtest(${PROJECT_NAME}-test_string
ament_add_gtest(${PROJECT_NAME}-test_string
test/test_string.cpp
)
target_link_libraries(${PROJECT_NAME}-test_string
${PROJECT_NAME}_string
${console_bridge_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)

catkin_add_gtest(${PROJECT_NAME}-test_filter
ament_add_gtest(${PROJECT_NAME}-test_filter
test/test_filter.cpp
)
target_link_libraries(${PROJECT_NAME}-test_filter
${PROJECT_NAME}_string
${console_bridge_LIBRARIES}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)

catkin_add_gtest(${PROJECT_NAME}-test_dispatcher
ament_add_gtest(${PROJECT_NAME}-test_dispatcher
test/test_dispatcher.cpp
)
target_link_libraries(${PROJECT_NAME}-test_dispatcher
${PROJECT_NAME}_string
${catkin_LIBRARIES}
${Boost_LIBRARIES}
)
target_compile_options(${PROJECT_NAME}-test_dispatcher PRIVATE -Wno-deprecated-declarations)
endif()

ament_package(
CONFIG_EXTRAS socketcan_interface-extras.cmake
)
Loading