- Add comprehensive project overview and features list - Restructure architecture section with detailed explanations - Document robot states and control workflow - Add ROS communication (subscribers/publishers) details - Include obstacle avoidance algorithm explanation - Add project structure diagram - Clarify dependencies and build instructions - Expand installation and configuration sections - Add testing and running instructions Co-Authored-By: Claude Haiku 4.5 <[email protected]> Claude-Session: https://claude.ai/code
Tangent Planner
A ROS-based autonomous navigation and path planning system with obstacle avoidance capabilities for mobile robots using Time-of-Flight (ToF) sensors.
Overview
The Tangent Planner implements a tangent bug algorithm for autonomous robot navigation, allowing robots to navigate to goal positions while avoiding obstacles using ToF sensor feedback. The system uses velocity control with intelligent state management to handle different navigation scenarios.
Features
- Autonomous Navigation: Navigate robots from start to goal position automatically
- Obstacle Avoidance: Detect and avoid obstacles using ToF sensor data
- Boundary Following: Follow obstacle boundaries to circumnavigate obstacles
- State Machine: Robust state management for different navigation behaviors
- ROS Integration: Full ROS1 integration with standard message types
- Parameter Configuration: Flexible controller tuning via configuration files
- Unit Tests: Comprehensive Google Test suite for algorithm validation
Architecture
Robot States
The robot operates in five distinct states:
- StopAtGoal - Robot has reached the goal position
- TurnToGoal - Robot orients toward the goal before moving (when angular error exceeds threshold)
- MotionToGoal - Robot moves toward the goal with computed velocity
- OrientToGoal - Robot position is correct but orientation needs adjustment
- FollowBoundary - Robot follows obstacle boundary to navigate around obstacles
Core Workflow
computeVelocityCommand() executes four main steps:
- Calculate Errors - Compute x, y, and angular differences between current pose and goal
- Update State - Transition to appropriate state based on errors and obstacles
- Update Controller - Configure controller parameters based on current state
- Update Velocity - Calculate linear and angular velocity using nonlinear control law
ROS Communication
Subscribers
- Odometry (
/odom) - Receives Pose2D messages (x, y, θ) for robot localization - ToF Scanner (
/scan) - Receives range data (field of view, ranges, min/max distance)
Publishers
- Velocity Command (
/cmd_vel) - Publishes twist messages (linear x, linear y, angular z)
Obstacle Avoidance Algorithm
The system implements a boundary-following algorithm with history-based decision making:
- Robot begins motion toward goal
- Upon obstacle detection, switches to FollowBoundary state
- Saves historical robot and obstacle positions for trajectory planning
- Decides next movement based on accumulated history
- Exits FollowBoundary when path to goal is clear
- Returns to MotionToGoal until reaching destination
Controllers
Motion Controller
- Handles states requiring position changes (x, y movement)
- Tunable parameters:
b,c(gains) - Computed parameters:
k1,k2,k3(derived from gains)
Turn Controller
- Handles pure rotation movements
- Tunable parameters:
kp_(proportional gain),kp_i_(integral gain)
Project Structure
.
├── include/
│ ├── tangent_planner.h # Core algorithm implementation
│ ├── tangent_planner_node.h # ROS node wrapper
│ └── parameters_helper.h # Configuration management
├── src/
│ ├── main.cpp # Application entry point
│ ├── tangent_planner.cpp # Algorithm implementation
│ ├── tangent_planner_node.cpp # ROS node implementation
│ └── gtest.cpp # Unit tests
├── launch/ # ROS launch files
├── param/ # Configuration parameters
├── srv/ # ROS service definitions
├── CMakeLists.txt # CMake build configuration
├── package.xml # ROS package metadata
└── Dockerfile # Docker build environment
Dependencies
ROS Packages
roscpp- C++ ROS client librarystd_msgs- Standard ROS message typesnav_msgs- Navigation message typesgeometry_msgs- Geometry message typessensor_msgs- Sensor message types (for scanner data)
Build Requirements
- CMake 2.8.3+
- GCC/G++ compiler
- catkin build system
- Google Test (for unit tests)
Building
From Source with catkin
# Create and navigate to catkin workspace
mkdir -p catkin_ws/src
cd catkin_ws/src
# Clone repository
git clone <repository-url> tangent_planner
cd ..
# Build
catkin_make
source devel/setup.bash
With Docker
Build a Debian package using Docker:
sudo ./release.sh
Note: Requires Docker to be installed on your system.
Installation
From Debian Package
- Generate package:
sudo ./release.sh - Install package:
dpkg -i tangent_planner_*.deb - Source ROS setup:
source /opt/ros/<distro>/setup.bash - Run the node with your ROS configuration
Running the Node
rosrun tangent_planner tangent_planner
Or use the provided launch files:
roslaunch tangent_planner <launch-file-name>.launch
Configuration
Parameter Files
Configuration parameters are located in the param/ directory. Adjust controller gains and thresholds:
- Motion controller gains (
b,c,k1,k2,k3) - Turn controller gains (
kp_,kp_i_) - State transition thresholds
- Obstacle following parameters
Services
The package provides several ROS services:
nav_path_start- Start navigation to goalnav_path_stop- Stop current navigationnav_get_patrol_name- Get current patrol/goal namenav_get_status- Get current navigation statusnav_low_bat- Handle low battery conditions
Testing
Run the unit tests:
catkin_make run_tests
# or
rosrun tangent_planner tangent_planner_test
License
See LICENSE file for details.
Maintainer
- Gfuse ([email protected])