Function rcl_parse_arguments
Defined in File arguments.h
Function Documentation
-
rcl_ret_t rcl_parse_arguments(int argc, const char *const *argv, rcl_allocator_t allocator, rcl_arguments_t *args_output)
Parse command line arguments into a structure usable by code.
ROS arguments are expected to be scoped by a leading
--ros-args
flag and a trailing double dash token--
which may be elided if no non-ROS arguments follow after the last--ros-args
.See also
Remap rule parsing is supported via
-r/--remap
flags e.g.--remap from:=to
or-r from:=to
. Successfully parsed remap rules are stored in the order they were given inargv
. If given arguments{"__ns:=/foo", "__ns:=/bar"}
then the namespace used by nodes in this process will be/foo
and not/bar
.Parameter override rule parsing is supported via
-p/--param
flags e.g.--param name:=value
or-p name:=value
.See also
See also
See also
See also
The default log level will be parsed as
--log-level level
and logger levels will be parsed as multiple--log-level name:=level
, wherelevel
is a name representing one of the log levels in theRCUTILS_LOG_SEVERITY
enum, e.g.info
,debug
,warn
, not case sensitive. If multiple of these rules are found, the last one parsed will be used.If an argument does not appear to be a valid ROS argument e.g. a
-r/--remap
flag followed by anything but a valid remap rule, parsing will fail immediately.If an argument does not appear to be a known ROS argument, then it is skipped and left unparsed.
All arguments found outside a
--ros-args ... --
scope are skipped and left unparsed.See also
Attribute
Adherence
Allocates Memory
Yes
Thread-Safe
Yes
Uses Atomics
No
Lock-Free
Yes
See also
See also
- Parameters:
argc – [in] The number of arguments in argv.
argv – [in] The values of the arguments.
allocator – [in] A valid allocator.
args_output – [out] A structure that will contain the result of parsing. Must be zero initialized before use.
- Returns:
RCL_RET_OK if the arguments were parsed successfully, or
- Returns:
RCL_RET_INVALID_ROS_ARGS if an invalid ROS argument is found, or
- Returns:
RCL_RET_INVALID_ARGUMENT if any function arguments are invalid, or
- Returns:
RCL_RET_BAD_ALLOC if allocating memory failed, or
- Returns:
RCL_RET_ERROR if an unspecified error occurs.