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

[ROS2] Port kindr_ros and kindr_msgs #26

Open
wants to merge 8 commits into
base: ros2
Choose a base branch
from
Open
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
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,29 @@ ROS messages and RViz plugins for kindr objects.

## Packages

### kindr_msgs
### kindr_msgs (supports ROS2)

ROS messages for kindr objects.

### kindr_ros
### kindr_ros (supports ROS2)

Conversion between official ROS messages and kindr objects.

### kindr_rviz_plugins
### kindr_rviz_plugins (Not yet ported)

RViz plugins to visualize kindr ROS messages.

### multi_dof_joint_trajectory_rviz_plugins
### multi_dof_joint_trajectory_rviz_plugins (Not yet ported)

RViz plugins to visualize trajectory ROS messages.

## Usage

To build, clone this repository into your catkin workspace and type
To build, clone this repository into your colcon workspace and type

catkin build <package_name>
colcon build --packages-up-to <package_name>

To run tests type:

colcon test --packages-select <package_name>
colcon test-result --all --verbose
166 changes: 10 additions & 156 deletions kindr_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,163 +1,17 @@
cmake_minimum_required(VERSION 3.5.1)
project(kindr_msgs)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
message_generation
geometry_msgs
std_msgs
)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()
find_package(ament_cmake_auto)
ament_auto_find_build_dependencies()

################################################
## Declare ROS messages, services and actions ##
################################################

## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependencies might have been
## pulled in transitively but can be declared for certainty nonetheless:
## * add a build_depend tag for "message_generation"
## * add a run_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
add_message_files(
FILES
VectorAtPosition.msg
rosidl_generate_interfaces(${PROJECT_NAME}
"msg/VectorAtPosition.msg"
ADD_LINTER_TESTS
)

## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )

## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )

## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
geometry_msgs
std_msgs
)

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES kindr_msgs
CATKIN_DEPENDS message_runtime geometry_msgs std_msgs
# DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
)

## Declare a cpp library
# add_library(kindr_msgs
# src/${PROJECT_NAME}/kindr_msgs.cpp
# )

## Declare a cpp executable
# add_executable(kindr_msgs_node src/kindr_msgs_node.cpp)

## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before nodes
# add_dependencies(kindr_msgs_node kindr_msgs_generate_messages_cpp)

## Specify libraries to link a library or executable target against
# target_link_libraries(kindr_msgs_node
# ${catkin_LIBRARIES}
# )

#############
## Install ##
#############

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# install(PROGRAMS
# scripts/my_python_script
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables and/or libraries for installation
# install(TARGETS kindr_msgs kindr_msgs_node
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_kindr_msgs.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
ament_auto_package()
2 changes: 1 addition & 1 deletion kindr_msgs/msg/VectorAtPosition.msg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ uint8 TYPE_ANGULAR_VELOCITY=14
uint8 TYPE_TORQUE=16
uint8 TYPE_ANGULAR_MOMEMTUM=17

Header header
std_msgs/Header header
uint8 type
string name
geometry_msgs/Vector3 vector # Frame defined in header
Expand Down
27 changes: 19 additions & 8 deletions kindr_msgs/package.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
<?xml version="1.0"?>
<package>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>kindr_msgs</name>
<version>0.3.4</version>
<description>Kindr common msgs</description>
<maintainer email="[email protected]">Remo Diethelm</maintainer>
<maintainer email="[email protected]">Philipp Leemann</maintainer>
<author email="[email protected]">Peter Fankhauser</author>

<license>BSD</license>
<url>https://github.com/anybotics/kindr_ros</url>
<buildtool_depend>catkin</buildtool_depend>
<url type="website">https://github.com/anybotics/kindr_ros</url>

<author email="[email protected]">Peter Fankhauser</author>

<build_depend>message_generation</build_depend>
<buildtool_depend>ament_cmake_auto</buildtool_depend>

<build_depend>rosidl_default_generators</build_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend>std_msgs</build_depend>

<run_depend>message_runtime</run_depend>
<run_depend>geometry_msgs</run_depend>
<run_depend>std_msgs</run_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<exec_depend>geometry_msgs</exec_depend>
<exec_depend>std_msgs</exec_depend>

<test_depend>ament_lint_auto</test_depend>

<member_of_group>rosidl_interface_packages</member_of_group>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
83 changes: 47 additions & 36 deletions kindr_ros/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,57 +1,68 @@
cmake_minimum_required(VERSION 3.5.1)
cmake_minimum_required(VERSION 3.5)
project(kindr_ros)

add_definitions(-std=c++11)

find_package(catkin REQUIRED COMPONENTS
geometry_msgs tf
)

# Attempt to find catkinized kindr
find_package(kindr QUIET)
if(NOT kindr_FOUND)
# Attempt to find package-based kindr
find_package(PkgConfig REQUIRED)
pkg_check_modules(kindr kindr REQUIRED)
# Use C++14 standard
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(tf2 REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(kindr REQUIRED)

find_package(eigen3_cmake_module REQUIRED)
find_package(Eigen3 REQUIRED)

catkin_package(
INCLUDE_DIRS include ${EIGEN3_INCLUDE_DIR}
# LIBRARIES kindr_ros
CATKIN_DEPENDS geometry_msgs tf
DEPENDS kindr
set(dependencies
eigen3_cmake_module
Eigen3
tf2
geometry_msgs
)

include_directories(include)
include_directories(${catkin_INCLUDE_DIRS})
include_directories(${EIGEN3_INCLUDE_DIR})
include_directories(${kindr_INCLUDE_DIRS})
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION include/${PROJECT_NAME})

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)

#############
## Testing ##
#############
ament_lint_auto_find_test_dependencies()

if(CATKIN_ENABLE_TESTING)
catkin_add_gtest(${PROJECT_NAME}-test
find_package(ament_cmake_gtest REQUIRED)

ament_add_gtest(${PROJECT_NAME}-test
test/test_main.cpp
test/RosGeometryMsgPhysicalQuantitiesTest.cpp
test/RosGeometryMsgRotationTest.cpp
test/RosGeometryMsgPoseTest.cpp
test/RosTfPoseTest.cpp
test/TfConventionTest.cpp
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test
)
)

if(TARGET ${PROJECT_NAME}-test)
target_link_libraries(${PROJECT_NAME}-test ${catkin_LIBRARIES})
find_package(cmake_code_coverage QUIET)
if(cmake_code_coverage_FOUND)
add_gtest_coverage(TEST_BUILD_TARGETS ${PROJECT_NAME}-test)
endif(cmake_code_coverage_FOUND)
target_include_directories(${PROJECT_NAME}-test PUBLIC
include
${EIGEN3_INCLUDE_DIRS})
ament_target_dependencies(${PROJECT_NAME}-test
${dependencies}
)
# TODO(SivertHavso): add back code coverage:
# find_package(cmake_code_coverage QUIET)
# if(cmake_code_coverage_FOUND)
# add_gtest_coverage(TEST_BUILD_TARGETS ${PROJECT_NAME}-test)
# endif()
Comment on lines +54 to +58
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something you intended to do before merging the MR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will have to wait until I've finished porting the elevation_mapping package. I'd say merge it now since it "only" affects quality assurance and not the API or ABI. The tests themself still run and there shouldn't be a notable difference in code coverage between the ROS1 and ROS2 branch for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why is this a dependency of the porting of elevation_mapping? This is a downstream dependency, right?

endif()
endif()

install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
ament_export_include_directories(include)

ament_export_dependencies(
${dependencies}
)

ament_package()
Loading