You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ROS Launch should allow manual type specification in a similar manner used by ROS1
For ambiguous value types, roslaunch should generate a warning, not silently falls back to whatever it prefers.
Alternatively, roslaunch should preserve both raw string value and the auto inferred value, let developer choose at runtime. i.e.get_parameter("vid").as_string() should return the raw string, including preceding spaces and zeros.
fromlaunchimportLaunchDescriptionfromlaunch_ros.actionsimportNodedefgenerate_launch_description():
returnLaunchDescription(
[
Node(
package="serial",
executable="serial",
parameters=[
{
# Python's type system is good enough to be used like this."vid": str("0483"), # Optional str()"pid": "5740", # This should also produce string, not int"baud": int(115200), # Should produce int, with or without int()"...": float(123), # Or 123.0, should produce float
}
],
)
]
)
Implementation considerations
The rationale of the requested feature is well explained in this stackexchange post. To the best of my knowledge, roslaunch for ROS2 currently does not allow any type specification. Instead it always "infers" type from the string.
For example, the current type inference will behave like this:
USB Pid "26ce" -> string
USB Pid "8087" -> int
USB Pid "0483" -> double (due to preceding zero)
This induces extra burdens on developer side. And more importantly, it will cause potential crash upon parameter change. A system that worked fine could be brought down just because the "smart" auto type inference. This is both dangerous and inconvenient.
The text was updated successfully, but these errors were encountered:
Feature request
Feature description
get_parameter("vid").as_string()
should return the raw string, including preceding spaces and zeros.Examples:
xml
format - withROS1
like "type" attributepython
format - stick to python's type systemImplementation considerations
The rationale of the requested feature is well explained in this stackexchange post. To the best of my knowledge,
roslaunch
for ROS2 currently does not allow any type specification. Instead it always "infers" type from the string.For example, the current type inference will behave like this:
string
int
double
(due to preceding zero)This induces extra burdens on developer side. And more importantly, it will cause potential crash upon parameter change. A system that worked fine could be brought down just because the "smart" auto type inference. This is both dangerous and inconvenient.
The text was updated successfully, but these errors were encountered: