首页 理论 架构 工程 文档 白皮书 著作 研究 案例 下载 博客 关于 开始使用 →

第24章 SceneCollector

第六篇 Scene 场景采集

第24章 SceneCollector

本章大纲

  1. SceneCollector 定义
  2. 环境采集
  3. 对象采集
  4. 位置采集
  5. 运动采集
  6. 距离采集
  7. 状态采集
  8. Sensor 采集
  9. 场景统一数据
  10. SceneCollector 实际运行

24.1 SceneCollector 定义

**SceneCollector(场景采集器)**是 SAI Framework 中负责从外部环境、对象、设备和传感器持续获取场景信息,并将这些信息组织为统一 Scene 数据的组件。

第23章解决的是:

Scene 是什么。

第24章解决的是:

Scene 是如何被采集出来的。

因此:

Scene
→ 场景数据结构

SceneCollector
→ 场景数据采集与组织

基本关系:

外部世界
   │
   ├── Environment
   ├── Object
   ├── Position
   ├── Motion
   ├── Distance
   ├── State
   └── Sensor
          │
          ▼
    SceneCollector
          │
          ▼
        Scene

SceneCollector 本身不是感知、认知、推理或者决策模块

它主要负责:

获取
 ↓
整理
 ↓
统一
 ↓
形成 Scene

24.2 环境采集

环境是 Scene 的基础组成部分。

SceneCollector 可以从不同信息来源获取环境数据:

TemperatureSensor
HumiditySensor
LightSensor
WeatherSystem
EnvironmentDevice
ExternalSystem

例如:

Temperature = 32℃
Humidity = 65%
Light = 500 lx

Collector 将这些数据组织起来:

EnvironmentCollector
       │
       ├── temperature
       ├── humidity
       └── light
       │
       ▼
Scene.environment

环境采集不是环境判断

例如:

temperature = 32

这是采集结果。

而:

temperature = high

属于进一步的状态判断或认知处理。

因此:

SceneCollector
→ 获取环境数据

Perception / Cognition
→ 解释环境数据

Collector 不应该把“采集”和“理解”混在一起。


24.3 对象采集

Scene 中必须知道当前有哪些对象。

例如房间:

Person
Fan
Table
Chair
TemperatureSensor

道路:

Car
Truck
Pedestrian
TrafficLight
RoadSign

机器人环境:

Robot
Obstacle
Person
Door
Machine

SceneCollector 可以从:

Camera
Sensor
Device
Database
API
External System

获取对象信息。

形成:

ObjectCollector
       │
       ├── Object A
       ├── Object B
       ├── Object C
       └── Object D
       │
       ▼
Scene.objects

对象采集的核心内容

一个对象至少可以包含:

Object
├── id
├── type
├── name
├── properties
├── state
└── position

例如:

{
    id: "person-001",
    type: "person",
    name: "Person",
    state: "present"
}

这里仍然只是采集对象信息

对象真正进入 SAI 的元素、对象和关系体系,还需要后面的 Perception 处理。


24.4 位置采集

场景采集还需要知道:

对象在哪里?

位置可以来自:

GPS
PositionSensor
Camera
Map
RobotSensor
Device
ExternalSystem

简单位置:

location = living-room

坐标位置:

x = 120
y = 80
z = 2

地理位置:

latitude
longitude
altitude

因此 Collector 可以形成:

PositionCollector
       │
       ▼
Object Position
       │
       ▼
Scene

对象与位置

例如:

Person
    position = living-room

车辆:

Car
    position =
    x: 120
    y: 80

机器人:

Robot
    position =
    x: 50
    y: 30
    z: 0

位置是对象的场景属性之一。


24.5 运动采集

静态位置还不够。

SAI 如果需要处理动态场景,还必须知道:

对象是否在运动,以及如何运动。

运动数据可以包括:

speed
direction
acceleration
velocity
movement_state

例如:

Car
├── position = x120,y80
├── speed = 40km/h
├── direction = north
└── movement = moving

或者:

Person
├── speed = 1.2m/s
├── direction = east
└── movement = walking

运动采集流程

MotionSensor
       ↓
Motion Information
       ↓
SceneCollector
       ↓
Object Motion
       ↓
Scene

需要注意:

运动采集
≠
运动预测

Collector 负责:

当前速度
当前方向
当前加速度
当前运动状态

至于:

下一秒会去哪里?
是否会碰撞?
应该如何避让?

属于后续推理和决策。


24.6 距离采集

距离是动态场景的重要数据。

例如:

Robot → Person = 5m
Car → Obstacle = 12m
Person → Door = 3m
Sensor → Object = 8m

距离可以由:

DistanceSensor
LiDAR
UltrasonicSensor
Camera
PositionCalculation

