Skip to content

vefak/CustomCostmapPlugin-SocialNavigation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Unity Costmap Plugin (ROS 2)

This repository contains a custom ROS 2 Nav2 costmap plugin that injects dynamic humans and obstacles published from Unity directly into the local costmap. The plugin is designed to support socially-aware navigation, human–robot interaction, and simulation-based research workflows.

Overview

Standard Nav2 costmaps are primarily designed for static maps and sensor-based obstacle layers (e.g., LiDAR, depth cameras). In simulation-heavy setups—especially when using Unity as a human and environment simulator—dynamic agents such as humans are often published externally and are not naturally integrated into the costmap.

This plugin addresses that gap by:

Subscribing to Unity-published dynamic agents

Converting their poses and shapes into costmap obstacles

Updating the local costmap in real time

Features

✅ Custom Nav2 Costmap Layer Plugin

✅ Real-time integration of dynamic humans and obstacles

✅ Supports multiple agents published as separate topics

✅ Designed for social navigation research

✅ Compatible with custom local planners (e.g., Pure Pursuit, social-force–based planners)

✅ Works independently of global costmaps if needed

System Architecture

Unity ├── Human Avatars ├── Dynamic Objects │ ▼ ROS 2 Topics (Twist + Transform) │ ▼ Unity Costmap Plugin │ ▼ Nav2 Local Costmap │ ▼ Local Planner / Controller

Input Data

The plugin consumes dynamic agent data published from Unity, typically containing:

Position (x, y)

Orientation

Velocity (optional)

Agent size / footprint (configurable)

The data is injected into the local costmap as dynamic obstacles.

Use Cases

🤖 Social navigation experiments

🚶 Human-aware path planning

🧪 Simulation-based HRI research

🎮 Unity–ROS 2 integration workflows

📊 Evaluation of social navigation metrics

Build & Installation

Clone into your ROS 2 workspace:

cd ~/ros2_ws/src
git clone https://github.com/vefak/CustomCostmapPlugin-SocialNavigation

Build the workspace:

cd ~/ros2_ws
colcon build --symlink-install

Source the workspace:

source install/setup.bash

Configuration

Add the plugin to your Nav2 local costmap parameters:

local_costmap:
  ros__parameters:
    plugins: ["unity_layer"]
    unity_layer:
      plugin: "unity_costmap_plugin::UnityLayer"
      enabled: true

Additional parameters (topics, agent radius, update rate, etc.) can be configured in the same file.

Notes & Limitations

This plugin is intended for local costmaps.

Memory safety is critical—ensure proper bounds checking when modifying costmap cells.

Designed primarily for simulation (Unity), not raw sensor input.

Tested with ROS 2 and Nav2-based navigation stacks.

About

ROS 2 Nav2 costmap plugin for integrating dynamic obstacles published from Unity into the local costmap for social navigation research.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors