diff --git a/README.md b/README.md index b0b6fd3..c6ebb7a 100644 --- a/README.md +++ b/README.md @@ -680,34 +680,48 @@ Then save the generated map. ## Navigation +TODO: Brief overview + ### Gazebo -Nav2's amcl package is used for localization with the map generated from slam_toolbox +Nav2's `amcl` package is used for localization with the map generated from ``slam_toolbox`. + +Bring up lidarbot in Gazebo classic: ``` ros2 launch lidarbot_gazebo gazebo_launch.py ``` -Note map location and name +Navigate to the development workspace and open the following terminals. + +To open `rviz`: ``` rviz2 -d src/lidarbot_navigation/rviz/lidarbot_nav.rviz ``` +To localize lidarbot with `amcl` in the map generated by `slam_toolbox`: ``` -ros2 launch lidarbot_navigation localization_launch.py map:=./sim_map.yaml use_sim_time:=true +ros2 launch lidarbot_navigation localization_launch.py \ +map:=./src/lidarbot_navigation/maps/sim_map.yaml use_sim_time:=true ``` +To launch navigation: ``` ros2 launch lidarbot_navigation navigation_launch.py use_sim_time:=true \ map_subscribe_transient_local:=true ``` -Set initial pose using the `2D Pose Estimate` button in the toolbar +In rviz, set the initial pose using the `2D Pose Estimate` button in the toolbar so that lidarbot is aligned correctly both in rviz and Gazebo classic. Afterwards, click on the `2D Goal Pose` and choose a place on the map for lidarbot to navigate to: + +

+ +

-Note about the pixels -Blue arrow shows unfiltered odometry, while green shows the filtered odometry. The number of arrows shown is the number of odometry data to keep before removing the oldest. 0 means keep all of them. +Note about the pixels not part of the map + +The blue arrow shows unfiltered odometry, while green shows the filtered odometry. ### Lidarbot @@ -730,6 +744,8 @@ ros2 launch lidarbot_navigation navigation_launch.py use_sim_time:=false \ map_subscribe_transient_local:=true ``` +Using navigation goal button from nav2 plugin + Use waypoint mode here TODO: diff --git a/docs/images/gazebo_navigation.gif b/docs/images/gazebo_navigation.gif new file mode 100644 index 0000000..7512270 Binary files /dev/null and b/docs/images/gazebo_navigation.gif differ diff --git a/lidarbot_bringup/launch/rplidar_launch.py b/lidarbot_bringup/launch/rplidar_launch.py index bfa7467..60e6f1d 100644 --- a/lidarbot_bringup/launch/rplidar_launch.py +++ b/lidarbot_bringup/launch/rplidar_launch.py @@ -1,11 +1,8 @@ #!/usr/bin/env python3 -import os - from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription from launch.actions import DeclareLaunchArgument -from launch.actions import LogInfo from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node @@ -17,7 +14,7 @@ def generate_launch_description(): frame_id = LaunchConfiguration('frame_id', default='lidar_link') inverted = LaunchConfiguration('inverted', default='false') angle_compensate = LaunchConfiguration('angle_compensate', default='true') - scan_mode = LaunchConfiguration('scan_mode', default='Sensitivity') + scan_mode = LaunchConfiguration('scan_mode', default='Standard') return LaunchDescription([ @@ -50,6 +47,7 @@ def generate_launch_description(): 'angle_compensate', default_value=angle_compensate, description='Specifying whether or not to enable angle_compensate of scan data'), + DeclareLaunchArgument( 'scan_mode', default_value=scan_mode, @@ -65,6 +63,7 @@ def generate_launch_description(): 'serial_baudrate': serial_baudrate, 'frame_id': frame_id, 'inverted': inverted, - 'angle_compensate': angle_compensate}], + 'angle_compensate': angle_compensate, + 'scan_mode': scan_mode}], output='screen'), - ]) \ No newline at end of file + ]) diff --git a/lidarbot_navigation/config/ekf.yaml b/lidarbot_navigation/config/ekf.yaml index 85f2c1b..f3ae34a 100644 --- a/lidarbot_navigation/config/ekf.yaml +++ b/lidarbot_navigation/config/ekf.yaml @@ -6,7 +6,6 @@ ekf_filter_node: frequency: 50.0 two_d_mode: true - print_diagnostics: true map_frame: map odom_frame: odom @@ -32,4 +31,4 @@ ekf_filter_node: false, false, false, false, false, false, false, false, true, - true, false, false] \ No newline at end of file + true, false, false] diff --git a/lidarbot_navigation/maps/library_save.pgm b/lidarbot_navigation/maps/library_save.pgm deleted file mode 100644 index 18a49a9..0000000 Binary files a/lidarbot_navigation/maps/library_save.pgm and /dev/null differ diff --git a/lidarbot_navigation/maps/library_save.yaml b/lidarbot_navigation/maps/library_save.yaml deleted file mode 100644 index 1ee7b8b..0000000 --- a/lidarbot_navigation/maps/library_save.yaml +++ /dev/null @@ -1,7 +0,0 @@ -image: library_save.pgm -mode: trinary -resolution: 0.05 -origin: [-1.71, -3.13, 0] -negate: 0 -occupied_thresh: 0.65 -free_thresh: 0.25 \ No newline at end of file diff --git a/lidarbot_navigation/maps/library_serial.data b/lidarbot_navigation/maps/library_serial.data deleted file mode 100644 index 004a036..0000000 Binary files a/lidarbot_navigation/maps/library_serial.data and /dev/null differ diff --git a/lidarbot_navigation/maps/library_serial.posegraph b/lidarbot_navigation/maps/library_serial.posegraph deleted file mode 100644 index f8bd4d4..0000000 Binary files a/lidarbot_navigation/maps/library_serial.posegraph and /dev/null differ diff --git a/lidarbot_navigation/maps/real_map.data b/lidarbot_navigation/maps/real_map.data deleted file mode 100644 index d94a482..0000000 Binary files a/lidarbot_navigation/maps/real_map.data and /dev/null differ diff --git a/lidarbot_navigation/maps/real_map.pgm b/lidarbot_navigation/maps/real_map.pgm deleted file mode 100644 index ce5db6c..0000000 Binary files a/lidarbot_navigation/maps/real_map.pgm and /dev/null differ diff --git a/lidarbot_navigation/maps/real_map.posegraph b/lidarbot_navigation/maps/real_map.posegraph deleted file mode 100644 index 8f01dfb..0000000 Binary files a/lidarbot_navigation/maps/real_map.posegraph and /dev/null differ diff --git a/lidarbot_navigation/maps/real_map.yaml b/lidarbot_navigation/maps/real_map.yaml deleted file mode 100644 index 63dbad4..0000000 --- a/lidarbot_navigation/maps/real_map.yaml +++ /dev/null @@ -1,7 +0,0 @@ -image: real_map.pgm -mode: trinary -resolution: 0.05 -origin: [-3.46, -6.02, 0] -negate: 0 -occupied_thresh: 0.65 -free_thresh: 0.25 \ No newline at end of file diff --git a/lidarbot_navigation/maps/sim_map.yaml b/lidarbot_navigation/maps/sim_map.yaml index b3b5260..9dd90c9 100644 --- a/lidarbot_navigation/maps/sim_map.yaml +++ b/lidarbot_navigation/maps/sim_map.yaml @@ -1,4 +1,4 @@ -image: sim2_map.pgm +image: sim_map.pgm mode: trinary resolution: 0.05 origin: [-5.21, -5.44, 0]