Convert Figma logo to code with AI

ros-planning logonavigation

ROS Navigation stack. Code for finding where the robot is and how it can get somewhere else.

2,327
1,792
2,327
128

Top Related Projects

Universal grid map library for mobile robotic mapping

ROS 2 Navigation Framework and System

Quick Overview

The ros-planning/navigation repository is a collection of packages for robot navigation in ROS (Robot Operating System). It provides tools for path planning, obstacle avoidance, and localization, enabling autonomous navigation for mobile robots in various environments.

Pros

  • Comprehensive suite of navigation tools and algorithms
  • Well-integrated with ROS ecosystem
  • Actively maintained and widely used in robotics community
  • Supports various robot configurations and sensor types

Cons

  • Can be complex to set up and configure for specific robot platforms
  • Performance may vary depending on the quality of sensor data and map accuracy
  • Some packages may have dependencies on older ROS versions
  • Limited support for dynamic environments and multi-robot scenarios

Code Examples

  1. Setting up a basic move_base action client:
import rospy
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
import actionlib

def move_to_goal(x, y, w):
    client = actionlib.SimpleActionClient('move_base', MoveBaseAction)
    client.wait_for_server()

    goal = MoveBaseGoal()
    goal.target_pose.header.frame_id = "map"
    goal.target_pose.header.stamp = rospy.Time.now()
    goal.target_pose.pose.position.x = x
    goal.target_pose.pose.position.y = y
    goal.target_pose.pose.orientation.w = w

    client.send_goal(goal)
    client.wait_for_result()

    return client.get_state()
  1. Subscribing to odometry data:
import rospy
from nav_msgs.msg import Odometry

def odometry_callback(msg):
    position = msg.pose.pose.position
    orientation = msg.pose.pose.orientation
    print(f"Position: ({position.x}, {position.y}, {position.z})")
    print(f"Orientation: ({orientation.x}, {orientation.y}, {orientation.z}, {orientation.w})")

rospy.init_node('odometry_subscriber')
rospy.Subscriber('/odom', Odometry, odometry_callback)
rospy.spin()
  1. Setting costmap parameters:
import rospy

rospy.set_param('/move_base/global_costmap/inflation_radius', 0.55)
rospy.set_param('/move_base/local_costmap/inflation_radius', 0.55)
rospy.set_param('/move_base/global_costmap/obstacle_layer/observation_sources', 'scan')
rospy.set_param('/move_base/local_costmap/obstacle_layer/observation_sources', 'scan')

Getting Started

  1. Install ROS and create a catkin workspace
  2. Clone the navigation stack:
    cd ~/catkin_ws/src
    git clone https://github.com/ros-planning/navigation.git
    
  3. Install dependencies:
    rosdep install --from-paths src --ignore-src -r -y
    
  4. Build the workspace:
    cd ~/catkin_ws
    catkin_make
    
  5. Source the setup file:
    source devel/setup.bash
    
  6. Launch the navigation stack (example for TurtleBot):
    roslaunch turtlebot_navigation amcl_demo.launch
    

Competitor Comparisons

Universal grid map library for mobile robotic mapping

Pros of grid_map

  • Specialized for 2D and 2.5D grid maps, offering efficient data structures and operations
  • Provides a rich set of tools for map manipulation, including filters and iterators
  • Supports various map types (elevation, variance, color) in a single grid map object

Cons of grid_map

  • More focused on map representation and manipulation, less on full navigation stack
  • May require integration with other packages for complete robot navigation
  • Learning curve for developers unfamiliar with grid-based mapping concepts

Code Comparison

navigation:

void GlobalPlanner::makePlan(const geometry_msgs::PoseStamped& start, 
                             const geometry_msgs::PoseStamped& goal,
                             std::vector<geometry_msgs::PoseStamped>& plan)
{
    // Plan generation logic
}

grid_map:

grid_map::GridMap map({"elevation", "variance"});
map.setGeometry(grid_map::Length(1.0, 1.0), 0.01);
for (grid_map::GridMapIterator it(map); !it.isPastEnd(); ++it) {
    map.at("elevation", *it) = /* elevation value */;
}

The navigation code focuses on path planning, while grid_map emphasizes map creation and manipulation. navigation provides a broader set of tools for robot navigation, whereas grid_map excels in efficient grid-based map operations.

ROS 2 Navigation Framework and System

Pros of Navigation2

  • Built for ROS 2, taking advantage of its improved performance and features
  • Modular architecture allowing easier customization and extension
  • Supports behavior trees for more flexible and complex navigation behaviors

Cons of Navigation2

  • Steeper learning curve due to increased complexity
  • May require more computational resources for advanced features
  • Still evolving, potentially less stable than the mature Navigation stack

Code Comparison

Navigation (C++):

void GlobalPlanner::makePlan(const geometry_msgs::PoseStamped& start, 
                             const geometry_msgs::PoseStamped& goal,
                             std::vector<geometry_msgs::PoseStamped>& plan)
{
  plan.clear();
  // ... planning logic ...
}

Navigation2 (C++):

nav2_util::CallbackReturn
PlannerServer::on_activate(const rclcpp_lifecycle::State & state)
{
  createBond();
  auto node = shared_from_this();
  planner_ = planner_loader_.createUniqueInstance(planner_id_);
  // ... initialization ...
  return nav2_util::CallbackReturn::SUCCESS;
}

The Navigation2 code showcases its modular approach with plugin loading and lifecycle management, while Navigation uses a more straightforward function-based approach.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

ROS Navigation Stack

A 2D navigation stack that takes in information from odometry, sensor streams, and a goal pose and outputs safe velocity commands that are sent to a mobile base.

  • AMD64 Debian Job Status: Build Status

Related stacks:

For discussion, please check out the https://groups.google.com/group/ros-sig-navigation mailing list.