ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Nav2 controller server high CPU load

asked 2023-07-16 20:36:42 -0600

guidout gravatar image

updated 2023-07-17 07:50:33 -0600

I'm struggling to understand why the controller server is taking so much CPU (12th get i9-12900H) even when not navigating at all. image description

Here is my nav_params.yaml

I can share more info if needed, but, hopefully, I can get some pointers so I can start looking more into it since as of now I have no idea where to start from.

Thank you in advance

amcl:
  ros__parameters:
    use_sim_time: True
    alpha1: 0.2
    alpha2: 0.2
    alpha3: 0.2
    alpha4: 0.2
    alpha5: 0.2
    base_frame_id: "base_link"
    beam_skip_distance: 0.5
    beam_skip_error_threshold: 0.9
    beam_skip_threshold: 0.3
    do_beamskip: false
    global_frame_id: "map"
    lambda_short: 0.1
    laser_likelihood_max_dist: 2.0
    laser_max_range: 20.0
    laser_min_range: 0.1
    laser_model_type: "likelihood_field"
    max_beams: 60
    max_particles: 2000
    min_particles: 500
    odom_frame_id: "odom"
    pf_err: 0.05
    pf_z: 0.99
    recovery_alpha_fast: 0.0
    recovery_alpha_slow: 0.0
    resample_interval: 1
    robot_model_type: "differential"
    save_pose_rate: 0.5
    sigma_hit: 0.2
    tf_broadcast: true
    transform_tolerance: 1.0
    update_min_a: 0.2
    update_min_d: 0.25
    z_hit: 0.5
    z_max: 0.05
    z_rand: 0.5
    z_short: 0.05
    scan_topic: scan

amcl_map_client:
  ros__parameters:
    use_sim_time: True

amcl_rclcpp_node:
  ros__parameters:
    use_sim_time: True

bt_navigator:
  ros__parameters:
    use_sim_time: True
    global_frame: map
    robot_base_frame: base_link
    # odom_topic: /odometry/filtered
    odom_topic: /wheel/odometry
    transform_tolerance: 0.3
    enable_groot_monitoring: True
    groot_zmq_publisher_port: 1666
    groot_zmq_server_port: 1667
    # default_bt_xml_filename: "navigate_w_replanning_and_recovery.xml"
    default_bt_xml_filename: "navigate_w_replanning_and_round_robin_recovery"
    # default_bt_xml_filename: "simple_navigation_gfr.xml"
    # default_bt_xml_filename: "follow_point.xml"
    # default_bt_xml_filename: "followpath_only.xml"
    plugin_lib_names:
    - nav2_compute_path_to_pose_action_bt_node
    - nav2_follow_path_action_bt_node
    - nav2_back_up_action_bt_node
    - nav2_spin_action_bt_node
    - nav2_wait_action_bt_node
    - nav2_clear_costmap_service_bt_node
    - nav2_is_stuck_condition_bt_node
    - nav2_goal_reached_condition_bt_node
    - nav2_goal_updated_condition_bt_node
    - nav2_initial_pose_received_condition_bt_node
    - nav2_reinitialize_global_localization_service_bt_node
    - nav2_rate_controller_bt_node
    - nav2_distance_controller_bt_node
    - nav2_speed_controller_bt_node
    - nav2_truncate_path_action_bt_node
    - nav2_goal_updater_node_bt_node
    - nav2_recovery_node_bt_node
    - nav2_pipeline_sequence_bt_node
    - nav2_round_robin_node_bt_node
    - nav2_transform_available_condition_bt_node
    - nav2_time_expired_condition_bt_node
    - nav2_distance_traveled_condition_bt_node

bt_navigator_rclcpp_node:
  ros__parameters:
    use_sim_time: True

