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

Convert executive to ros2 #777

Draft
wants to merge 17 commits into
base: ros2
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
20 changes: 10 additions & 10 deletions astrobee/launch/robot/MLP.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,16 @@ def generate_launch_description():
package='rclcpp_components',
executable='component_container',
composable_node_descriptions=[
# ComposableNode(
# package='executive',
# plugin='executive::Executive',
# name='executive',
# extra_arguments=[{'use_intra_process_comms': True}]),
# ComposableNode(
# package='access_control',
# plugin='access_control::AccessControl',
# name='access_control',
# extra_arguments=[{'use_intra_process_comms': True}]),
ComposableNode(
package='executive',
plugin='executive::Executive',
name='executive',
extra_arguments=[{'use_intra_process_comms': False}]),
ComposableNode(
package='access_control',
plugin='access_control::AccessControl',
name='access_control',
extra_arguments=[{'use_intra_process_comms': False}]),
]
),
ComposableNodeContainer(
Expand Down
2 changes: 1 addition & 1 deletion management/access_control/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

set( CMAKE_CXX_FLAGS "${CMAKE_CXXX_FLAGS} -Wall -Werror -O3 -fPIC" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -O3 -fPIC" )

## Find ament and libraries
find_package(ament_cmake REQUIRED)
Expand Down
169 changes: 74 additions & 95 deletions management/executive/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,67 +15,53 @@
# License for the specific language governing permissions and limitations
# under the License.

cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.5)
project(executive)

## Compile as C++14, supported in ROS Kinetic and newer
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
add_compile_options(-std=c++14)
add_definitions(-DROS1)

## Find catkin macros and libraries
find_package(catkin2 REQUIRED COMPONENTS
roscpp
ff_msgs
ff_hw_msgs
nodelet
config_reader
ff_util
jsonloader
)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -O3 -fPIC" )

## Find ament and libraries
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(ff_msgs REQUIRED)
find_package(ff_hw_msgs REQUIRED)
find_package(config_reader REQUIRED)
find_package(ff_util REQUIRED)
find_package(jsonloader REQUIRED)

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

# Find jsoncpp
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../../cmake")
find_package(JsonCpp REQUIRED)

catkin_package(
LIBRARIES
executive
sequencer
CATKIN_DEPENDS
roscpp
ff_msgs
ff_hw_msgs
nodelet
ff_util
jsonloader
)

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

# Specify additional locations of header files
include_directories(
include
${catkin_INCLUDE_DIRS}
${JSONCPP_INCLUDE_DIR}
)

# Declare C++ libraries
add_library(sequencer
add_library(sequencer SHARED
src/utils/sequencer/command_conversion.cc
src/utils/sequencer/plan_io.cc
src/utils/sequencer/sequencer.cc
)
add_dependencies(sequencer ${catkin_EXPORTED_TARGETS})
target_link_libraries(sequencer ${Boost_IOSTREAMS_LIBRARY} ${catkin_LIBRARIES})
ament_target_dependencies(sequencer rclcpp rclcpp_components ff_common ff_msgs ff_hw_msgs config_reader ff_util jsonloader)

# Declare C++ libraries
add_library(executive
add_library(executive SHARED
src/executive.cc
src/op_state.cc
src/op_state_auto_return.cc
Expand All @@ -85,100 +71,93 @@ add_library(executive
src/op_state_repo.cc
src/op_state_teleop.cc
)
add_dependencies(executive ${catkin_EXPORTED_TARGETS})
target_link_libraries(executive sequencer ${Boost_SYSTEM_LIBRARY} ${catkin_LIBRARIES})

target_compile_definitions(executive PRIVATE "COMPOSITION_BUILDING_DLL")
ament_target_dependencies(executive rclcpp rclcpp_components ff_common ff_msgs ff_hw_msgs config_reader ff_util jsonloader)
rclcpp_components_register_nodes(executive "executive::Executive")

## Declare a C++ executable: data_to_disk_pub
add_executable(data_to_disk_pub tools/data_to_disk_pub.cc)
add_dependencies(data_to_disk_pub ${catkin_EXPORTED_TARGETS})
target_link_libraries(data_to_disk_pub
executive gflags ${catkin_LIBRARIES})

## Declare a C++ executable: ekf_switch_mux
add_executable(ekf_switch_mux tools/ekf_switch_mux.cc)
add_dependencies(ekf_switch_mux ${catkin_EXPORTED_TARGETS})
target_link_libraries(ekf_switch_mux
executive gflags ${catkin_LIBRARIES})
ament_target_dependencies(data_to_disk_pub rclcpp ff_common ff_msgs Boost)
target_link_libraries(data_to_disk_pub executive gflags)

## Declare a C++ executable: plan_pub
add_executable(plan_pub tools/plan_pub.cc)
add_dependencies(plan_pub ${catkin_EXPORTED_TARGETS})
target_link_libraries(plan_pub
executive gflags ${catkin_LIBRARIES} ${Boost_LIBRARIES})
ament_target_dependencies(plan_pub rclcpp ff_common ff_msgs Boost)
target_link_libraries(plan_pub executive gflags)

## Declare a C++ executable: simple_move
add_executable(simple_move tools/simple_move.cc)
add_dependencies(simple_move ${catkin_EXPORTED_TARGETS})
target_link_libraries(simple_move
executive gflags ${catkin_LIBRARIES})
ament_target_dependencies(simple_move rclcpp ff_common ff_msgs Boost)
target_link_libraries(simple_move executive gflags)

## Declare a C++ executable: teleop_tool
add_executable(teleop_tool tools/teleop_tool.cc)
add_dependencies(teleop_tool ${catkin_EXPORTED_TARGETS})
target_link_libraries(teleop_tool
executive gflags ${catkin_LIBRARIES})
ament_target_dependencies(teleop_tool rclcpp ff_common ff_msgs Boost)
target_link_libraries(teleop_tool executive gflags)

## Declare a C++ executable: zones_pub
add_executable(zones_pub tools/zones_pub.cc)
add_dependencies(zones_pub ${catkin_EXPORTED_TARGETS})
target_link_libraries(zones_pub
executive gflags ${catkin_LIBRARIES} ${Boost_LIBRARIES})
ament_target_dependencies(zones_pub rclcpp ff_common ff_msgs Boost)
target_link_libraries(zones_pub executive gflags)

if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
find_package(ros_testing REQUIRED)

if(CATKIN_ENABLE_TESTING)
find_package(rostest REQUIRED)
# Executive initialization fault tester
add_rostest_gtest(test_init_executive
test/test_init_executive.test
test/test_init_executive.cc
)

target_link_libraries(test_init_executive
${catkin_LIBRARIES} glog
)
# ament_add_gtest_executable(test_init_executive
# test/test_init_executive.cc
# )
# target_link_libraries(test_init_executive execute)
# add_ros_test(test/test_init_executive.py TIMEOUT "30" ARGS "test_binary_dir:=${CMAKE_CURRENT_BINARY_DIR}")
endif()

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

ament_export_include_directories(include)

# Mark libraries for installation
install(TARGETS sequencer
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
EXPORT sequencer
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)

# Mark nodelet_plugin for installation
install(FILES nodelet_plugins.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
install(TARGETS ${PROJECT_NAME}
EXPORT executive
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)

# Install C++ executables
install(TARGETS data_to_disk_pub DESTINATION bin)
install(TARGETS ekf_switch_mux DESTINATION bin)
install(TARGETS plan_pub DESTINATION bin)
install(TARGETS simple_move DESTINATION bin)
install(TARGETS teleop_tool DESTINATION bin)
install(TARGETS zones_pub DESTINATION bin)
install(CODE "execute_process(
COMMAND ln -s ../../bin/data_to_disk_pub share/${PROJECT_NAME}
COMMAND ln -s ../../bin/ekf_switch_mux share/${PROJECT_NAME}
COMMAND ln -s ../../bin/plan_pub share/${PROJECT_NAME}
COMMAND ln -s ../../bin/simple_move share/${PROJECT_NAME}
COMMAND ln -s ../../bin/teleop_tool share/${PROJECT_NAME}
COMMAND ln -s ../../bin/zones_pub share/${PROJECT_NAME}
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
OUTPUT_QUIET
ERROR_QUIET
)")
#install(TARGETS simple_move DESTINATION bin)
#install(TARGETS teleop_tool DESTINATION bin)
#install(TARGETS zones_pub DESTINATION bin)
#install(CODE "execute_process(
# COMMAND ln -s ../../bin/data_to_disk_pub share/${PROJECT_NAME}
# COMMAND ln -s ../../bin/ekf_switch_mux share/${PROJECT_NAME}
# COMMAND ln -s ../../bin/plan_pub share/${PROJECT_NAME}
# COMMAND ln -s ../../bin/simple_move share/${PROJECT_NAME}
# COMMAND ln -s ../../bin/teleop_tool share/${PROJECT_NAME}
# COMMAND ln -s ../../bin/zones_pub share/${PROJECT_NAME}
# WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
# OUTPUT_QUIET
# ERROR_QUIET
# )")

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

ament_package()
Empty file removed management/executive/COLCON_IGNORE
Empty file.
Loading
Loading