linking/*.link.json
8 minute read
A configuration package keeps its link files in the linking/ folder. Each file sets up the parameters and links for one part of the application.
Which files are loaded
The application only reads a link file that config.json names. It does not scan the folder, so a file that is not named, or that belongs to a disabled feature, is never loaded.
- Always loaded: the files listed under
"Path": { "Linking": [...] }. In the standard robot configuration these arebase.link.jsonandreferencing.link.json. - Per feature: each feature names its own file in its
Linkingkey. The file only loads when the feature is enabled.
"Path": {
"Linking": ["linking/base.link.json", "linking/referencing.link.json"]
},
"ManipulatorControl": {
"Enable": true,
"Linking": "linking/manipulator-control.link.json"
}
All fourteen link files of the standard robot configuration
| File | Loaded by |
|---|---|
base.link.json |
Path (always) |
referencing.link.json |
Path (always) |
manipulator-control.link.json |
ManipulatorControl |
machine-control.link.json |
MachineControl |
agv-control.link.json |
AGVControl |
motion-player.link.json |
MotionPlayer |
safety-selector.link.json |
SafetyChannelSelector |
joystick.link.json |
Joystick |
space-nav.link.json |
SpaceNav |
collision-detector.link.json |
CollisionDetector |
setpoint-generator.link.json |
SetpointGenerator |
signal-generator.link.json |
SignalGenerator |
force-dimension.link.json |
ForceDimension: named, but the current application does not load it |
weaving-motion.link.json |
WeavingMotion |
What a link file does
A link file does two things when the application starts:
- Links connect a source parameter to a destination parameter. From then on the destination follows the source every cycle, also across tasks.
- SetParameters write a value to a parameter once, or lock it there.
Both are organised in groups, and each group can be limited to one system modeThe system mode is set with "Mode" in config.json: Production runs on the real hardware, Simulation runs without it. A group with "SystemMode": "All" applies in both.
. At start-up the application applies the groups that match its mode and skips the rest. Here is what that does with three groups of the standard base.link.json, in production mode:
All options at a glance
These are all the options a link file accepts, with their defaults. Click a card to open its tab below.
To have your editor check a link file as you type, point it at the JSON schema linking.schema.v4.json.
This example combines two entries from the standard robot configuration’s base.link.json. It sets the drive mode of all axes, and passes the mode on to each axis control loop:
{
"Version": "1.0.0",
"Groups": [
{
"Name": "Drive Mode",
"SystemMode": "All",
"Enable": true,
"SetParameters": [
{
"Path": "root/DriveLogic/driveMode",
"Value": [8, 8, 8, 8, 8, 8]
}
]
},
{
"Name": "Drive mode to the control loops",
"SystemMode": "All",
"Links": [
{
"Source": {
"Path": "root/DriveLogic/driveOpMode"
},
"Destination": {
"Path": "root/AxesControl/actuatorControlLoops/actuatorControlLoop%02d/driveMode",
"Index": 1
}
}
]
}
]
}
Groups, links and SetParameters
Start with Groups: links and SetParameters always sit inside a group.
Groups
| Field | What it does | Default |
|---|---|---|
Name |
A name for the group, used in log messages. | none |
SystemMode |
When the group applies; see below. | All |
Enable |
false skips the whole group. |
true |
Links |
The group’s links. | none |
SetParameters |
The group’s start-up values. | none |
Version at the top of the file is for the schema; the application does not read it.
SystemMode
The system mode in config.json decides which groups apply:
| Application mode | Groups that apply |
|---|---|
Production |
All and Production |
Simulation |
All and Simulation |
Use a Simulation group for what has no hardware behind it in simulation, such as a safety output; see the SetParameters example below.
Links
| Field | What it does | Default |
|---|---|---|
Source |
Where the value comes from: an OUTPUT or a PARAMETER. |
required |
Destination |
Where it goes: an INPUT or a PARAMETER. |
required |
Gain |
The source is multiplied by this. | 1.0 |
Offset |
Added after the gain. | 0.0 |
Invert |
For a true/false destination: flips the value. | false |
Enable |
false skips this link. |
true |
Source and Destination each take:
| Field | What it does | Default |
|---|---|---|
Path |
The parameter, for example root/DriveLogic/driveOpMode. |
required |
Index |
The first array element to use; 0 is the first. | 0 |
Length |
How many elements to use. | all |
The two ends do not need the same data type. The destination receives source × Gain + Offset, converted to its own type and clamped to that type’s range. A true/false destination becomes true when the source is not zero. A link copies as many elements as both ends have room for.
A source can feed any number of destinations, but give each destination one source. With two, the application warns and the destination takes whichever was written last.
This link from the standard joystick.link.json takes element 1 of the joystick’s axes, flips its sign, and writes it to element 0 of the AGV’s target velocity. Gain sits next to Source and Destination, not inside them:
{
"Source": {
"Path": "root/Joysticks/Joystick01/axes",
"Index": 1,
"Length": 1
},
"Destination": {
"Path": "root/AGVControl/hidInTargetVelocity",
"Index": 0
},
"Gain": -1
}
See a link in action
Link a numbered set at once with %02d
Many parameters come in numbered sets, such as actuatorControlLoop01 to actuatorControlLoop06. Instead of writing one link per member, put a number pattern in the path. %02d stands for a two-digit number with a leading zero: 01, 02, 03 and so on.
The entry then becomes one link per member. Element 0 of the source goes to the first number, element 1 to the next, and so on. The first number is the Index of the end that has the pattern.
In the example file at the top of this page, the destination has the pattern and "Index": 1, so the six elements of driveOpMode go to control loops 01 to 06:
The links stop at the first number whose path does not exist, or when the source has no more elements.
SetParameters
| Field | What it does | Default |
|---|---|---|
Path |
The parameter to write. | required |
Value |
The value: a number, true/false, or a list for an array. A shorter list fills the array from the first element. |
none |
Force |
true locks the value, so nothing else can change it. |
false |
Enable |
false skips this entry. |
true |
Index, Length |
Only with a %02d pattern in Path: the first number and how many to write. |
0, all |
Without Force, the value is written once at start-up and can change afterwards. Values saved from Desk are loaded after the link files, so a saved value replaces a SetParameters value. Use Force for a value that must hold, such as a safety signal in simulation.
The standard robot configuration uses this group in simulation, where there is no safety PLC or collision hardware:
{
"Name": "Simulation",
"SystemMode": "Simulation",
"Enable": true,
"SetParameters": [
{
"Path": "root/Ethercat/GCC/EL6910-01/Outputs/oSTONotActive",
"Value": true
},
{
"Path": "root/CollisionDetectors/CollisionDetector%02d/collisionDetector/disable",
"Index": 0,
"Value": true
}
]
}
The second entry uses %02d to disable every collision detector, from CollisionDetector00 up.