Skip to content

Commit

Permalink
Deprecate utilities.myargv for rclpy.utilities.remove_ros_args (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
stonier committed Nov 25, 2019
1 parent cb466f8 commit c1d8649
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 29 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Forthcoming
* [trees] permit setup visitors, provide a default with timings, `#129 <https://github.com/splintered-reality/py_trees_ros/pull/129>`_,
* [trees] bugfix non-infinite timeout arg getting ignored, `#129 <https://github.com/splintered-reality/py_trees_ros/pull/129>`_,
* [trees] snapshot now publishing a) tree changed, b) key access info, `#128 <https://github.com/splintered-reality/py_trees_ros/pull/128>`_,
* [utilities] deprecate myargv for rclpy.utilities.remove_ros_args, `#130 <https://github.com/splintered-reality/py_trees_ros/pull/130>`_,

2.0.0 (2019-11-20)
------------------
Expand Down
3 changes: 1 addition & 2 deletions py_trees_ros/programs/blackboard_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ def main(command_line_args=sys.argv[1:]):
"""
Entry point for the blackboard watcher script.
"""
# Until there is support for a ros arg stripper
# command_line_args = rospy.myargv(argv=command_line_args)[1:]
# command_line_args = rclpy.utilities.remove_ros_args(command_line_args)[1:]
parser = command_line_argument_parser(formatted_for_sphinx=False)
args = parser.parse_args(command_line_args)

Expand Down
3 changes: 1 addition & 2 deletions py_trees_ros/programs/tree_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ def main():
####################
# Arg Parsing
####################
# Until there is support for a ros arg stripper
# command_line_args = rospy.myargv(argv=sys.argv)[1:]
# command_line_args = rclpy.utilities.remove_ros_args(command_line_args)[1:]
command_line_args = None
parser = command_line_argument_parser(formatted_for_sphinx=False)
args = parser.parse_args(command_line_args)
Expand Down
25 changes: 0 additions & 25 deletions py_trees_ros/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,31 +212,6 @@ def create_anonymous_node_name(node_name="node") -> str:
return node_name + "_" + str(time.monotonic()).replace('.', '')


REMAP_PATTERN = re.compile('^([\~\/A-Za-z]|_|__)[\w\/]*' + ":=" + '.*')


def myargv(argv: typing.List[str]=None):
"""
Need something like this upstreamed in rclpy. The original ROS1 versions
thereof can be found at:
- https://github.com/ros/ros_comm/blob/melodic-devel/clients/rospy/src/rospy/client.py#L77
- https://github.com/ros/ros_comm/blob/melodic-devel/tools/rosgraph/src/rosgraph/names.py#L246
Args:
argv:
"""
if argv is None:
argv = sys.argv

def is_legal_remap(arg):
if arg is None:
return False
m = REMAP_PATTERN.match(arg)
return m is not None and m.group(0) == arg

return [a for a in argv if not is_legal_remap(a)]


##############################################################################
# Convenience Classes
##############################################################################
Expand Down

0 comments on commit c1d8649

Please sign in to comment.