Configure single-DOF machine joints and drive them from WASM axes

This commit is contained in:
2026-09-21 11:24:22 +08:00
parent 989866b3ab
commit d8488641ca
32 changed files with 12058 additions and 215 deletions

View File

@@ -0,0 +1,475 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "urn:linuxcnc:joint-model:1",
"title": "Web LinuxCNC single-DOF joint model",
"type": "object",
"additionalProperties": false,
"required": [
"schema",
"coordinates",
"units",
"controller",
"calibration",
"axisMap",
"nodes"
],
"properties": {
"schema": {
"const": "linuxcnc.joint-model/1"
},
"coordinates": {
"enum": [
"XYZAC",
"XYZBC"
]
},
"units": {
"const": {
"length": "mm",
"angle": "deg",
"gltfLength": "m"
}
},
"controller": {
"type": "object",
"additionalProperties": false,
"required": [
"source",
"axisOrder"
],
"properties": {
"source": {
"const": "linuxcnc-wasm.visual.joints"
},
"axisOrder": {
"enum": [
[
"X",
"Y",
"Z",
"A",
"C"
],
[
"X",
"Y",
"Z",
"B",
"C"
]
]
}
}
},
"calibration": {
"type": "object",
"additionalProperties": false,
"required": [
"cOriginMm",
"tiltOffsetMm",
"physicalZero"
],
"properties": {
"cOriginMm": {
"$ref": "#/$defs/vector3"
},
"tiltOffsetMm": {
"$ref": "#/$defs/vector3"
},
"physicalZero": {
"type": "object",
"required": [
"x",
"y",
"z",
"a",
"b",
"c"
],
"additionalProperties": false,
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"z": {
"type": "number"
},
"a": {
"type": "number"
},
"b": {
"type": "number"
},
"c": {
"type": "number"
}
}
}
}
},
"axisMap": {
"type": "object",
"additionalProperties": false,
"properties": {
"X": {
"type": "string",
"minLength": 1
},
"Y": {
"type": "string",
"minLength": 1
},
"Z": {
"type": "string",
"minLength": 1
},
"A": {
"type": "string",
"minLength": 1
},
"B": {
"type": "string",
"minLength": 1
},
"C": {
"type": "string",
"minLength": 1
}
}
},
"nodes": {
"type": "array",
"minItems": 1,
"maxItems": 12000,
"items": {
"$ref": "#/$defs/node"
}
}
},
"$defs": {
"vector3": {
"type": "array",
"items": {
"type": "number"
},
"minItems": 3,
"maxItems": 3
},
"node": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"parentId",
"name",
"role",
"source",
"zero",
"joint"
],
"properties": {
"id": {
"type": "string",
"minLength": 1
},
"parentId": {
"type": [
"string",
"null"
]
},
"name": {
"type": "string"
},
"role": {
"type": "string"
},
"source": {
"type": "object",
"additionalProperties": false,
"required": [
"file",
"hash",
"path"
],
"properties": {
"file": {
"type": "string"
},
"hash": {
"type": "string"
},
"path": {
"type": "string"
}
}
},
"zero": {
"type": "object",
"additionalProperties": false,
"required": [
"positionMm",
"quaternion",
"scale"
],
"properties": {
"positionMm": {
"$ref": "#/$defs/vector3"
},
"quaternion": {
"type": "array",
"items": {
"type": "number",
"minimum": -1,
"maximum": 1
},
"minItems": 4,
"maxItems": 4
},
"scale": {
"type": "array",
"items": {
"type": "number",
"exclusiveMinimum": 0
},
"minItems": 3,
"maxItems": 3
}
}
},
"joint": {
"anyOf": [
{
"type": "null"
},
{
"$ref": "#/$defs/dof"
}
]
}
}
},
"dof": {
"type": "object",
"additionalProperties": false,
"required": [
"axis",
"direction",
"sign",
"dof",
"type",
"unit",
"frame"
],
"properties": {
"axis": {
"enum": [
"X",
"Y",
"Z",
"A",
"B",
"C"
]
},
"direction": {
"enum": [
"x",
"y",
"z"
]
},
"sign": {
"enum": [
-1,
1
]
},
"dof": {
"const": 1
},
"frame": {
"const": "parent"
},
"type": {
"enum": [
"prismatic",
"revolute"
]
},
"unit": {
"enum": [
"mm",
"deg"
]
}
},
"allOf": [
{
"if": {
"properties": {
"axis": {
"enum": [
"X",
"Y",
"Z"
]
}
}
},
"then": {
"properties": {
"type": {
"const": "prismatic"
},
"unit": {
"const": "mm"
}
}
},
"else": {
"properties": {
"type": {
"const": "revolute"
},
"unit": {
"const": "deg"
}
}
}
}
]
}
},
"allOf": [
{
"if": {
"properties": {
"coordinates": {
"const": "XYZAC"
}
}
},
"then": {
"properties": {
"controller": {
"properties": {
"axisOrder": {
"const": [
"X",
"Y",
"Z",
"A",
"C"
]
}
}
},
"axisMap": {
"propertyNames": {
"enum": [
"X",
"Y",
"Z",
"A",
"C"
]
}
},
"nodes": {
"items": {
"properties": {
"joint": {
"anyOf": [
{
"type": "null"
},
{
"properties": {
"axis": {
"enum": [
"X",
"Y",
"Z",
"A",
"C"
]
}
}
}
]
}
}
}
}
}
}
},
{
"if": {
"properties": {
"coordinates": {
"const": "XYZBC"
}
}
},
"then": {
"properties": {
"controller": {
"properties": {
"axisOrder": {
"const": [
"X",
"Y",
"Z",
"B",
"C"
]
}
}
},
"axisMap": {
"propertyNames": {
"enum": [
"X",
"Y",
"Z",
"B",
"C"
]
}
},
"nodes": {
"items": {
"properties": {
"joint": {
"anyOf": [
{
"type": "null"
},
{
"properties": {
"axis": {
"enum": [
"X",
"Y",
"Z",
"B",
"C"
]
}
}
}
]
}
}
}
}
}
}
}
]
}