Skip to content

类型定义

了解 RobotMap 支持的各种数据类型和格式。

Point

坐标点类型。

typescript
type Point = {
  /** X坐标 */
  x: number
  /** Y坐标 */
  y: number
}

Direction

方向类型。

typescript
type Direction = 'horizontal' | 'vertical'

MapState

地图状态信息。

typescript
type MapState = {
  /** 地图ID */
  id: number
  /** 地图状态 */
  status: boolean
  /** 分辨率 */
  resolution: number
  /** 地图宽度 */
  width: number
  /** 地图高度 */
  height: number
  /** 原点坐标 */
  origin: Point
  /** 充电桩坐标 */
  charger: Point
  /** 充电桩方向 */
  chargerDirection: number
  /** 版本号 */
  version?: number
}

PathState

路径状态信息。

typescript
type PathState = {
  /** 路径ID */
  id: number
  /** 路径类型 */
  type: number
  /** 方向 */
  direction: number
  /** 计数 */
  count: number
  /** 初始化标志 */
  initFlag: number
  /** 机器人当前位置 */
  robotPosition: Point | null
}

ZoneParam

区域参数类型。

typescript
type ZoneParam = {
  /** 区域ID */
  id: string
  /** 点集合,组成区域的顶点坐标 */
  points: Point[]
}

VirtualWallParam

虚拟墙参数类型。

typescript
type VirtualWallParam = {
  /** 虚拟墙ID */
  id: string
  /** 点集合,包含起点和终点坐标 */
  points: Point[] // 长度必须为 2
}

SpotParam

定点清扫参数类型。

typescript
type SpotParam = {
  /** 定点清洁ID */
  id: string
  /** 点坐标 */
  point: Point
}

RoomProperty

房间属性类型,定义房间的清洁参数和显示信息。

typescript
type RoomProperty = {
  /** 房间ID */
  id: number
  /** 房间名称 */
  name: string
  /** 清洁次数 */
  cleanTimes: number
  /** 清洁顺序 */
  order: number
  /** 地板类型 */
  floorType: number
  /** Y字形拖地 */
  yMop: number
  /** 吸力等级 */
  suction: number
  /** 水箱等级 */
  cistern: number
  /** 清洁模式 */
  cleanMode: number
}

RoomData

房间显示数据类型。

typescript
type RoomData = RoomProperty & {
  /** 房间中心点 */
  centerPoint: Point | null
  /** 索引 */
  index: number
}

CustomElementParam

自定义元素参数类型。

typescript
type CustomElementParam = {
  /** 元素ID */
  id: string
  /** 元素类型 */
  type: 'image' | 'text' | 'circle' | 'rectangle'
  /** X坐标 */
  x: number
  /** Y坐标 */
  y: number
  /** 宽度 */
  width?: number
  /** 高度 */
  height?: number
  /** 图片源(type为image时) */
  src?: string
  /** 文本内容(type为text时) */
  text?: string
  /** 颜色 */
  color?: string
  /** 是否可交互 */
  interactive?: boolean
}

DetectedObjectParam

检测物体参数类型。

typescript
type DetectedObjectParam = {
  /** 物体ID */
  id: string
  /** 图片源 */
  src: string
  /** X坐标 */
  x: number
  /** Y坐标 */
  y: number
  /** 宽度 */
  width: number
  /** 高度 */
  height: number
}