获得。

Collector 将其统一:

DistanceSensor
      ↓
distance information
      ↓
SceneCollector
      ↓
Scene.distance / Relation

距离与关系

距离实际上可以成为对象关系的一部分。

例如:

Robot
   ↓
distance_to = 5m
   ↓
Person

或者:

Car
   ↓
distance_to = 12m
   ↓
Obstacle

因此 SceneCollector 可以采集:

Subject
Relation
Object
Distance

最终进入 Scene 的 Relation 数据。


24.7 状态采集

SceneCollector 还需要获取对象和设备的当前状态。

例如:

Fan = OFF
Person = PRESENT
Sensor = ONLINE

车辆:

Vehicle
├── engine = ON
├── speed = 50
├── brake = OFF
└── battery = 80%

机器人:

Robot
├── mode = AUTO
├── battery = 75%
├── motion = MOVING
└── error = NONE

这些都是 Scene 中的重要状态数据。


状态来源

状态可以来自:

Device
Sensor
Controller
API
System
Feedback

Collector 将它们统一到:

Scene
├── Object State
├── Device State
├── Sensor State
└── Environment State

24.8 Sensor 采集

Sensor 是 SceneCollector 非常重要的数据来源。

可以建立:

SceneCollector
│
├── TemperatureSensor
├── HumiditySensor
├── LightSensor
├── DistanceSensor
├── PositionSensor
├── MotionSensor
└── CustomSensor

不同 Sensor 获取不同数据。


TemperatureSensor

TemperatureSensor
    ↓
32℃

HumiditySensor

HumiditySensor
    ↓
65%

DistanceSensor

DistanceSensor
    ↓
5m

PositionSensor

PositionSensor
    ↓
x=120
y=80

MotionSensor

MotionSensor
    ↓
speed=2m/s
direction=east

Sensor 不等于 SceneCollector

这一点非常重要:

Sensor
→ 产生 / 获取某类数据

SceneCollector
→ 汇总多个来源的数据形成 Scene

例如:

TemperatureSensor ──┐
HumiditySensor ─────┤
LightSensor ────────┤
DistanceSensor ─────┤
PositionSensor ─────┤
MotionSensor ───────┘
          │
          ▼
    SceneCollector
          │
          ▼
        Scene

所以 SceneCollector 是场景数据汇聚层


24.9 场景统一数据

不同 Sensor、Device、System 提供的数据格式可能完全不同。

例如:

TemperatureSensor
→ 32

HumiditySensor
→ 65

PositionSensor
→ [120, 80]

MotionSensor
→ [2, east]

Fan
→ OFF

SceneCollector 的重要工作之一就是把它们统一到 Scene。

最终:

Scene
{
    time: "2026-09-12 14:20:00",

    space: "living-room",

    environment: {
        temperature: 32,
        humidity: 65
    },

    objects: [
        {
            id: "person-001",
            type: "person",
            state: "present"
        },
        {
            id: "fan-001",
            type: "fan",
            state: "off"
        }
    ],

    positions: [
        {
            object: "person-001",
            location: "living-room"
        }
    ],

    motions: [],

    distances: [],

    sensors: [
        "sensor-001"
    ]
}

这样后面的 Perception 不需要分别处理:

TemperatureSensor
HumiditySensor
PositionSensor
Fan
Camera

而是面对一个统一的:

Scene

24.10 SceneCollector 实际运行

下面建立一个完整运行案例。

场景:

客厅

当前存在:

Person
Fan
TemperatureSensor

Sensor 1:温度

TemperatureSensor
→ 32℃

Sensor 2:湿度

HumiditySensor
→ 65%

Device:风扇

Fan
→ OFF

Person

Person
→ PRESENT

Position

Person
→ LivingRoom

SceneCollector 收集

Temperature = 32
Humidity = 65
Fan = OFF
Person = PRESENT
Person.position = LivingRoom

然后建立:

Scene
│
├── Time
│   └── 14:20:00
│
├── Space
│   └── LivingRoom
│
├── Environment
│   ├── Temperature = 32
│   └── Humidity = 65
│
├── Objects
│   ├── Person
│   └── Fan
│
├── Position
│   └── Person → LivingRoom
│
└── State
    ├── Person = PRESENT
    └── Fan = OFF

然后:

SceneCollector
       ↓
Scene
       ↓
Perception

24.11 SceneCollector 的类结构

可以设计一个基础接口:

<?php

namespace SAI\Scene;

interface SceneCollectorInterface
{
    public function collect();
}

环境采集器:

<?php

namespace SAI\Scene;

class EnvironmentCollector implements SceneCollectorInterface
{
    public function collect()
    {
        return array(
            'temperature' => 32,
            'humidity' => 65
        );
    }
}

