[Python] How to include Collision monitor node in nav2 navigation launch?

Discussão em 'Python' iniciado por Stack, Janeiro 21, 2025.

  1. Stack

    Stack Membro Participativo

    Im using ROS2 humble on Ubuntu 22.04 and nav2. I have the navigation parameter file yaml file configure like this with the Collision monitor

    collision_monitor:
    ros__parameters:
    use_sim_time: True
    base_frame_id: "base_link"
    odom_frame_id: "odom"
    cmd_vel_in_topic: "cmd_vel_smoothed"
    cmd_vel_out_topic: "cmd_vel_nav"
    transform_tolerance: 0.2
    source_timeout: 5.0
    base_shift_correction: True
    stop_pub_timeout: 2.0
    # Polygons represent zone around the robot for "stop" and "slowdown" action types,
    # and robot footprint for "approach" action type.
    # Footprint could be "polygon" type with dynamically set footprint from footprint_topic
    # or "circle" type with static footprint set by radius. "footprint_topic" parameter
    # to be ignored in circular case.
    polygons: [ "PolygonSlow", "FootprintApproach"]
    PolygonSlow:
    type: "polygon"
    points: [0.6, 0.6, 0.6, -0.6, -0.6, -0.6, -0.6, 0.6]
    action_type: "slowdown"
    max_points: 3
    slowdown_ratio: 0.9
    visualize: True
    polygon_pub_topic: "polygon_slowdown"
    FootprintApproach:
    type: "polygon"
    action_type: "approach"
    footprint_topic: "/local_costmap/footprint"
    time_before_collision: 1.0
    simulation_time_step: 0.1
    max_points: 5
    visualize: True
    observation_sources: ["scan", "pointcloud"]
    scan:
    type: "scan"
    topic: "/velodyne_points"
    pointcloud:
    type: "pointcloud"
    topic: "/dept/color/points"
    min_height: 0.1
    max_height: 0.5


    Then would like to include Collision monitor node into my nav2_navigation.launch.py file. My understanding is that has to be in the nav2_navigation.launch file and not into nav2_bringup.launch.py file.

    So here is the nav2_navigation.launch.py file where collision monitor parts are included

    lifecycle_nodes = ['controller_server',
    'smoother_server',
    'planner_server',
    'behavior_server',
    'bt_navigator',
    'waypoint_follower',
    'collision_monitor']
    ...
    load_nodes = GroupAction(
    condition=IfCondition(PythonExpression(['not ', use_composition])),
    actions=[
    Node(
    package='nav2_controller',
    executable='controller_server',
    output='screen',
    respawn=use_respawn,
    respawn_delay=2.0,
    parameters=[configured_params],
    remappings=remappings),
    Node(
    package='nav2_collision_monitor',
    executable='collision_monitor',
    output='screen',
    emulate_tty=True,
    parameters=[configured_params])
    ...

    load_composable_nodes = LoadComposableNodes(
    condition=IfCondition(use_composition),
    target_container=container_name,
    composable_node_descriptions=[
    ComposableNode(
    package='nav2_controller',
    plugin='nav2_controller::ControllerServer',
    name='controller_server',
    parameters=[configured_params],
    remappings=remappings),
    ComposableNode(
    package='nav2_collision_monitor',
    plugin='nav2_collision_monitor::CollisionMonitorNode',
    name='collision_monitor',
    parameters=[configured_params]),
    remappings=remappings),


    But still in the simulation I'm not able to visualize the polygons of the collision Monitor. Any help how to correctly implement collision Monitor node in ROS2 humble Nav2?

    Continue reading...

Compartilhe esta Página