Skip to content

ROS-based ASV simulation using TurtleBot3 (Noetic). Features OpenCV obstacle detection, A* path planning in C++/Python, and unit tests. Adapted for maritime challenges, showcasing autonomous systems skills. Setup: ROS Noetic, roslaunch asv_simulation asv_world.launch

License

Notifications You must be signed in to change notification settings

jeffla/ASV-Simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚤 ASV-Simulation

A ROS Noetic + Gazebo 11 simulation for an Autonomous Surface Vessel (ASV) with real-time perception, state control, and C++ A* path planning. Built as a rapid showcase project for generalist robotics roles.


🎥 Demo Videos

🔴 Red Object Detection (Stop when centered)
Watch a short demonstration of the system detecting a red object in simulation and commanding the robot to stop when it is centered in view.
👉 Watch on YouTube

🛑 Detection + Avoidance + Resume
Watch a demonstration of the autonomous system detecting a red object, executing an avoidance maneuver when it's too close, and resuming patrol when safe.
👉 Watch on YouTube

🧭 A* Path Planning Visualization
See the A* path planning module in action as it computes an optimal path through a grid-based environment and publishes the result to RViz.
👉 Watch on YouTube


📌 Project Goals

  • Build a functional ASV simulator using ROS Noetic and Gazebo 11
  • Integrate red-object detection using OpenCV
  • Implement real-time state changes (approach, avoid, patrol)
  • Add a C++ A* path planner with ROS visualization
  • Showcase ability to learn and apply robotics skills rapidly

⚙️ Features

  • ✅ TurtleBot3-based simulation in Gazebo
  • ✅ Real-time red object detection using OpenCV + ROS camera feed
  • ✅ Behavior state machine with patrol, stop, and avoidance
  • ✅ C++ implementation of A* path planning
  • ✅ Visualization of path in RViz using nav_msgs/Path
  • ✅ Unit testing with Google Test
  • 🔜 Full control loop integration with Gazebo vessel model
  • 🔜 Single-command launch automation

🗂️ Directory Structure

ASV-Simulation/
├── scripts/           # Python ROS nodes (e.g., red object detector)
├── src/               # C++ ROS nodes (e.g., astar_planner)
├── test/              # Unit tests using Google Test
├── launch/            # Launch files
├── models/            # Custom Gazebo models
├── worlds/            # Custom Gazebo world file(s)
├── urdf/              # Optional robot description
├── CMakeLists.txt     # ROS build script
├── package.xml        # ROS package metadata
└── README.md

🚀 How to Run

✅ Prerequisites

  • Ubuntu 20.04
  • ROS Noetic
  • Gazebo 11
  • Dependencies:
    • cv_bridge
    • rqt_image_view
    • turtlebot3, turtlebot3_gazebo

1️⃣ Build the Workspace

cd ~/catkin_ws/src
git clone https://github.com/yourusername/ASV-Simulation.git asv_simulation
cd ~/catkin_ws
catkin_make
source devel/setup.bash

2️⃣ Launch the Gazebo World

export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_gazebo turtlebot3_world.launch

Ensure a red object is visible to the robot. You can place one manually or modify the .world file.


3️⃣ Start Red Buoy Detector

rosrun asv_simulation red_buoy_detector.py

This will:

  • Subscribe to /image_raw
  • Convert the feed with cv_bridge
  • Detect red objects using HSV masking
  • Show OpenCV output window labeled "Red Detection"

Use this to verify detection:

rqt_image_view /image_raw

4️⃣ Run the A* Path Planner

rosrun asv_simulation astar_planner

This node:

  • Computes a path from (0, 0) to (9, 9) in a hardcoded grid
  • Publishes the path as nav_msgs/Path to /asv_path
  • Can be visualized in RViz (fixed frame = map, display type = Path)

🧪 Testing

Unit tests are provided using Google Test.

To run them:

catkin_make run_tests

Included Tests:

  • ✅ Path exists from (0,0) to (9,9)
  • ✅ Path is trivial if start == goal
  • ✅ Path is empty if start point is blocked

These confirm algorithm correctness and boundary behavior.


🔍 Implementation Highlights

Red Buoy Detection

  • Implemented in scripts/red_buoy_detector.py
  • Uses cv_bridge and OpenCV to extract red regions from HSV color space
  • Triggers state transitions based on object proximity and centering

A* Path Planning

  • Implemented in src/astar.cpp and astar_planner.cpp
  • Uses classic A* with Euclidean heuristic
  • Publishes nav_msgs/Path for visualization
  • Separated into astar.h/cpp for testability and modularity

Testing

  • Google Test framework in test/test_astar.cpp
  • Validates planning logic and rejection of invalid conditions

✍️ Author

Jeff Lacey
Software Engineer – iOS, Robotics, Autonomous Systems
GitHub: github.com/jeffla

This project was created as a 7-day fast-track demonstration. Feedback welcome!

About

ROS-based ASV simulation using TurtleBot3 (Noetic). Features OpenCV obstacle detection, A* path planning in C++/Python, and unit tests. Adapted for maritime challenges, showcasing autonomous systems skills. Setup: ROS Noetic, roslaunch asv_simulation asv_world.launch

Resources

License

Stars

Watchers

Forks

Packages

No packages published