Skip to content

Latest commit

 

History

History
269 lines (207 loc) · 6.74 KB

File metadata and controls

269 lines (207 loc) · 6.74 KB

navi_stack_hw

ROS 2 Navigation project assignment for a simulated autonomous mobile robot in a hospital environment.

Project Goal

The goal of this project is to build and demonstrate a ROS 2 navigation stack for a differential-drive robot in Gazebo Sim. The robot must be able to operate in a hospital-like world, publish simulated sensor data, localize itself with a saved SLAM Toolbox map, and navigate to target poses using Nav2.

Implemented Features

  • Custom mobile robot URDF with four wheels, lidar, IMU, and camera frames.
  • Gazebo Sim integration with differential-drive, lidar, IMU, camera, and joint state plugins.
  • Hospital simulation environment using local AWS RoboMaker model assets.
  • ROS-Gazebo bridges for velocity commands, odometry, laser scan, camera, IMU, joint states, and simulation clock.
  • EKF-based odometry fusion with robot_localization.
  • SLAM Toolbox configuration for mapping and localization.
  • Nav2 configuration for planning, control, costmaps, behavior recovery, and waypoint following.
  • Saved map and pose graph assets for hospital localization.
  • RViz configurations for URDF checking, mapping, and navigation.
  • Optional Python waypoint navigator node that sends NavigateToPose goals.
  • Real time reaction to people moving in the robots environment

Repository Structure

navi_stack_hw/
|-- launch/
|   |-- check_urdf.launch.py
|   |-- world.launch.py
|   |-- spawn_robot.launch.py
|   `-- navigation_with_slam.launch.py
|-- config/
|   |-- ekf.yaml
|   |-- navigation.yaml
|   |-- slam_toolbox_mapping.yaml
|   `-- slam_toolbox_localization.yaml
|-- urdf/
|   |-- nav_bot.urdf
|   |-- nav_bot.gazebo
|   `-- materials.xacro
|-- meshes/
|   |-- base.dae
|   |-- lidar.dae
|   `-- wheel.dae
|-- worlds/
|   |-- hospital.sdf
|   |-- hospital_easy.sdf
|   |-- hospital_half_easy.sdf
|   `-- world.sdf
|-- models/
|   `-- local Gazebo model assets used by the hospital worlds
|-- maps/
|   |-- hospital_map.yaml
|   |-- hospital_map.pgm
|   |-- kesz.posegraph
|   `-- kesz.data
|-- rviz/
|   |-- urdf.rviz
|   |-- rviz.rviz
|   |-- mapping.rviz
|   `-- navigation.rviz
`-- navi_stack_hw_py/
    `-- Python waypoint navigation helper package

System Requirements

This project was prepared for ROS 2 Jazzy on Ubuntu.

Install the main required packages:

sudo apt update
sudo apt install \
  ros-jazzy-navigation2 \
  ros-jazzy-nav2-bringup \
  ros-jazzy-slam-toolbox \
  ros-jazzy-robot-localization \
  ros-jazzy-ros-gz-sim \
  ros-jazzy-ros-gz-bridge \
  ros-jazzy-ros-gz-image \
  ros-jazzy-robot-state-publisher \
  ros-jazzy-joint-state-publisher-gui \
  ros-jazzy-urdf-launch \
  ros-jazzy-xacro \
  ros-jazzy-topic-tools \
  ros-jazzy-rviz2

Build Instructions

From the ROS 2 workspace root:

cd ~/ros2_ws
source /opt/ros/jazzy/setup.bash
colcon build --packages-select navi_stack_hw
source install/setup.bash

The helper package navi_stack_hw_py is currently inside the main project folder. If the waypoint navigator is needed, build it explicitly:

cd ~/ros2_ws
colcon build --base-paths src/navi_stack_hw/navi_stack_hw_py
source install/setup.bash

Running the Project

1. Check the robot model

This opens the robot URDF in RViz:

ros2 launch navi_stack_hw check_urdf.launch.py

2. Start the hospital world

This starts Gazebo Sim with the default hospital world:

ros2 launch navi_stack_hw world.launch.py

The default world is:

hospital_easy.sdf

Other available worlds:

ros2 launch navi_stack_hw world.launch.py world:=hospital_half_easy.sdf
ros2 launch navi_stack_hw world.launch.py world:=hospital.sdf
ros2 launch navi_stack_hw world.launch.py world:=world.sdf

3. Spawn the robot

This starts the world, spawns the robot, starts the ROS-Gazebo bridges, and starts the EKF node:

ros2 launch navi_stack_hw spawn_robot.launch.py

The robot spawn pose can be changed:

ros2 launch navi_stack_hw spawn_robot.launch.py x:=0.0 y:=1.0 yaw:=0.0

4. Start Nav2 with SLAM Toolbox localization

Open a second terminal after the robot has been spawned:

cd ~/ros2_ws
source install/setup.bash
ros2 launch navi_stack_hw navigation_with_slam.launch.py

This launch starts:

  • SLAM Toolbox in localization mode.
  • Nav2 navigation stack.
  • RViz with the navigation configuration.

In RViz, use the Nav2goal tool to send navigation goals.

Optional Waypoint Navigation

The Python helper node sends a sequence of hard-coded Nav2 goals:

ros2 run navi_stack_hw_py hospital_navigator

The waypoint list can be edited in:

navi_stack_hw_py/navi_stack_hw_py/hospital_navigator.py

Important Topics

The simulation and bridge setup provide the main ROS 2 topics used by Nav2:

/clock
/cmd_vel
/odom
/joint_states
/scan
/scan/points
/camera/image
/camera/camera_info
/camera/image/camera_info
imu

Configuration Files

  • config/ekf.yaml: EKF configuration for fusing odometry and IMU data.
  • config/navigation.yaml: Nav2 parameters for planner, controller, costmaps, behaviors, velocity smoother, and waypoint follower.
  • config/slam_toolbox_mapping.yaml: SLAM Toolbox mapping configuration.
  • config/slam_toolbox_localization.yaml: SLAM Toolbox localization configuration using the saved pose graph in maps/.
  • maps/hospital_map.yaml: saved occupancy grid map metadata.

Robot Description

The robot is a four-wheel differential-drive mobile base.

Main simulated sensors:

  • 2D GPU lidar on /scan.
  • IMU on imu.
  • RGB camera on /camera/image.
  • Wheel joint states on /joint_states.
  • Odometry on /odom.

Main dimensions and limits:

  • Base collision size: approximately 0.7 x 0.4 x 0.3 m.
  • Wheel separation: 0.52 m.
  • Wheel radius: 0.1 m.
  • Maximum linear velocity: 0.5 m/s.
  • Maximum angular velocity: 1.0 rad/s.

Notes and Known Issues

  • config/slam_toolbox_localization.yaml currently contains an absolute path to the saved pose graph:
/home/pali/ros2_ws/src/navi_stack_hw/maps/kesz

If the project is moved to another workspace, this path must be updated.

  • The repository contains some :Zone.Identifier files. These are metadata files created during file transfer and are not required by ROS 2.
  • The optional interactive_marker_twist_server node is present in the launch file but currently commented out.

Assignment Demonstration Checklist

For evaluation, the expected demonstration sequence is:

  1. Build the package successfully with colcon build.
  2. Launch and inspect the robot model in RViz.
  3. Launch the hospital Gazebo world.
  4. Spawn the robot and verify /scan, /odom, /tf, and /clock.
  5. Start SLAM Toolbox localization and Nav2.
  6. Send a Nav2goal in RViz and verify that the robot plans and moves toward the selected goal.