Ask Your Question
0

Setting up parameters for selective application of nav2 libraries

asked 2021-12-06 03:21:42 -0600

morten gravatar image

updated 2021-12-06 04:36:53 -0600

I want to use the tracking controllers from nav2 as part of my simulation environment, in real life there will be a 3rd party tracking controller to which I can supply paths, but for simulation I am trying to emulate it.

As such, I am in a weird situation because I have paths generated, contours and AB lines, and I have obstacle avoidance and localization handled elsewhere. I purely want nav2 to act as a path->cmd_vel handler and nothing more. Setting this up has proven difficult as I don't have so much experience with nav2.

I am under the impression that it requires a map, therefore I've made an empty map, filled with only pixels of 254 grayscale. This is because this part should not consider obstacles, as that will be handled elsewhere. I'm not sure then if I need to enable the local or only the global map parameter configurations? Furthermore I have disabled amcl, in favor of using robot_localization instead.

Upon startup I get many error messages of

[bt_navigator-5] [INFO] [1638782303.256835846] [bt_navigator]: Configuring
[bt_navigator-5] [ERROR] [1638782303.285669115] []: Caught exception in callback for transition 10
[bt_navigator-5] [ERROR] [1638782303.285699955] []: Original error: Could not load library: libnav2_compute_path_through_poses_action_bt_node.so: cannot open shared object file: No such file or directory
[bt_navigator-5] [WARN] [1638782303.285730258] []: Error occurred while doing error handling.
[bt_navigator-5] [FATAL] [1638782303.285741871] [bt_navigator]: Lifecycle node bt_navigator does not have error state implemented
[lifecycle_manager-7] [ERROR] [1638782303.286312696] [lifecycle_manager_navigation]: Failed to change state for node: bt_navigator
[lifecycle_manager-7] [ERROR] [1638782303.286358255] [lifecycle_manager_navigation]: Failed to bring up all requested nodes. Aborting bringup.

As I said I'm not very experienced with nav2, so I'm not entirely sure which of the 20+ plugins are necessary, or if what I am trying to do is even really feasible. Note, using this and this as inspiration. Does anyone know of any examples of something similar?

map.yaml

image: default.pgm
resolution: 0.1
origin: [-50.0, -50.0, 0.0] # [0.0, 0.0, 0.0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196

my navigation.launch.py

import os

from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.actions.execute_process import ExecuteProcess
from launch.actions.include_launch_description import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration

from launch_ros.actions import Node


def generate_launch_description():
    # Get the launch directory
    bringup_dir = get_package_share_directory("nav2_bringup")
    tractor_gazebo_dir = get_package_share_directory("tractor_gazebo")

    # Create the launch configuration variables
    use_sim_time = LaunchConfiguration("use_sim_time")
    autostart = LaunchConfiguration("autostart")
    params_file = LaunchConfiguration("params_file")
    map_file = LaunchConfiguration("map_file")

    # declare launch arguments
    declare_use_sim_time = DeclareLaunchArgument(
        "use_sim_time",
        default_value="True",
        description="Flag to enable use_sim_time",
    )
    declare_autostart = DeclareLaunchArgument(
        "autostart",
        default_value="True",
        description="Automatically startup the nav2 stack",
    )
    declare_params_file = DeclareLaunchArgument(
        "params_file",
        default_value=os.path.join(
            tractor_gazebo_dir, "config", "nav2.yaml"  # "nav2_pure_pursuit.yaml"
        ),
        description="Full path to the ROS2 parameters file to use",
    )
    declare_map_file = DeclareLaunchArgument(
        "map_file",
        default_value=os.path.join(tractor_gazebo_dir, "map", "default.yaml"),
        description="Full path to the nav2 map yaml file to use",
    )

    nav2_map_server = Node(
        package="nav2_map_server",
        executable="map_server",
        name="map_server",
        output="screen",
        parameters=[params_file ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-12-06 12:35:27 -0600

Absolutely and pretty easily, Nav2 was specifically designed do you could BYOC (bring your own components) or rip out things you don't need. If you look at the main Nav2 diagram in the documentation https://navigation.ros.org/, you'll see a number of main "task" servers. You should simply remove the ones you don't want or need to reduce the requirements on your system. In particular, it sounds like you don't want the Planner server or the Waypoint Follower server. You probably don't need AMCL or map server either.

At that point, its about configuring the behavior tree to contain the business-specific logic that you would like to have happen (e.g. follow a path given to it from another source) or call the controller server directly.

There's no reason you should need to fake out a map, you could remove that.

Could not load library: libnav2_compute_path_through_poses_action_bt_node.so

That's from the BT navigator not about to find a particular library. You should make sure that your list in the configuration file represents the distribution that you're actually using. Older distributions might not have all of the BT nodes that more current ones do.

edit flag offensive delete link more

Comments

So, if I understand you right. By changing the BT I can use, for example, the DWB controller without maps, planners, or localization? And then just send poses to it through the send_goal/FollowPath action, where these poses are calculated elsewhere?

morten gravatar image morten  ( 2021-12-08 05:38:50 -0600 )edit

Yup! That is correct.

stevemacenski gravatar image stevemacenski  ( 2021-12-08 14:46:53 -0600 )edit

Using the planner necessitates a map though, right? So the path I have generated needs to be appropriate for the controller if I side-step the planner, at least spacing between poses wise.

morten gravatar image morten  ( 2021-12-09 03:49:05 -0600 )edit

Still unsure about the previous comment. I agree with you that I don't want to use the planner, but my path is 50-50 AB lines and interpolated turns. I don't want to ensure the robot is able to get onto the path from start nor interpolate the entire thing so it works for the controllers. For this I would like to use the smacplanner, is this something that is possible without maps?

morten gravatar image morten  ( 2022-01-12 02:58:54 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2021-12-06 03:21:42 -0600

Seen: 25 times

Last updated: Dec 06 '21