File size: 1,450 Bytes
3aea7c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import type IUrdfBox from "./IUrdfBox";
import type IUrdfCylinder from "./IUrdfCylinder";
import type IUrdfMesh from "./IUrdfMesh";

// 1) Box‐type visual
interface IUrdfVisualBox {
  name: string;
  origin_xyz: [x: number, y: number, z: number];
  origin_rpy: [roll: number, pitch: number, yaw: number];
  geometry: IUrdfBox;
  material?: {
    name: string;
    color?: string;
    texture?: string;
  },
  type: 'box';
  // optional RGBA color override
  color_rgba?: [r: number, g: number, b: number, a: number];
  // XML Element reference
  elem: Element;
}

// 2) Cylinder‐type visual
interface IUrdfVisualCylinder {
  name: string;
  origin_xyz: [x: number, y: number, z: number];
  origin_rpy: [roll: number, pitch: number, yaw: number];
  geometry: IUrdfCylinder;
  material?: {
    name: string;
    color?: string;
    texture?: string;
  },
  type: 'cylinder';
  color_rgba?: [r: number, g: number, b: number, a: number];
  elem: Element;
}

// 3) Mesh‐type visual
interface IUrdfVisualMesh {
  name: string;
  origin_xyz: [x: number, y: number, z: number];
  origin_rpy: [roll: number, pitch: number, yaw: number];
  geometry: IUrdfMesh;
  material?: {
    name: string;
    color?: string;
    texture?: string;
  },
  type: 'mesh';
  color_rgba?: [r: number, g: number, b: number, a: number];
  elem: Element;
}

// Now make a union of the three:
export type IUrdfVisual = IUrdfVisualBox | IUrdfVisualCylinder | IUrdfVisualMesh;