Skip to content

Read the dashboard and the tags

Every value a controller has is a tag, and every tag has a role that says who writes it. This lesson uses the hello project from the last lesson (naut run in its folder) to see the four roles at work.

RoleWho writes itIn hello
inputthe field driver, before every scanSensor
setpointan operator (a person or a screen); exists from the first scanSetpoint
outputthe program, after every scan, for the driver to sendActuator
statethe program, for itselfnone yet

A tag’s role is a promise about ownership. The controller refuses a write to an input because the driver would overwrite it within a scan, and a write to a program’s output would be overwritten by the program.

The dashboard at http://localhost:8080 shows them. The same values are available to other programs over HTTP:

Terminal window
curl -s localhost:8080/api/state | jq -c .tags
{"Actuator":50,"Sensor":0,"Setpoint":50}

(jq only tidies the output; plain curl works.) Change a setpoint the same way:

Terminal window
curl -s -X POST localhost:8080/api/tags -d '{"name":"Setpoint","value":70}'

A successful write answers 204 No Content and prints nothing. Actuator is now 70.

Sensor has no field behind it here, so nothing moves it. Writing to it is refused, and the reply says what to do instead. A force holds a tag at a value, against its driver, until you remove it:

Terminal window
curl -s -X POST localhost:8080/api/forces -d '{"name":"Sensor","value":20}'
curl -s localhost:8080/api/state | jq -c .tags
{"Actuator":50,"Sensor":20,"Setpoint":70}

Actuator is Setpoint − Sensor = 50. Remove the force and the sensor goes back to what the driver says:

Terminal window
curl -s -X DELETE localhost:8080/api/forces/Sensor

Forces are for bring-up and testing; they are not kept across a restart. Forcing covers the rest, including forcing from VS Code.

nautilus is free and open source (Apache 2.0), built by Joy Automation. For implementation or support on your site, see Joy Automation services. Privacy.