Files
qitech-control/docs/developer-docs/adding-a-machine.md

3.9 KiB
Raw Permalink Blame History

How can I add a new Machine?

Adding a new machine follows a common structure in server/machines/.

TLDR

Summary

When adding a new machine:

  • Create Folder server/machines/YOUR_MACHINE_NAME/.
  • Add the 4 files (mod.rs, new.rs, act.rs, api.rs).
  • Register it in machines/mod.rs with a unique constant.
  • mod.rs: define the struct + emit functions.
  • new.rs: assemble devices/controllers into the machine.
  • act.rs: implement the machine loop (MachineAct).
  • api.rs: define request (mutations) and response (events) types.

Tip: Start simple (copy MockMachine) and grow complexity as needed (add EtherCAT devices, controllers, etc.).


1. Create the folder

Create a new directory: server/machines/YOUR_MACHINE_NAME

At a minimum, this folder needs the following files:

  • mod.rs</