Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Your First Project

Creating a Project

Use acctl new to create a new project:

acctl new my_first_machine
cd my_first_machine

This creates a complete project with all the files you need:

my_first_machine/
├── project.json              # Project configuration
├── control/                  # Your control program (Rust)
│   ├── Cargo.toml           # Rust package manifest
│   └── src/
│       ├── main.rs          # Entry point (auto-generated — do not edit)
│       ├── program.rs       # Your control logic (edit this!)
│       └── gm.rs            # Generated memory mappings
├── www/                      # Web HMI (React + TypeScript)
│   ├── package.json
│   ├── index.html
│   ├── vite.config.ts
│   └── src/
│       ├── main.tsx
│       ├── App.tsx
│       └── ...
├── datastore/                # Persistent storage
│   └── autocore_gnv.ini
└── .gitignore

A git repository is also initialized automatically.

Understanding the Project Structure

Directory / FilePurposeWhen You Edit It
project.jsonDefines variables, hardware modules, cycle timeWhen adding variables, changing cycle time, or configuring hardware
control/src/program.rsYour control logicThis is where you spend most of your time
control/src/main.rsEntry point — connects to the serverNever (auto-generated)
control/src/gm.rsRust struct mapping your variablesNever (auto-generated by acctl codegen)
control/Cargo.tomlRust dependenciesWhen adding external Rust libraries
www/Web-based HMIWhen building operator screens
datastore/Non-volatile storage (persists across restarts)Managed by the server; you read/write via commands

The project.json File

The project.json file is the heart of your project. Here is the default one that acctl new generates:

{
  "name": "my_first_machine",
  "version": "0.1.0",
  "description": "AutoCore project: my_first_machine",
  "modules": {},
  "control": {
    "enable": true,
    "source_directory": "./control",
    "entry_point": "main.rs",
    "signals": {
      "tick": {
        "description": "System Tick (10ms)",
        "source": "internal",
        "scan_rate_us": 10000
      }
    }
  },
  "variables": {}
}

Let’s break down each section:

control — Configures the control program execution:

FieldDescriptionExample
enableWhether the control program should runtrue
source_directoryPath to the Rust source code"./control"
entry_pointThe main Rust file"main.rs"
signals.tick.scan_rate_usCycle time in microseconds10000 (= 10 ms = 100 Hz)
signals.tick.sourceWhere the tick comes from"internal" (server-generated)

Common cycle times:

scan_rate_usCycle TimeFrequencyTypical Use
10001 ms1 kHzHigh-speed motion control
20002 ms500 HzServo drives
50005 ms200 HzGeneral motion
1000010 ms100 HzProcess control, I/O
5000050 ms20 HzSlow processes, monitoring

variables — Defines all the data points in your system. We will cover this in detail in Working with Variables.

modules — Configures hardware interface modules (EtherCAT, Modbus, etc.). We will cover this in the hardware integration chapters.

Building and Running Locally

If you are running the AutoCore server on your development machine (which is the typical development workflow):

# Step 1: Push the project configuration to the server
acctl push project

# Step 2: Build and deploy the control program, then start it
acctl push control --start

The push control command:

  1. Compiles your Rust control program
  2. Uploads the binary to the server
  3. With --start, starts the control program immediately

If you only want to build without starting:

acctl push control

Then start it separately:

acctl control start

Viewing Logs

Your control program’s log output is captured by the server and can be viewed with:

# Show recent logs
acctl logs

# Stream logs in real time (like tail -f)
acctl logs --follow

Press Ctrl+C to stop streaming.

You can also check the control program’s status:

acctl control status

This shows whether the program is running, stopped, or has encountered an error.