planner_server:
  ros__parameters:
    planner_plugins: ["GridBased"]
    use_sim_time: True

    GridBased:
      plugin: "smac_planner/SmacPlanner" 
      tolerance: 0.5                    
      downsample_costmap: false
      downsampling_factor: 1       
      allow_unknown: true # false
      max_iterations: -1                
      max_on_approach_iterations: 1000
      max_planning_time_ms: 2000.0    
      smooth_path: true                
      motion_model_for_search: "REEDS_SHEPP" 
      angle_quantization_bins: 72       
      minimum_turning_radius: 1.6     
      reverse_penalty: 5.0              
      change_penalty: 0.              
      non_straight_penalty: 1.05  
      cost_penalty: 1.3                 

      smoother:
        smoother:
          w_curve: 30.0                 # weight to minimize curvature of path
          w_dist: 0.0                   # weight to bind path to original as optional replacement for cost weight
          w_smooth: 30000.0             # weight to maximize smoothness of path
          w_cost: 0.025                 # weight to steer robot away from collision and cost
          cost_scaling_factor: 10.0     # this should match the inflation layer's parameter

        # I do not recommend users mess with this unless they're doing production tuning
        optimizer:
          max_time: 0.10                # maximum compute time for smoother
          max_iterations: 500           # max iterations of smoother
          debug_optimizer: false        # print debug info
          gradient_tol: 1.0e-10
          fn_tol: 1.0e-20
          param_tol: 1.0e-15
          advanced:
            min_line_search_step_size: 1.0e-20
            max_num_line_search_step_size_iterations: 50
            line_search_sufficient_function_decrease: 1.0e-20
            max_num_line_search_direction_restarts: 10
            max_line_search_step_expansion: 50

planner_server_rclcpp_node:
  ros__parameters:
    use_sim_time: True

controller_server:
  ros__parameters:
    use_sim_time: True
    controller_frequency: 5.0
    min_x_velocity_threshold: 0.01 # Odometry values below this threshold (in m/s) will be set to 0.0.
    min_y_velocity_threshold: 0.0
    min_theta_velocity_threshold: 0.01
    failure_tolerance: 0.5
    # odom_topic: /odometry/filtered
    odom_topic: /wheel/odometry
    progress_checker_plugin: "progress_checker"
    goal_checker_plugins: ["goal_checker"]
    controller_plugins: ["FollowPath"]

    progress_checker:
      plugin: "nav2_controller::SimpleProgressChecker"
      required_movement_radius: 0.001
      movement_time_allowance: 20.0
    goal_checker:
      plugin: "nav2_controller::SimpleGoalChecker"
      xy_goal_tolerance: 0.2 # 0.25
      yaw_goal_tolerance: 0.1 #0.25
      stateful: True
    # TEB parameters
    # http://wiki.ros.org/teb_local_planner
    FollowPath:
      plugin: "teb_local_planner::TebLocalPlannerROS"
      odom_topic: odom
      map_frame: map
      dt_ref: 0.3
      dt_hysteresis: 0.05
      exact_arc_length: True ...
(more)
edit retag flag offensive close merge delete

Comments

You might want also to take a look to the memory. RAM is full and swap memory almost too.

pgarcia-dev gravatar image pgarcia-dev  ( 2023-07-17 13:26:13 -0600 )edit

not following, they seem both <50%...

guidout gravatar image guidout  ( 2023-07-17 19:39:28 -0600 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2023-07-17 01:19:59 -0600

updated 2023-07-17 01:51:46 -0600

The controller / planner servers contain the local and global costmaps, respectively. If you’re not actively navigating, that compute time is relative to your perception plugins in your costmap configs. Given a VLP 16 at full rate + a 50 m local costmap, I wouldn’t expect that to be particularly low. That’s alot of raytracing.

edit flag offensive delete link more

Comments

@stevemacenski thanks for the input. Good point. However, I tried to reduce the local costmap from 50 to 10m but the CPU usage doesn't seem to have changed at all. Does any other perception configuration pops up to you as a possible culprit?

guidout gravatar image guidout  ( 2023-07-17 07:47:15 -0600 )edit

Without digging into your application / specific configs to try to find a solution, I don't have cookie cutter advice. Perception requirements are highly dependent on application needs, dynamics, and environment types -- not to mention obviously sensors being used and their configurations/mounting visibility. If you wanted to chat more about this for a private engagement with your company, I'm happy to :-) My email is steve@opennav.org.

stevemacenski gravatar image stevemacenski  ( 2023-07-22 10:09:55 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2023-07-16 20:36:42 -0600

Seen: 495 times

Last updated: Jul 17 '23