Skip to content

Latest commit

 

History

History
152 lines (104 loc) · 4.02 KB

README.md

File metadata and controls

152 lines (104 loc) · 4.02 KB

Requirements

  • ROS 2 Humble
  • Gazebo classic
  • Rviz2

To run the simlation

Clone the following repository.

git clone https://github.com/HBRS-SDP/ss23-youbot_ros2_nav.git

Copy all folders to ros_ws/src folder

In a terminal, go to root of ros_ws and run the following command to build the packages

colcon build

Terminal 1

source ~/ros_ws/install/setup.bash 
ros2 launch youbot_gazebo start_world.launch.py

The top view of the gazebo world will look like the image shown below

gazebo_world

Terminal 2

source ~/ros_ws/install/setup.bash
ros2 launch youbot_gazebo spawn_youbot_ros2.launch.xml

youbot_spawn

Terminal 3

source ~/ros_ws/install/setup.bash
ros2 run rviz2 rviz2

The rviz config file is present in the location ~/src/youbot_description/rviz/navigation.rviz

rviz2_start

Terminal 4

source ~/ros_ws/install/setup.bash
ros2 run teleop_twist_keyboard teleop_twist_keyboard

From Terminal 4 you can control the robot.

For Mapping

Terminal 5

source ~/ros_ws/install/setup.bash
ros2 launch youbot_navigation online_async_launch.py

Terminal 6

Save the generated map using the following command

cd ~/ros_ws/src/youbot_navigation/maps
source ~/ros_ws/install/setup.bash
ros2 run nav2_map_server map_saver_cli -f {file_name}

Terminal 7

To publish the saved map for navigation

source ~/ros_ws/install/setup.bash
ros2 launch youbot_navigation youbot_nav2_bringup.launch.py

rviz2_map

For Navigation on a saved map

Kill all the executing commands and close all the opened terminals. Then redo the steps from Terminal 1 and Terminal 2. Then run the following commands.

Terminal 3

source ~/ros_ws/install/setup.bash
ros2 launch youbot_navigation youbot_nav2_bringup.launch.py

rviz2_map

Terminal 4

source ~/ros_ws/install/setup.bash
ros2 launch youbot_navigation localization.launch.py

After running the above command in terminal 4 use pose estimate in RVIZ to point the robot is the same direction and position where it is present in the gazebo world. rviz2_loc

After localizing the youbot in rviz2, the resultant view is shown below

rviz2_loc_1

Terminal 5

source ~/ros_ws/install/setup.bash
ros2 launch youbot_navigation navigation.launch.py

rviz2_nav

Then in RVIZ window give a 2D Nav Goal and the robot will navigate to the goal.

rviz2_nav

rviz2_nav1

To navigate the robot to the pre-defined goals (multi-goal navigation) in the map use below commands. The goal coordinates can be found in the .yaml file located at

  • youbot_navigation/maps/navigation_goals_sim.yaml (for simulation)
  • youbot_navigation/maps/navigation_goals.yaml (for real world)

Single Goal Navigation

Terminal 6

source ~/ros_ws/install/setup.bash
ros2 run youbot_navigation single_nav_goal.py
single-goal_rviz2.mp4

Multi Goal Navigation

Terminal 6

source ~/ros_ws/install/setup.bash
ros2 run youbot_navigation multi_nav_goal.py
multi-goal_rviz2.mp4