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

Nacho/fix flake8 remaining tests #3942

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7f4963a
Use ament_black as linter
nachovizzo Nov 5, 2023
891762f
Fix standard flake8 errors for `tools
nachovizzo Nov 5, 2023
c295f72
Fix flake8 tests for nav2_common
nachovizzo Nov 5, 2023
5c60e2c
Fix flake8 nav2_common linterr
nachovizzo Nov 5, 2023
1c8e02d
Fix flake8 nav2_common linter
nachovizzo Nov 5, 2023
6d601f5
Fix flake8 nav_common linter
nachovizzo Nov 5, 2023
4eeb19a
Fix nav2_system_tests flake8 linter
nachovizzo Nov 5, 2023
58b5cb2
Fix flake8-builtins linter
nachovizzo Nov 5, 2023
bebf54d
Fix flake8-comprehensions linter
nachovizzo Nov 5, 2023
62f2292
Fix flake8-import-order linter for nav2_sumple_commander
nachovizzo Nov 5, 2023
10c7819
Fix flake8-import-order linter for nav2_system_tests
nachovizzo Nov 5, 2023
21a995d
Fix flake8-import-order linter for nav2_common
nachovizzo Nov 5, 2023
033f80f
Fix flake8-import-order linter for tools
nachovizzo Nov 5, 2023
ad85fac
Fix flake8-docstring linter
nachovizzo Nov 5, 2023
36d70f0
Fix flake8-quotes linter for nav2_common
nachovizzo Nov 5, 2023
4484d6d
Fix flake8-quotes linter for nav2_system_tests
nachovizzo Nov 5, 2023
551ac22
Fix flake8-quotes linter for nav2_collision_monitor
nachovizzo Nov 5, 2023
5ab718e
Fix flake8-quotes linter for nav2_map_server
nachovizzo Nov 5, 2023
2dd174f
Fix flake8-quotes linter for nav2_bringup
nachovizzo Nov 5, 2023
0c6a0bb
Fix flake8-quotes linter for tools
nachovizzo Nov 5, 2023
57509a9
Fix flake8-quotes linter for nav2_simple_commander
nachovizzo Nov 5, 2023
e584911
Fix flake8-quotes linter for nav2_lifecycle
nachovizzo Nov 5, 2023
cc213f4
Fix flake8-quotes linter for nav2_costmap2d
nachovizzo Nov 5, 2023
66502df
Fix flake8-quotes linter for nav2_smac_planner
nachovizzo Nov 5, 2023
e17b196
Fix linter... again
nachovizzo Nov 5, 2023
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
174 changes: 99 additions & 75 deletions nav2_bringup/launch/bringup_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription
from launch.actions import (DeclareLaunchArgument, GroupAction,
IncludeLaunchDescription, SetEnvironmentVariable)
from launch.actions import (
DeclareLaunchArgument,
GroupAction,
IncludeLaunchDescription,
SetEnvironmentVariable,
)
from launch.conditions import IfCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration, PythonExpression
Expand Down Expand Up @@ -51,8 +55,7 @@ def generate_launch_description():
# /~https://github.com/ros/robot_state_publisher/pull/30
# TODO(orduno) Substitute with `PushNodeRemapping`
# /~https://github.com/ros2/launch_ros/issues/56
remappings = [('/tf', 'tf'),
('/tf_static', 'tf_static')]
remappings = [('/tf', 'tf'), ('/tf_static', 'tf_static')]

# Only it applys when `use_namespace` is True.
# '<robot_namespace>' keyword shall be replaced by 'namespace' launch argument
Expand All @@ -61,113 +64,134 @@ def generate_launch_description():
params_file = ReplaceString(
source_file=params_file,
replacements={'<robot_namespace>': ('/', namespace)},
condition=IfCondition(use_namespace))
condition=IfCondition(use_namespace),
)

configured_params = ParameterFile(
RewrittenYaml(
source_file=params_file,
root_key=namespace,
param_rewrites={},
convert_types=True),
allow_substs=True)
convert_types=True,
),
allow_substs=True,
)

stdout_linebuf_envvar = SetEnvironmentVariable(
'RCUTILS_LOGGING_BUFFERED_STREAM', '1')
'RCUTILS_LOGGING_BUFFERED_STREAM', '1'
)

declare_namespace_cmd = DeclareLaunchArgument(
'namespace',
default_value='',
description='Top-level namespace')
'namespace', default_value='', description='Top-level namespace'
)

declare_use_namespace_cmd = DeclareLaunchArgument(
'use_namespace',
default_value='false',
description='Whether to apply a namespace to the navigation stack')
description='Whether to apply a namespace to the navigation stack',
)

declare_slam_cmd = DeclareLaunchArgument(
'slam',
default_value='False',
description='Whether run a SLAM')
'slam', default_value='False', description='Whether run a SLAM'
)

declare_map_yaml_cmd = DeclareLaunchArgument(
'map',
default_value='',
description='Full path to map yaml file to load')
'map', default_value='', description='Full path to map yaml file to load'
)

declare_use_sim_time_cmd = DeclareLaunchArgument(
'use_sim_time',
default_value='false',
description='Use simulation (Gazebo) clock if true')
description='Use simulation (Gazebo) clock if true',
)

declare_params_file_cmd = DeclareLaunchArgument(
'params_file',
default_value=os.path.join(bringup_dir, 'params', 'nav2_params.yaml'),
description='Full path to the ROS2 parameters file to use for all launched nodes')
description='Full path to the ROS2 parameters file to use for all launched nodes',
)

declare_autostart_cmd = DeclareLaunchArgument(
'autostart', default_value='true',
description='Automatically startup the nav2 stack')
'autostart',
default_value='true',
description='Automatically startup the nav2 stack',
)

declare_use_composition_cmd = DeclareLaunchArgument(
'use_composition', default_value='True',
description='Whether to use composed bringup')
'use_composition',
default_value='True',
description='Whether to use composed bringup',
)

declare_use_respawn_cmd = DeclareLaunchArgument(
'use_respawn', default_value='False',
description='Whether to respawn if a node crashes. Applied when composition is disabled.')
'use_respawn',
default_value='False',
description='Whether to respawn if a node crashes. Applied when composition is disabled.',
)

declare_log_level_cmd = DeclareLaunchArgument(
'log_level', default_value='info',
description='log level')
'log_level', default_value='info', description='log level'
)

# Specify the actions
bringup_cmd_group = GroupAction([
PushROSNamespace(
condition=IfCondition(use_namespace),
namespace=namespace),

Node(
condition=IfCondition(use_composition),
name='nav2_container',
package='rclcpp_components',
executable='component_container_isolated',
parameters=[configured_params, {'autostart': autostart}],
arguments=['--ros-args', '--log-level', log_level],
remappings=remappings,
output='screen'),

IncludeLaunchDescription(
PythonLaunchDescriptionSource(os.path.join(launch_dir, 'slam_launch.py')),
condition=IfCondition(slam),
launch_arguments={'namespace': namespace,
'use_sim_time': use_sim_time,
'autostart': autostart,
'use_respawn': use_respawn,
'params_file': params_file}.items()),

IncludeLaunchDescription(
PythonLaunchDescriptionSource(os.path.join(launch_dir,
'localization_launch.py')),
condition=IfCondition(PythonExpression(['not ', slam])),
launch_arguments={'namespace': namespace,
'map': map_yaml_file,
'use_sim_time': use_sim_time,
'autostart': autostart,
'params_file': params_file,
'use_composition': use_composition,
'use_respawn': use_respawn,
'container_name': 'nav2_container'}.items()),

IncludeLaunchDescription(
PythonLaunchDescriptionSource(os.path.join(launch_dir, 'navigation_launch.py')),
launch_arguments={'namespace': namespace,
'use_sim_time': use_sim_time,
'autostart': autostart,
'params_file': params_file,
'use_composition': use_composition,
'use_respawn': use_respawn,
'container_name': 'nav2_container'}.items()),
])
bringup_cmd_group = GroupAction(
[
PushROSNamespace(condition=IfCondition(use_namespace), namespace=namespace),
Node(
condition=IfCondition(use_composition),
name='nav2_container',
package='rclcpp_components',
executable='component_container_isolated',
parameters=[configured_params, {'autostart': autostart}],
arguments=['--ros-args', '--log-level', log_level],
remappings=remappings,
output='screen',
),
IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(launch_dir, 'slam_launch.py')
),
condition=IfCondition(slam),
launch_arguments={
'namespace': namespace,
'use_sim_time': use_sim_time,
'autostart': autostart,
'use_respawn': use_respawn,
'params_file': params_file,
}.items(),
),
IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(launch_dir, 'localization_launch.py')
),
condition=IfCondition(PythonExpression(['not ', slam])),
launch_arguments={
'namespace': namespace,
'map': map_yaml_file,
'use_sim_time': use_sim_time,
'autostart': autostart,
'params_file': params_file,
'use_composition': use_composition,
'use_respawn': use_respawn,
'container_name': 'nav2_container',
}.items(),
),
IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(launch_dir, 'navigation_launch.py')
),
launch_arguments={
'namespace': namespace,
'use_sim_time': use_sim_time,
'autostart': autostart,
'params_file': params_file,
'use_composition': use_composition,
'use_respawn': use_respawn,
'container_name': 'nav2_container',
}.items(),
),
]
)

# Create the launch description and populate
ld = LaunchDescription()
Expand Down
Loading