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

Support parameter overrides and remap rules flags on command line #483

Merged
merged 13 commits into from
Aug 26, 2019
3 changes: 3 additions & 0 deletions rcl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project(rcl)
find_package(ament_cmake_ros REQUIRED)

find_package(rcl_interfaces REQUIRED)
find_package(rcl_yaml_param_parser REQUIRED)
find_package(rcutils REQUIRED)
find_package(rmw REQUIRED)
find_package(rmw_implementation REQUIRED)
Expand Down Expand Up @@ -63,6 +64,7 @@ add_library(${PROJECT_NAME} ${${PROJECT_NAME}_sources})
# specific order: dependents before dependencies
ament_target_dependencies(${PROJECT_NAME}
"rcl_interfaces"
"rcl_yaml_param_parser"
"rmw_implementation"
"rmw"
"rcutils"
Expand Down Expand Up @@ -94,6 +96,7 @@ ament_export_libraries(${PROJECT_NAME})

ament_export_dependencies(ament_cmake)
ament_export_dependencies(rcl_interfaces)
ament_export_dependencies(rcl_yaml_param_parser)
ament_export_dependencies(rmw_implementation)
ament_export_dependencies(rmw)
ament_export_dependencies(rcutils)
Expand Down
30 changes: 30 additions & 0 deletions rcl/include/rcl/arguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "rcl/macros.h"
#include "rcl/types.h"
#include "rcl/visibility_control.h"
#include "rcl_yaml_param_parser/types.h"

#ifdef __cplusplus
extern "C"
Expand All @@ -36,6 +37,10 @@ typedef struct rcl_arguments_t

#define RCL_ROS_ARGS_FLAG "--ros-args"
#define RCL_ROS_ARGS_EXPLICIT_END_TOKEN "--"
#define RCL_PARAM_FLAG "--param"
#define RCL_SHORT_PARAM_FLAG "-p"
#define RCL_REMAP_FLAG "--remap"
#define RCL_SHORT_REMAP_FLAG "-r"

#define RCL_LOG_LEVEL_ARG_RULE "__log_level:="
#define RCL_EXTERNAL_LOG_CONFIG_ARG_RULE "__log_config_file:="
Expand Down Expand Up @@ -254,6 +259,31 @@ rcl_arguments_get_param_files(
rcl_allocator_t allocator,
char *** parameter_files);

/// Return all parameter overrides specified on the command line.
/**
* <hr>
* Attribute | Adherence
* ------------------ | -------------
* Allocates Memory | Yes
* Thread-Safe | No
* Uses Atomics | No
* Lock-Free | Yes
*
* \param[in] arguments An arguments structure that has been parsed.
* \param[out] parameter_overrides Zero or more parameter overrides.
* This structure must be finalized by the caller.
* \return `RCL_RET_OK` if everything goes correctly, or
* \return `RCL_RET_INVALID_ARGUMENT` if any function arguments are invalid, or
* \return `RCL_RET_BAD_ALLOC` if allocating memory failed, or
* \return `RCL_RET_ERROR` if an unspecified error occurs.
*/
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_arguments_get_param_overrides(
const rcl_arguments_t * arguments,
rcl_params_t ** parameter_overrides);

/// Return a list of arguments with ROS-specific arguments removed.
/**
* Some arguments may not have been intended as ROS arguments.
Expand Down
20 changes: 5 additions & 15 deletions rcl/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,13 @@

<build_export_depend>rmw</build_export_depend>

<build_depend>rcl_interfaces</build_depend>
<build_depend>rcutils</build_depend>
<build_depend>rosidl_generator_c</build_depend>
<build_depend>tinydir_vendor</build_depend>

<build_export_depend>rcl_interfaces</build_export_depend>
<build_export_depend>rcutils</build_export_depend>
<build_export_depend>rosidl_generator_c</build_export_depend>
<build_export_depend>tinydir_vendor</build_export_depend>

<exec_depend>rcl_interfaces</exec_depend>
<exec_depend>ament_cmake</exec_depend>
<exec_depend>rcutils</exec_depend>
<exec_depend>rosidl_default_runtime</exec_depend>

<depend>rcl_interfaces</depend>
<depend>rcl_logging_noop</depend> <!-- the default logging impl -->
<depend>rcl_yaml_param_parser</depend>
<depend>rcutils</depend>
<depend>rmw_implementation</depend>
<depend>rosidl_generator_c</depend>
<depend>tinydir_vendor</depend>

<test_depend>ament_cmake_gtest</test_depend>
<test_depend>ament_cmake_pytest</test_depend>
Expand Down
Loading