From 34b23af0fbe4727fc067f363cd0b778b0d3e3863 Mon Sep 17 00:00:00 2001 From: Franco Cipollone <53065142+francocipollone@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:26:17 -0300 Subject: [PATCH] Improves andino_navigation package. (#224) Signed-off-by: Franco Cipollone --- README.md | 13 +++---- andino_navigation/README.md | 46 +++++++++++------------ andino_navigation/params/nav2_params.yaml | 26 ++++++------- andino_slam/README.md | 19 ++++++++++ 4 files changed, 61 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 68c0bcff..2a949bbe 100644 --- a/README.md +++ b/README.md @@ -166,20 +166,19 @@ ros2 launch andino_bringup rviz.launch.py For starting `rviz2` visualization with a provided configuration. -## :computer: Simulation - -The [`andino_gz_classic`](./andino_gz_classic/README.MD) package provides a Gazebo simulation fo the Andino robot. - - - ## :compass: Navigation The [`andino_navigation`](./andino_navigation/README.md) package provides a navigation stack based on the great [Nav2](https://github.com/ros-planning/navigation2) package. https://github.com/Ekumen-OS/andino/assets/53065142/29951e74-e604-4a6e-80fc-421c0c6d8fee -_Important!: At the moment this package is only working with the simulation. The support for the real robot is forthcoming._ +Follow the [`andino_navigation`'s README](./andino_navigation/README.md) instructions for bringing up the Navigation stack in the real robot or in the simulation. +## :computer: Simulation + +The [`andino_gz_classic`](./andino_gz_classic/README.MD) package provides a Gazebo simulation for the Andino robot. + + ## :selfie: Media diff --git a/andino_navigation/README.md b/andino_navigation/README.md index 665fe1ac..86c31e55 100644 --- a/andino_navigation/README.md +++ b/andino_navigation/README.md @@ -1,39 +1,39 @@ -# Nav2 with Andino robot -*Note*: Nav2 is only configured to work with the simulation for the moment. - Support to real robot is forthcoming. +# Andino Navigation -## Build +We rely on [Nav2](https://github.com/ros-planning/navigation2) stack in order to navigate Andino. -Install package dependencies: +# Usage -``` -rosdep install --from-paths src -i -y -``` +## Real Robot -Build the package: +### Prerequisites -``` -colcon build -``` +1. Andino robot needs to be up and running: + ```sh + ros2 launch andino_bringup andino_robot.launch.py + ``` -Note: `--symlink-install` can be added if needed. +2. We need a previously recorded map in order to navigate on. + Refer to [andino_slam](../andino_slam/README.md) to learn how to record a map with Andino. -Finally, source the install folder -``` -. install/setup.bash -``` +### Run nav stack -# Usage +```sh +ros2 launch andino_navigation bringup.launch.py map:= +``` -This package has the next option to be executed. +By default, [config file](params/nav2_params.yaml) is used. For using a custom param file use: +```sh +ros2 launch andino_navigation bringup.launch.py map:= params_file:= +``` -## Andino with nav2 in Gazebo Simulation +## Simulation -This launch file use the [turtlebot3_world](https://github.com/ROBOTIS-GIT/turtlebot3_simulations/tree/master) like world example which has an Apache 2 license. +A launch file for running the andino_gz_classic simulation and the nav2 stack is provided. +It uses the [turtlebot3_world](https://github.com/ROBOTIS-GIT/turtlebot3_simulations/tree/master) world (_Apache 2 license_) by default. ``` - . /usr/share/gazebo/setup.bash - ros2 launch andino_navigation andino_simulation_navigation.launch.py + ros2 launch andino_navigation andino_simulation_navigation.launch.py ``` To test the navigation inside rviz: diff --git a/andino_navigation/params/nav2_params.yaml b/andino_navigation/params/nav2_params.yaml index ea5a01bf..86f72734 100644 --- a/andino_navigation/params/nav2_params.yaml +++ b/andino_navigation/params/nav2_params.yaml @@ -37,7 +37,7 @@ amcl: laser_min_range: -1.0 laser_model_type: "likelihood_field" max_beams: 60 - max_particles: 2000 + max_particles: 3000 min_particles: 500 odom_frame_id: "odom" pf_err: 0.05 @@ -130,7 +130,7 @@ bt_navigator_navigate_to_pose_rclcpp_node: controller_server: ros__parameters: use_sim_time: True - controller_frequency: 20.0 + controller_frequency: 10.0 min_x_velocity_threshold: 0.001 min_y_velocity_threshold: 0.5 min_theta_velocity_threshold: 0.001 @@ -212,8 +212,8 @@ local_costmap: plugins: ["voxel_layer", "inflation_layer"] inflation_layer: plugin: "nav2_costmap_2d::InflationLayer" - cost_scaling_factor: 3.0 - inflation_radius: 0.55 + cost_scaling_factor: 2.0 + inflation_radius: 0.2 voxel_layer: plugin: "nav2_costmap_2d::VoxelLayer" enabled: True @@ -270,8 +270,8 @@ global_costmap: map_subscribe_transient_local: True inflation_layer: plugin: "nav2_costmap_2d::InflationLayer" - cost_scaling_factor: 3.0 - inflation_radius: 0.55 + cost_scaling_factor: 2.0 + inflation_radius: 0.2 always_send_full_costmap: True map_server: @@ -291,13 +291,13 @@ map_saver: planner_server: ros__parameters: - expected_planner_frequency: 20.0 + expected_planner_frequency: 10.0 use_sim_time: True planner_plugins: ["GridBased"] GridBased: plugin: "nav2_navfn_planner/NavfnPlanner" tolerance: 0.5 - use_astar: false + use_astar: true allow_unknown: true smoother_server: @@ -342,7 +342,7 @@ robot_state_publisher: waypoint_follower: ros__parameters: use_sim_time: True - loop_rate: 20 + loop_rate: 10 stop_on_failure: false waypoint_task_executor_plugin: "wait_at_waypoint" wait_at_waypoint: @@ -353,14 +353,14 @@ waypoint_follower: velocity_smoother: ros__parameters: use_sim_time: True - smoothing_frequency: 20.0 + smoothing_frequency: 10.0 scale_velocities: False feedback: "OPEN_LOOP" - max_velocity: [0.26, 0.0, 1.0] - min_velocity: [-0.26, 0.0, -1.0] + max_velocity: [0.15, 0.0, 1.0] + min_velocity: [-0.15, 0.0, -1.0] max_accel: [2.5, 0.0, 3.2] max_decel: [-2.5, 0.0, -3.2] - odom_topic: "odom" + odom_topic: "/odom" odom_duration: 0.1 deadband_velocity: [0.0, 0.0, 0.0] velocity_timeout: 1.0 diff --git a/andino_slam/README.md b/andino_slam/README.md index b26f252a..b5058225 100644 --- a/andino_slam/README.md +++ b/andino_slam/README.md @@ -17,3 +17,22 @@ Several configuration can be forwarded to the `slam_toolbox_node`. By default, t ``` ros2 launch andino_slam slam_toolbox_online_async.launch.py slams_param_file:= ``` + +For saving the map you can use `map_saver_cli` node provided by Nav2. +```sh +ros2 run nav2_map_server map_saver_cli -f +``` + +You can modify the threshold for free space (0.25) and occupied space (0.65) by using +`--free` and `--occ` arguments. + +```sh +ros2 run nav2_map_server map_saver_cli --free 0.15 -f +``` +More information at: + - https://navigation.ros.org/configuration/packages/configuring-map-server.html + - https://github.com/ros-planning/navigation2/tree/main/nav2_map_server + + +Once you have the map saved, you can navigate on it! +Go to [`andino_navigation`](../andino_navigation/README.md) to learn how.