{"id":29179474,"url":"https://github.com/tugcantopaloglu/navigation-plugin-ros","last_synced_at":"2026-04-20T19:07:01.928Z","repository":{"id":302034206,"uuid":"1011011476","full_name":"tugcantopaloglu/navigation-plugin-ros","owner":"tugcantopaloglu","description":"A mapping and navigation plug-in for ROS Noetic.","archived":false,"fork":false,"pushed_at":"2025-06-30T07:18:59.000Z","size":4380,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-30T08:28:45.397Z","etag":null,"topics":["cpp","navigation","robotics","ros"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tugcantopaloglu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-30T07:07:35.000Z","updated_at":"2025-06-30T07:19:03.000Z","dependencies_parsed_at":"2025-06-30T08:39:29.571Z","dependency_job_id":null,"html_url":"https://github.com/tugcantopaloglu/navigation-plugin-ros","commit_stats":null,"previous_names":["tugcantopaloglu/navigation-plugin-ros"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tugcantopaloglu/navigation-plugin-ros","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tugcantopaloglu%2Fnavigation-plugin-ros","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tugcantopaloglu%2Fnavigation-plugin-ros/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tugcantopaloglu%2Fnavigation-plugin-ros/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tugcantopaloglu%2Fnavigation-plugin-ros/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tugcantopaloglu","download_url":"https://codeload.github.com/tugcantopaloglu/navigation-plugin-ros/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tugcantopaloglu%2Fnavigation-plugin-ros/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263021812,"owners_count":23401148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","navigation","robotics","ros"],"created_at":"2025-07-01T19:02:43.945Z","updated_at":"2026-04-20T19:06:56.898Z","avatar_url":"https://github.com/tugcantopaloglu.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ROS Navigation Plugins\n\nThis project contains ROS navigation plugins developed for **BLM6191 Robots – Assignment 4**. It consists of three main ROS packages:\n\n* a global planner (`coverage_planner`)\n* a local planner (`pure_pursuit_local_planner`)\n* an auxiliary Python script (see below)\n\n## Overview\n\n### 1. Global Planner: `coverage_planner`\n\nThis plugin implements the `nav_core::BaseGlobalPlanner` interface.  \nIts main purpose is to generate a **full-coverage path** inside a four‑corner area defined by a `geometry_msgs/Polygon` message, taking the specified robot radius into account.  \nThe resulting path follows a simple **boustrophedon** (zig‑zag) pattern.\n\n**How it works**\n\n1. Listens on the ROS topic `/coverage_area_polygon` for a polygon message containing four corner points.  \n2. Computes an effective scanning area using the polygon’s bounding box, the `robot_radius`, and the `coverage_step_factor`.  \n3. Calculates the zig‑zag way‑points that the robot should traverse within this area.  \n4. Publishes the generated path on `/move_base/CoveragePlanner/coverage_plan` as a `nav_msgs/Path`, making it available to the `move_base` stack.\n\n### 2. Local Planner: `pure_pursuit_local_planner`\n\nThis plugin implements the `nav_core::BaseLocalPlanner` interface and uses the **Pure Pursuit** path‑tracking algorithm described by R. Craig Coulter.\n\n**How it works**\n\n1. Receives the `global_plan_` generated by the global planner.  \n2. Retrieves the robot’s current pose via `costmap_2d::Costmap2DROS::getRobotPose`.  \n3. On the global plan, selects a look‑ahead point located `lookahead_distance_` ahead of the robot (interpolating between path segments if necessary).  \n4. Computes the required curvature to reach that point:  \n\n   ```math\n   curvature = \\frac{2 \\; y_{error}}{L_{actual}^2}\n   ```\n\n5. Generates linear and angular velocity commands in `geometry_msgs/Twist` format using the calculated curvature and the predefined `linear_velocity_`.  \n   *Angular velocity is limited by `max_angular_velocity_`.*  \n6. Stops the robot when it is within `goal_dist_tolerance_` of the final point on the global plan.\n\n## Dependencies\n\nThe following ROS packages must be installed (they are included in a standard TurtleBot3 setup):\n\n* `roscpp`\n* `nav_core`\n* `geometry_msgs`\n* `costmap_2d`\n* `pluginlib`\n* `nav_msgs`\n* `tf2_ros`, `tf2_geometry_msgs`\n* `angles`\n* `base_local_planner`\n* `turtlebot3_gazebo` (for simulation)\n* `turtlebot3_slam` (for SLAM, e.g. `gmapping`)\n* `turtlebot3_navigation` (for `move_base` and configs)\n* `slam_gmapping` (if not already installed)\n\n## Installation\n\n1. Copy the `coverage_planner` and `pure_pursuit_local_planner` packages into `robotlar_ws/src`.  \n2. Make sure the `turtlebot3_simulations` package is installed.  \n3. Build your Catkin workspace:\n\n   ```bash\n   cd ~/catkin_ws\n   catkin_make\n   source devel/setup.bash\n   ```\n\n## Running the Demo\n\nThe steps below show an example run with a **TurtleBot3 Waffle** in the **Willow Garage** world.\n\n1. **Start Gazebo simulation** (new terminal):\n\n   ```bash\n   export TURTLEBOT3_MODEL=waffle   # or burger, waffle_pi\n   roslaunch turtlebot3_gazebo turtlebot3_willowgarage.launch\n   ```\n\n2. **Start SLAM (mapping)** (new terminal):\n\n   ```bash\n   export TURTLEBOT3_MODEL=waffle\n   roslaunch turtlebot3_slam turtlebot3_slam.launch\n   ```\n\n3. **Manually drive the robot to build a map**  \n   (e.g. with `turtlebot3_teleop_key`) until at least two rooms are mapped.\n\n4. **Launch `move_base` with the custom planners** (new terminal)  \n   Edit `move_base.launch` inside `turtlebot3_navigation` as follows:\n\n   ```xml\n   \u003claunch\u003e\n     \u003cnode pkg=\"move_base\" type=\"move_base\" respawn=\"false\" name=\"move_base\" output=\"screen\"\u003e\n       \u003cparam name=\"base_global_planner\" value=\"coverage_planner/CoveragePlanner\"/\u003e\n       \u003cparam name=\"base_local_planner\" value=\"pure_pursuit_local_planner/PurePursuitLocalPlanner\"/\u003e\n\n       \u003crosparam ns=\"move_base/CoveragePlanner\"\u003e\n         \u003cparam name=\"polygon_topic\"        value=\"/coverage_area_polygon\"/\u003e\n         \u003cparam name=\"robot_radius\"         value=\"0.15\"/\u003e\n         \u003cparam name=\"coverage_step_factor\" value=\"0.8\"/\u003e\n       \u003c/rosparam\u003e\n\n       \u003crosparam ns=\"move_base/PurePursuitLocalPlanner\"\u003e\n         \u003cparam name=\"lookahead_distance\"   value=\"0.4\"/\u003e\n         \u003cparam name=\"linear_velocity\"      value=\"0.15\"/\u003e\n         \u003cparam name=\"max_angular_velocity\" value=\"1.0\"/\u003e\n         \u003cparam name=\"goal_dist_tolerance\"  value=\"0.05\"/\u003e\n       \u003c/rosparam\u003e\n\n     \u003c/node\u003e\n   \u003c/launch\u003e\n   ```\n\n   Then launch `move_base`:\n\n   ```bash\n   export TURTLEBOT3_MODEL=waffle\n   roslaunch turtlebot3_navigation move_base.launch\n   ```\n\n   *Screenshot: planners initialized*  \n   ![Move Base Start‑up](images/move_base_terminal_init.png)\n\n5. **Publish the coverage‑area polygon**\n\n   *Method 1 – `rostopic pub`* (new terminal)  \n   Pick four corner points in RViz and adapt:\n\n   ```bash\n   rostopic pub /coverage_area_polygon geometry_msgs/Polygon '{points: [\n     {x: X1, y: Y1, z: 0.0},\n     {x: X2, y: Y2, z: 0.0},\n     {x: X3, y: Y3, z: 0.0},\n     {x: X4, y: Y4, z: 0.0}\n   ]}' -1\n   ```\n\n   Example:\n\n   ```bash\n   rostopic pub /coverage_polygon geometry_msgs/Polygon '{points: [\n     {x: 9.76, y: -1.8,  z: -0.00534},\n     {x: 9.54, y: -2.27, z: -0.00534},\n     {x: 8.76, y: -0.961,z: -0.00534},\n     {x: 8.53, y: -2.26, z: -0.00534}\n   ]}' -1\n   ```\n\n   *Method 2 – helper Python node*  \n   Run:\n\n   ```bash\n   python3 ~/hw4_extra/polygon_publisher.py\n   ```\n\n   Then select four points with RViz’s **“Publish Point”** tool.\n\n6. **Visualize the global plan in RViz**  \n   *Add → By topic → `/move_base/CoveragePlanner/coverage_plan`.*\n\n7. **Send a navigation goal (2D Nav Goal)**  \n   Click inside (or near) the published polygon.\n\n8. **Watch the robot follow the generated path**\n\n## Example Output and Behavior\n\nFor quick testing, open separate terminals and run:\n\n```bash\nroslaunch turtlebot3_gazebo turtlebot3_willowgarage.launch      # Gazebo\nroslaunch turtlebot3_slam turtlebot3_slam.launch                # SLAM\nroslaunch turtlebot3_navigation move_base.launch                # planners\nroslaunch turtlebot3_teleop turtlebot3_teleop_key.launch        # teleop\n```\n\nAfter SLAM mapping, the robot was driven as shown:\n\n![img](images/hw4_1.png)\n\nThe following polygon was published:\n\n![img](images/hw4_3.png)\n\n`move_base` confirms that the planners are active:\n\n![img](images/hw4_5.png)\n\nBefore giving a 2D Nav Goal:\n\n![img](images/hw4_6.png)\n\nRobot position on the main map:\n\n![img](images/hw4_7.png)\n\nThe planners guide the robot around the selected room:\n\n![img](images/hw4_9.png)\n\nTerminal output shows each step:\n\n![img](images/hw4_10.png)\n\nFinally, the robot finishes covering the room:\n\n![img](images/hw4_11.png)\n\n\u003e **Note** Choose polygons large enough; very small areas may trap the TurtleBot.\n\nWhen the Python script is used, it automates polygon publication and outputs:\n\n![img](images/hw4_12.png)\n\n### Running a Second Time\n\nAfter the first plan is finished (or the robot is stopped), giving a new **2D Nav Goal** triggers `CoveragePlanner` to generate a fresh coverage path starting from the robot’s current pose.\n\n## Conclusion\n\nWith these custom global and local planners, full‑coverage navigation has been successfully demonstrated in the TurtleBot3 simulation. `CoveragePlanner` can produce complete coverage paths for a defined polygonal area, and `PurePursuitLocalPlanner` follows those paths effectively. The auxiliary Python script removes the need for manual polygon publication.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftugcantopaloglu%2Fnavigation-plugin-ros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftugcantopaloglu%2Fnavigation-plugin-ros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftugcantopaloglu%2Fnavigation-plugin-ros/lists"}