diff --git a/exercises/easynav/4.using_navmap/README.md b/exercises/easynav/4.using_navmap/README.md index a4bc208..4f4ebb1 100644 --- a/exercises/easynav/4.using_navmap/README.md +++ b/exercises/easynav/4.using_navmap/README.md @@ -175,6 +175,69 @@ ros2 run easynav_system system_main ![both_representations](./img/both_representations.png) +## Navigate using NavMap + +Now that we have visualized the NavMap and Bonxai representations, we can use NavMap for navigation. EasyNav provides a Planner that can use NavMap representation to plan paths for the robot. + +1. To use it, you need to set the Planner type to `Planner` in the parameters file used to launch EasyNav system. The Planner description suggested is shown as follow: + +```yaml +planner_node: + ros__parameters: + use_sim_time: true + planner_types: [astar] + astar: + plugin: easynav_navmap_planner/AStarPlanner + max_allowed_slope_deg: 20.0 +``` + +Where the plugin used is `easynav_navmap_planner/AStarPlanner`, which is a Planner implementation for NavMap representation. + +As controller. you can use the next description for a `mppi` controller: + +```yaml +controller_node: + ros__parameters: + use_sim_time: true + controller_types: [mppi] + mppi: + plugin: easynav_mppi_controller/MPPIController + num_samples: 100 + horizon_steps: 10 + dt: 0.1 + lambda: 0.1 + max_linear_velocity: 1.0 + max_angular_velocity: 1.0 + max_linear_acceleration: 0.5 + max_angular_acceleration: 1.0 + fov: 1.57 + safety_radius: 0.6 +``` + +2. For adding goal pose visualization in RViz2, we add a `Pose` as follow: + +![add_pose](./img/add_goalpose.png) + +3. For adding the visualization generated by controller, we add a `MarkerArray` visualization as is shown as follow: + +![add_mppi_path](./img/add_mppi_path.png) + +4. To visualize the planned path by the Planner, we add a `Path` display. + +![add_path](./img/add_path.png) + +5. Now we can set a goal pose by terminal with the following command: + +```bash +ros2 topic pub --once /goal_pose geometry_msgs/msg/PoseStamped "{header: {frame_id: 'map'}, pose: {position:{x: 2, y: 4, z: 0}}}" +``` + +being `x`, `y` and `z` the coordinates of the goal position in the `map` frame. + +6. You should see the robot planning a path to the goal position using NavMap representation as shown below: + +![navigation](./img/navigation.png) + ## Conclusion -In this exercise, we have learned how to use NavMap representation in EasyNav for localization. We have also seen how to visualize Bonxai representation in RViz2. Both representations provide efficient ways to represent and navigate complex environments in robotics applications and they integrate into EasyNav. \ No newline at end of file +In this exercise, we have learned how to use NavMap representation in EasyNav for localization. We have also seen how to visualize Bonxai representation in RViz2. Both representations provide efficient ways to represent and navigate complex environments in robotics applications and they integrate into EasyNav. Finally you can navigate using NavMap representation with the Planner and Controller provided by EasyNav in 3D spaces. diff --git a/exercises/easynav/4.using_navmap/img/add_goalpose.png b/exercises/easynav/4.using_navmap/img/add_goalpose.png new file mode 100644 index 0000000..ef5e313 Binary files /dev/null and b/exercises/easynav/4.using_navmap/img/add_goalpose.png differ diff --git a/exercises/easynav/4.using_navmap/img/add_mppi_path.png b/exercises/easynav/4.using_navmap/img/add_mppi_path.png new file mode 100644 index 0000000..d8c233e Binary files /dev/null and b/exercises/easynav/4.using_navmap/img/add_mppi_path.png differ diff --git a/exercises/easynav/4.using_navmap/img/add_path.png b/exercises/easynav/4.using_navmap/img/add_path.png new file mode 100644 index 0000000..c51815d Binary files /dev/null and b/exercises/easynav/4.using_navmap/img/add_path.png differ diff --git a/exercises/easynav/4.using_navmap/img/navigation.png b/exercises/easynav/4.using_navmap/img/navigation.png new file mode 100644 index 0000000..5e85ea3 Binary files /dev/null and b/exercises/easynav/4.using_navmap/img/navigation.png differ diff --git a/exercises/easynav/4.using_navmap/navmap.params.yaml b/exercises/easynav/4.using_navmap/navmap.params.yaml index 02b1339..8e3753e 100644 --- a/exercises/easynav/4.using_navmap/navmap.params.yaml +++ b/exercises/easynav/4.using_navmap/navmap.params.yaml @@ -1,18 +1,25 @@ controller_node: ros__parameters: use_sim_time: true - controller_types: [dummy] - dummy: - rt_freq: 30.0 - plugin: easynav_controller/DummyController - cycle_time_nort: 0.01 - cycle_time_rt: 0.001 + controller_types: [mppi] + mppi: + plugin: easynav_mppi_controller/MPPIController + num_samples: 100 + horizon_steps: 10 + dt: 0.1 + lambda: 0.1 + max_linear_velocity: 1.0 + max_angular_velocity: 1.0 + max_linear_acceleration: 0.5 + max_angular_acceleration: 1.0 + fov: 1.57 + safety_radius: 0.6 localizer_node: ros__parameters: use_sim_time: true - localizer_types: [dummy] - dummy: + localizer_types: [amcl] + amcl: rt_freq: 50.0 freq: 5.0 reseed_freq: 0.1 @@ -49,12 +56,10 @@ maps_manager_node: planner_node: ros__parameters: use_sim_time: true - planner_types: [dummy] - dummy: - freq: 1.0 - plugin: easynav_planner/DummyPlanner - cycle_time_nort: 0.2 - cycle_time_rt: 0.001 + planner_types: [astar] + astar: + plugin: easynav_navmap_planner/AStarPlanner + max_allowed_slope_deg: 20.0 sensors_node: ros__parameters: @@ -76,5 +81,5 @@ system_node: ros__parameters: use_sim_time: true use_real_time: false - position_tolerance: 0.3 - angle_tolerance: 0.15 + position_tolerance: 1.0 + angle_tolerance: 0.25 diff --git a/exercises/easynav/easynav_playground/easynav_workshop_testcase/config/navmap.params.yaml b/exercises/easynav/easynav_playground/easynav_workshop_testcase/config/navmap.params.yaml index 0a9d607..063d484 100644 --- a/exercises/easynav/easynav_playground/easynav_workshop_testcase/config/navmap.params.yaml +++ b/exercises/easynav/easynav_playground/easynav_workshop_testcase/config/navmap.params.yaml @@ -1,18 +1,25 @@ controller_node: ros__parameters: use_sim_time: true - controller_types: [dummy] - dummy: - rt_freq: 30.0 - plugin: easynav_controller/DummyController - cycle_time_nort: 0.01 - cycle_time_rt: 0.001 + controller_types: [mppi] + mppi: + plugin: easynav_mppi_controller/MPPIController + num_samples: 100 + horizon_steps: 10 + dt: 0.1 + lambda: 0.1 + max_linear_velocity: 1.0 + max_angular_velocity: 1.0 + max_linear_acceleration: 0.5 + max_angular_acceleration: 1.0 + fov: 1.57 + safety_radius: 0.6 localizer_node: ros__parameters: use_sim_time: true - localizer_types: [dummy] - dummy: + localizer_types: [amcl] + amcl: rt_freq: 50.0 freq: 5.0 reseed_freq: 0.1 @@ -49,12 +56,10 @@ maps_manager_node: planner_node: ros__parameters: use_sim_time: true - planner_types: [dummy] - dummy: - freq: 1.0 - plugin: easynav_planner/DummyPlanner - cycle_time_nort: 0.2 - cycle_time_rt: 0.001 + planner_types: [astar] + astar: + plugin: easynav_navmap_planner/AStarPlanner + max_allowed_slope_deg: 20.0 sensors_node: ros__parameters: @@ -76,5 +81,5 @@ system_node: ros__parameters: use_sim_time: true use_real_time: false - position_tolerance: 0.3 - angle_tolerance: 0.15 + position_tolerance: 1.0 + angle_tolerance: 0.25