🤖 ROS 2 Integration

ROS 2 Integration Guide

FieldSpace Safety Observer integrates with your ROS 2 stack via standard topics. Subscribe to hazard data, publish your perception outputs.

Topic Subscriptions

FieldSpace subscribes to these topics from your autonomy stack:

/ego/pose

Vehicle position and orientation in world frame

geometry_msgs/PoseStamped

/ego/velocity

Linear and angular velocity

geometry_msgs/TwistStamped

/perception/objects

Fused object detections from your perception stack

vision_msgs/Detection3DArray

/camera/image_raw

Raw camera frames (optional, if not using fused objects)

sensor_msgs/Image

Topic Publications

FieldSpace publishes hazard data to these topics:

/fieldspace/hazards

Structured hazard objects with risk scores and TTC

fieldspace_msgs/HazardArray

Rate: 40 Hz | Latency: ~1.7ms avg

/fieldspace/cost_map

Physics-based cost map for planner integration

nav_msgs/OccupancyGrid

Grid: 256×64 | Resolution: 0.25m

/fieldspace/safety_envelope

Safe boundary polygon for the ego vehicle

geometry_msgs/PolygonStamped

/fieldspace/diagnostics

System health and performance metrics

diagnostic_msgs/DiagnosticArray

HazardArray Message Definition

# fieldspace_msgs/HazardArray.msg
std_msgs/Header header

# Array of detected hazards
Hazard[] hazards

# Overall risk level (0.0 - 1.0)
float32 aggregate_risk

# Processing latency in milliseconds
float32 latency_ms

---

# fieldspace_msgs/Hazard.msg
string id                          # Unique hazard identifier
string type                        # "moving_object", "static_obstacle", "occlusion"
float32 risk_score                 # Risk level (0.0 - 1.0)
float32 time_to_collision          # TTC in seconds (-1 if not applicable)

# Position in ego frame
geometry_msgs/Point position

# Velocity in ego frame
geometry_msgs/Vector3 velocity

# Predicted trajectory (optional)
geometry_msgs/Point[] predicted_path

# Hazard cone vertices
geometry_msgs/Point[] cone_vertices

Launch Configuration

Example Launch File

# fieldspace_launch.py
from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
    return LaunchDescription([
        Node(
            package='fieldspace_safety',
            executable='safety_observer',
            name='fieldspace_observer',
            parameters=[{
                'grid_width': 256,
                'grid_height': 64,
                'grid_resolution': 0.25,
                'update_rate': 40.0,
                'input_mode': 'fused_objects',  # or 'raw_camera'
            }],
            remappings=[
                ('/ego/pose', '/your_stack/ego_pose'),
                ('/ego/velocity', '/your_stack/ego_velocity'),
                ('/perception/objects', '/your_stack/detections'),
            ]
        )
    ])

Configuration Parameters

ParameterDefaultDescription
grid_width256Cost map grid width
grid_height64Cost map grid height
grid_resolution0.25Meters per cell
update_rate40.0Output frequency (Hz)
input_modefused_objectsInput source mode
risk_threshold0.3Minimum risk to publish

Ready to Integrate?

Contact us for the full ROS 2 package, custom message definitions, and integration support.