对象采集器:

<?php

namespace SAI\Scene;

class ObjectCollector implements SceneCollectorInterface
{
    public function collect()
    {
        return array(
            array(
                'id' => 'person-001',
                'type' => 'person',
                'state' => 'present'
            ),
            array(
                'id' => 'fan-001',
                'type' => 'fan',
                'state' => 'off'
            )
        );
    }
}

位置采集器:

<?php

namespace SAI\Scene;

class PositionCollector implements SceneCollectorInterface
{
    public function collect()
    {
        return array(
            'person-001' => 'living-room'
        );
    }
}

24.12 SceneCollector 汇总

可以建立一个总 Collector:

<?php

namespace SAI\Scene;

class SceneCollector
{
    protected $collectors = array();

    public function addCollector(SceneCollectorInterface $collector)
    {
        $this->collectors[] = $collector;
    }

    public function collect()
    {
        $scene = array();

        foreach ($this->collectors as $collector) {
            $data = $collector->collect();

            $scene[] = $data;
        }

        return $scene;
    }
}

调用:

$collector = new SceneCollector();

$collector->addCollector(
    new EnvironmentCollector()
);

$collector->addCollector(
    new ObjectCollector()
);

$collector->addCollector(
    new PositionCollector()
);

$scene = $collector->collect();

数据流:

EnvironmentCollector ──┐
ObjectCollector ───────┤
PositionCollector ─────┤
MotionCollector ───────┤
DistanceCollector ─────┤
StateCollector ────────┤
SensorCollector ───────┘
             │
             ▼
       SceneCollector
             │
             ▼
           Scene

24.13 从多个 InformationSource 到 Scene

结合第21~24章,可以建立完整的数据采集链:

Human ────────────────┐
Sensor ───────────────┤
Device ───────────────┤
Camera ───────────────┤
API ──────────────────┤
Database ─────────────┤
Environment ──────────┘
           │
           ▼
 InformationSource
           │
           ▼
 InformationReceiver
           │
           ▼
       Information
           │
           ▼
    SceneCollector
           │
     ┌─────┼─────┐
     ▼     ▼     ▼
Environment Object Position
     │     │     │
     ├─────┼─────┤
     ▼     ▼     ▼
 Motion Distance State
           │
           ▼
          Scene
           │
           ▼
       Perception

这里可以看出:

InformationReceiver 与 SceneCollector 并不是重复组件。

InformationReceiver
→ 接收信息

SceneCollector
→ 根据多个信息建立场景

24.14 SceneCollector 与 Central

SceneCollector 也不应该代替 Central。

InformationReceiver
       ↓
SceneCollector
       ↓
Scene
       ↓
Central
       ↓
Perception
       ↓
Cognition
       ↓
Reasoning
       ↓
Decision

职责分别是:

InformationReceiver
→ 信息入口

SceneCollector
→ 场景采集

Central
→ Individual 内部协调

Perception
→ 感知

Cognition
→ 认知

因此 SAI 的层次更加清晰。


24.15 SceneCollector 实际运行模型

完整运行可以表示为:

        外部世界
            │
            ▼
     InformationSource
            │
            ▼
     InformationReceiver
            │
            ▼
       Information
            │
            ▼
      SceneCollector
            │
     ┌──────┼──────┐
     ▼      ▼      ▼
 Environment Object Position
     │      │      │
     ├──────┼──────┤
     ▼      ▼      ▼
  Motion Distance State
            │
            ▼
          Scene
            │
            ▼
       Central / Perception

本章小结

SceneCollector 是 SAI Framework 的场景采集与汇总组件

它主要负责:

环境采集
对象采集
位置采集
运动采集
距离采集
状态采集
Sensor 采集
        ↓
统一场景数据
        ↓
Scene

核心关系:

Sensor
→ 获取某类数据

InformationSource
→ 描述数据来源

InformationReceiver
→ 接收进入 SAI 的信息

SceneCollector
→ 汇总多个信息形成场景

Scene
→ 描述特定时间、空间中的整体场景

Perception
→ 对 Scene 进行感知

最终形成:

外部世界
   ↓
InformationSource
   ↓
InformationReceiver
   ↓
Information
   ↓
SceneCollector
   ↓
Scene
   ↓
Perception
   ↓
Cognition

其中最重要的原则是:

SceneCollector 负责“采集和组织场景数据”,不负责“理解场景”。

这一区分能够保证 SAI Framework 后面的 Perception → Cognition → Reasoning → Decision 保持清晰的职责边界。

以上 PHP 代码是本章的设计示例,用于说明 SAI Framework 的 OOP 结构,未作为实际项目代码执行验证。

Leave a Reply

Your email address will not be published. Required fields are marked *