prod2u_p4_normal_host_contract_v4.schema.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. {
  2. "$schema": "https://json-schema.org/draft/2020-12/schema",
  3. "$id": "https://prod2u.local/schemas/prod2u-p4-normal-host-contract-v4.schema.json",
  4. "title": "Prod2U Profile 4 Normal minimal actuator host contract v4",
  5. "type": "object",
  6. "additionalProperties": false,
  7. "required": [
  8. "schema",
  9. "profile",
  10. "profile_id",
  11. "protocol",
  12. "version_source",
  13. "wire",
  14. "frame_types",
  15. "commands",
  16. "unsupported_commands",
  17. "responses",
  18. "motion",
  19. "limit",
  20. "watchdog",
  21. "programming"
  22. ],
  23. "properties": {
  24. "schema": {"const": "prod2u-p4-normal-host-contract-v4"},
  25. "profile": {"const": "prod2u-p4-normal-actuator-binary921-v3"},
  26. "profile_id": {"const": 4},
  27. "protocol": {"const": "binary921-v3"},
  28. "version_source": {"const": "full_git_commit"},
  29. "wire": {
  30. "type": "object",
  31. "required": [
  32. "magic_hex",
  33. "version",
  34. "seq",
  35. "timestamp_tick",
  36. "header_offsets",
  37. "crc16",
  38. "request_compatibility",
  39. "ordinary_response_order",
  40. "motor_status_response_order",
  41. "unsolicited_frames"
  42. ],
  43. "properties": {
  44. "magic_hex": {"const": "A55A"},
  45. "version": {"const": 2},
  46. "seq": {"const": 0},
  47. "timestamp_tick": {"const": 0},
  48. "header_offsets": {
  49. "const": {
  50. "magic": [0, 1],
  51. "version": 2,
  52. "profile_id": 3,
  53. "frame_type": 4,
  54. "seq_u32_le": [5, 8],
  55. "timestamp_tick_u32_le": [9, 12],
  56. "payload_length_u8": 13,
  57. "payload": [14, "14+payload_length-1"],
  58. "crc16_le": ["14+payload_length", "15+payload_length"]
  59. }
  60. },
  61. "crc16": {
  62. "const": {
  63. "name": "CRC-16/CCITT-FALSE",
  64. "polynomial": 4129,
  65. "initial": 65535,
  66. "reflect_input": false,
  67. "reflect_output": false,
  68. "xor_output": 0,
  69. "coverage": "version_through_payload_inclusive",
  70. "wire_byte_order": "little-endian"
  71. }
  72. },
  73. "request_compatibility": {"const": "BYTE_EXACT_FROZEN"},
  74. "ordinary_response_order": {"const": ["HOST_ACK"]},
  75. "motor_status_response_order": {"const": ["HOST_ACK", "MOTION_STATUS"]},
  76. "unsolicited_frames": {"const": false}
  77. },
  78. "additionalProperties": false
  79. },
  80. "frame_types": {
  81. "const": {
  82. "HOST_CMD": 5,
  83. "HOST_ACK": 6,
  84. "HOST_BATCH_CMD": 7,
  85. "MOTION_CMD": 17,
  86. "MOTION_STATUS": 18
  87. }
  88. },
  89. "commands": {
  90. "type": "object",
  91. "required": ["get_status", "disable", "set_output_snapshot", "jog", "mark_closed", "get_motor_status"],
  92. "properties": {
  93. "get_status": {"$ref": "#/$defs/command"},
  94. "disable": {"$ref": "#/$defs/command"},
  95. "set_output_snapshot": {"$ref": "#/$defs/snapshotCommand"},
  96. "jog": {"$ref": "#/$defs/jogCommand"},
  97. "mark_closed": {"$ref": "#/$defs/command"},
  98. "get_motor_status": {"$ref": "#/$defs/command"}
  99. },
  100. "additionalProperties": false
  101. },
  102. "unsupported_commands": {
  103. "type": "object",
  104. "required": ["0x29", "0x36"],
  105. "properties": {
  106. "0x29": {"$ref": "#/$defs/unsupported"},
  107. "0x36": {"$ref": "#/$defs/unsupported"}
  108. },
  109. "additionalProperties": false
  110. },
  111. "responses": {
  112. "type": "object",
  113. "required": ["host_ack", "motion_status"],
  114. "properties": {
  115. "host_ack": {
  116. "type": "object",
  117. "required": ["frame_type", "payload_length", "full_frame_length", "byte_offsets", "state_hash16", "snapshot_detail_bits", "snapshot_result_flag_bits", "status_codes"],
  118. "properties": {
  119. "frame_type": {"const": 6},
  120. "payload_length": {"const": 8},
  121. "full_frame_length": {"const": 24},
  122. "byte_offsets": {"type": "object"},
  123. "state_hash16": {
  124. "type": "object",
  125. "required": ["algorithm", "encoding", "input_order", "semantic"],
  126. "properties": {
  127. "algorithm": {"const": "CRC-16/CCITT-FALSE"},
  128. "encoding": {"const": "u16_le"},
  129. "input_order": {"type": "array", "minItems": 3, "maxItems": 3},
  130. "semantic": {"const": "ACTUAL_APPLIED_SYNCHRONOUS_OUTPUTS"}
  131. },
  132. "additionalProperties": false
  133. },
  134. "snapshot_detail_bits": {
  135. "const": {
  136. "x_busy": 0,
  137. "y_busy": 1,
  138. "z_busy": 2,
  139. "x_invalid": 3,
  140. "y_invalid": 4,
  141. "z_invalid": 5,
  142. "solenoid_change_ignored": 6,
  143. "reserved_zero": 7
  144. }
  145. },
  146. "snapshot_result_flag_bits": {"type": "object"},
  147. "status_codes": {"type": "object"}
  148. },
  149. "additionalProperties": false
  150. },
  151. "motion_status": {
  152. "type": "object",
  153. "required": ["frame_type", "payload_length", "full_frame_length", "layout", "position_values", "standard_motion_valid_during_busy", "jog_or_limit_stop_position", "busy_semantic", "busy_role", "setup_busy", "active_not_busy_allowed", "fault_mask", "z_current_target", "z_valid_busy_fault"],
  154. "properties": {
  155. "frame_type": {"const": 18},
  156. "payload_length": {"const": 10},
  157. "full_frame_length": {"const": 26},
  158. "layout": {"type": "string"},
  159. "position_values": {"type": "object"},
  160. "standard_motion_valid_during_busy": {"const": false},
  161. "jog_or_limit_stop_position": {"const": 255},
  162. "busy_semantic": {"const": "FIRST_STEP_RISE_THROUGH_FINAL_LOW"},
  163. "busy_role": {"const": "READ_ONLY_TELEMETRY_NOT_JOG_ADMISSION"},
  164. "setup_busy": {"const": false},
  165. "active_not_busy_allowed": {"const": true},
  166. "fault_mask": {"const": 0},
  167. "z_current_target": {"const": 255},
  168. "z_valid_busy_fault": {"const": 0}
  169. },
  170. "additionalProperties": false
  171. }
  172. },
  173. "additionalProperties": false
  174. },
  175. "motion": {
  176. "type": "object",
  177. "required": ["axes", "execution", "snapshot_arbitration_signal", "same_axis_standard_while_active", "same_axis_jog_while_active", "peer_axis_may_start", "standard_open", "standard_close", "repeated_standard_command", "dir_setup_us", "normal_step_stop", "hard_stop_sources"],
  178. "properties": {
  179. "axes": {"const": ["X", "Y"]},
  180. "execution": {"const": "TWO_INDEPENDENT_PARALLEL_EXECUTORS"},
  181. "snapshot_arbitration_signal": {"const": "AXIS_ACTIVE"},
  182. "same_axis_standard_while_active": {"const": "BUSY_OR_PARTIAL"},
  183. "same_axis_jog_while_active": {"const": "REPLACE_LATEST_AFTER_CURRENT_FULL_STEP"},
  184. "peer_axis_may_start": {"const": true},
  185. "standard_open": {"$ref": "#/$defs/standardMove"},
  186. "standard_close": {"$ref": "#/$defs/standardMove"},
  187. "repeated_standard_command": {"const": "START_NEW_3200_STEP_MOVE"},
  188. "dir_setup_us": {"const": 1000},
  189. "normal_step_stop": {"const": "COMPLETE_CURRENT_HIGH_AND_LOW_PHASE"},
  190. "hard_stop_sources": {"const": ["DISABLE", "WATCHDOG_EXPIRY"]}
  191. },
  192. "additionalProperties": false
  193. },
  194. "limit": {
  195. "type": "object",
  196. "required": ["axes", "polarity", "open_voltage_v", "closed_voltage_v", "synchronizer_stages", "used_only_for", "motion_effect", "dir0_jog_ignores_limit", "dir1_jog_ignores_limit", "standard_motion_ignores_limit", "position_memory", "direction_learning"],
  197. "properties": {
  198. "axes": {"const": ["X", "Y"]},
  199. "polarity": {"const": "ACTIVE_HIGH"},
  200. "open_voltage_v": {"const": 0.0},
  201. "closed_voltage_v": {"const": 3.3},
  202. "synchronizer_stages": {"const": 3},
  203. "used_only_for": {"const": "NOT_USED_BY_FORCE_JOG_IMAGE"},
  204. "motion_effect": {"const": "NONE"},
  205. "dir0_jog_ignores_limit": {"const": true},
  206. "dir1_jog_ignores_limit": {"const": true},
  207. "standard_motion_ignores_limit": {"const": true},
  208. "position_memory": {"const": false},
  209. "direction_learning": {"const": false}
  210. },
  211. "additionalProperties": false
  212. },
  213. "watchdog": {
  214. "type": "object",
  215. "required": ["timeout_seconds", "accepted_output_or_motion_arms", "armed_get_motor_status_refreshes", "status_query_cannot_arm_or_revive", "expiry_beats_same_cycle_refresh", "expiry_requires_disable_before_rearm", "next_valid_jog_clears_timeout_and_rearms"],
  216. "properties": {
  217. "timeout_seconds": {"const": 5},
  218. "accepted_output_or_motion_arms": {"const": true},
  219. "armed_get_motor_status_refreshes": {"const": true},
  220. "status_query_cannot_arm_or_revive": {"const": true},
  221. "expiry_beats_same_cycle_refresh": {"const": true},
  222. "expiry_requires_disable_before_rearm": {"const": false},
  223. "next_valid_jog_clears_timeout_and_rearms": {"const": true}
  224. },
  225. "additionalProperties": false
  226. },
  227. "programming": {
  228. "type": "object",
  229. "required": ["operation", "speed_hz", "attempt_limit", "automatic_retry", "flash_allowed"],
  230. "properties": {
  231. "operation": {"const": "PROGRAM_SRAM"},
  232. "speed_hz": {"const": 200000},
  233. "attempt_limit": {"const": 1},
  234. "automatic_retry": {"const": false},
  235. "flash_allowed": {"const": false}
  236. },
  237. "additionalProperties": false
  238. }
  239. },
  240. "$defs": {
  241. "command": {
  242. "type": "object",
  243. "required": ["frame_type", "command", "payload_length"],
  244. "properties": {
  245. "frame_type": {"type": "integer", "minimum": 0, "maximum": 255},
  246. "command": {"type": "integer", "minimum": 0, "maximum": 255},
  247. "payload_length": {"type": "integer", "minimum": 0, "maximum": 255}
  248. },
  249. "additionalProperties": true
  250. },
  251. "snapshotCommand": {
  252. "type": "object",
  253. "required": ["frame_type", "command", "payload_length", "full_frame_length", "input_layout", "ptc_range", "fan_range", "binary_values", "ptc_fan_commit_when_motion_busy", "solenoid_change_when_any_xy_busy", "axis_policy", "active_axis_precedence", "response"],
  254. "properties": {
  255. "frame_type": {"const": 7},
  256. "command": {"const": 42},
  257. "payload_length": {"const": 34},
  258. "full_frame_length": {"const": 50},
  259. "input_layout": {"const": "2A flags PTC1..24 FAN1..4 solenoid X Y Z"},
  260. "ptc_range": {"const": [0, 100]},
  261. "fan_range": {"const": [0, 100]},
  262. "binary_values": {"const": [0, 100]},
  263. "ptc_fan_commit_when_motion_busy": {"const": true},
  264. "solenoid_change_when_any_xy_busy": {"const": "IGNORE_AND_SET_DETAIL_BIT_6"},
  265. "axis_policy": {"const": "INDEPENDENT_ACCEPT_BUSY_INVALID"},
  266. "active_axis_precedence": {"const": "BUSY_IGNORED_BEFORE_TARGET_VALIDATION"},
  267. "response": {"const": "HOST_ACK"}
  268. },
  269. "additionalProperties": false
  270. },
  271. "jogCommand": {
  272. "type": "object",
  273. "required": ["frame_type", "command", "payload_length", "full_frame_length", "input_layout", "axes", "cli_axes", "reserved_z_status", "direction", "speed_codes", "step_range", "executed_step_cap", "over_cap_status", "over_cap_behavior", "same_axis_active_policy", "multiple_pending_policy", "replacement_dir_setup_us", "limit_policy", "rejects_busy", "admission_ignores", "watchdog_timeout_recovery", "peer_axis_busy_does_not_block", "response"],
  274. "properties": {
  275. "frame_type": {"const": 17},
  276. "command": {"const": 53},
  277. "payload_length": {"const": 8},
  278. "full_frame_length": {"const": 24},
  279. "input_layout": {"const": "35 axis raw_dir speed_code steps_u16_le 00 00"},
  280. "axes": {"type": "object"},
  281. "cli_axes": {"const": ["X", "Y"]},
  282. "reserved_z_status": {"const": "BAD_VALUE"},
  283. "direction": {"type": "object"},
  284. "speed_codes": {"const": [0, 1, 2, 3]},
  285. "step_range": {"const": [1, 65535]},
  286. "executed_step_cap": {"const": 800},
  287. "over_cap_status": {"const": "OK"},
  288. "over_cap_behavior": {"const": "EXECUTE_800_STEPS_WITH_REQUEST_BYTES_UNCHANGED"},
  289. "same_axis_active_policy": {"const": "REPLACE_LATEST_AFTER_CURRENT_FULL_STEP"},
  290. "multiple_pending_policy": {"const": "LATEST_WINS_EACH_COMMAND_ACKED"},
  291. "replacement_dir_setup_us": {"const": 1000},
  292. "limit_policy": {"const": "IGNORE_ALL_INPUTS"},
  293. "rejects_busy": {"const": false},
  294. "admission_ignores": {"const": ["AXIS_ACTIVE", "SNAPSHOT_VALID", "LIMIT_INPUTS", "WATCHDOG_TIMEOUT"]},
  295. "watchdog_timeout_recovery": {"const": "CLEAR_TIMEOUT_REARM_WITHOUT_DISABLE"},
  296. "peer_axis_busy_does_not_block": {"const": true},
  297. "response": {"const": "HOST_ACK"}
  298. },
  299. "additionalProperties": false
  300. },
  301. "unsupported": {
  302. "type": "object",
  303. "required": ["status", "status_code", "changes_state", "arms_watchdog"],
  304. "properties": {
  305. "status": {"const": "UNSUPPORTED_IN_PROFILE"},
  306. "status_code": {"const": 1},
  307. "changes_state": {"const": false},
  308. "arms_watchdog": {"const": false},
  309. "request_payload_hex": {"type": "string"}
  310. },
  311. "additionalProperties": false
  312. },
  313. "standardMove": {
  314. "type": "object",
  315. "required": ["direction", "steps", "checks_limit"],
  316. "properties": {
  317. "direction": {"enum": [0, 1]},
  318. "steps": {"const": 3200},
  319. "checks_limit": {"const": false}
  320. },
  321. "additionalProperties": false
  322. }
  323. }
  324. }