Skip to content
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
63 changes: 57 additions & 6 deletions server/CMakeLists.txt → CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5)
project(parameter_server VERSION 1.0.1)
project(persist_parameter_server VERSION 1.0.1)

# Set Release build if no build type was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
Expand Down Expand Up @@ -33,9 +33,11 @@ find_package(rmw REQUIRED)
find_package(Boost REQUIRED COMPONENTS program_options filesystem)
find_package(yaml_cpp_vendor REQUIRED)

option(CLIENT_TEST_DEMO "Build client test demo" OFF)

add_executable(server
src/parameter_server.cpp
src/main.cpp
server/src/parameter_server.cpp
server/src/main.cpp
)

# yaml-cpp updates CMake thing significantly on v0.8.0 or later.
Expand Down Expand Up @@ -69,16 +71,65 @@ endif()

target_include_directories(server
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/server/include>
)

install(TARGETS server DESTINATION lib/${PROJECT_NAME})

# Install launch files.
install(DIRECTORY
launch
param
server/launch
server/param
DESTINATION share/${PROJECT_NAME}/
)

# Build client test demo
if (CLIENT_TEST_DEMO)
add_executable(client_default
test/src/test_default.cpp
test/src/persist_parameter_client.cpp
)

target_link_libraries(client_default
PUBLIC
rclcpp::rclcpp
rclcpp_components::component
rcutils::rcutils
${std_msgs_TARGETS}
${std_srvs_TARGETS}
)

target_include_directories(client_default
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/test/include>
)

add_executable(client_with_node_options
test/src/test_with_node_options.cpp
test/src/persist_parameter_client.cpp
)

target_link_libraries(client_with_node_options
PUBLIC
rclcpp::rclcpp
rclcpp_components::component
rcutils::rcutils
${std_msgs_TARGETS}
${std_srvs_TARGETS}
)

target_include_directories(client_with_node_options
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/test/include>
)

install(TARGETS client_default client_with_node_options DESTINATION lib/${PROJECT_NAME})

# Install launch files.
install(DIRECTORY
test/launch
DESTINATION share/${PROJECT_NAME}/
)
endif()

ament_package()
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RUN apt-get update \
# Build and source colcon workspace
RUN cd $COLCON_WS \
&& source /opt/ros/$ROS_DISTRO/setup.bash \
&& colcon build --symlink-install --packages-select parameter_server
&& colcon build --symlink-install --packages-select persist_parameter_server

# Add source environment in .bashrc
RUN echo -n -e "\n" >> /root/.bashrc
Expand Down
2 changes: 1 addition & 1 deletion k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
image: tomoyafujita/ros2_param_server:rolling
command: ["/bin/bash", "-c"]
args:
- "source /opt/ros/rolling/setup.bash && source /root/colcon_ws/install/setup.bash && ros2 run parameter_server server --file-path /etc/config/parameter_server.yaml"
- "source /opt/ros/rolling/setup.bash && source /root/colcon_ws/install/setup.bash && ros2 run persist_parameter_server server --file-path /etc/config/parameter_server.yaml"
resources:
requests:
memory: "128Mi"
Expand Down
2 changes: 1 addition & 1 deletion server/package.xml → package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>parameter_server</name>
<name>persist_parameter_server</name>
<version>1.0.1</version>
<description>
ros2 parameter server that other nodes can write/read parameters including persistent parameters.
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-verification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function build_parameter_server () {
echo "[${FUNCNAME[0]}]: build ROS 2 parameter server."
source /opt/ros/${ROS_DISTRO}/setup.bash
cd ${COLCON_WORKSPACE}
colcon build --symlink-install --packages-select parameter_server ros2_persistent_parameter_server_test
colcon build --symlink-install --packages-select persist_parameter_server --cmake-args -D CLIENT_TEST_DEMO=ON
}

function test_parameter_server () {
Expand Down
79 changes: 0 additions & 79 deletions test/CMakeLists.txt

This file was deleted.

32 changes: 0 additions & 32 deletions test/package.xml

This file was deleted.

8 changes: 4 additions & 4 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

signal.signal(signal.SIGINT, signal.SIG_DFL)
sleep_time = 3
launchServerCmd = ['ros2', 'launch', 'ros2_persistent_parameter_server_test', 'test.launch.py']
launchServerCmd = ['ros2', 'launch', 'persist_parameter_server', 'test.launch.py']
launchClientCmd = ['ros2', 'run',
'ros2_persistent_parameter_server_test', 'client_default']
'persist_parameter_server', 'client_default']

launchServerCmdWithNodeOptions = [
'ros2', 'launch', 'ros2_persistent_parameter_server_test', 'test.launch.py', 'allow_dynamic_typing:=true']
'ros2', 'launch', 'persist_parameter_server', 'test.launch.py', 'allow_dynamic_typing:=true']
launchClientCmdWithNodeOptions = [
'ros2', 'run', 'ros2_persistent_parameter_server_test', 'client_with_node_options']
'ros2', 'run', 'persist_parameter_server', 'client_with_node_options']

if shutil.which('ros2') is None:
print("source <colcon_ws>/install/setup.bash...then retry.")
Expand Down
Loading