linking

linking folder explained
/etc/motorcortex/config/
└── linking
    ├── agv-control.link.json
    ├── base.link.json
    ├── joystick.link.json
    ├── machine-control.link.json
    ├── safety-selector.link.json
    ├── setpoint-generator.link.json
    └── signal-generator.link.json

General

In xxx.link.json links between different parameters can be defined. This way you can communicate data from one Module to another Module. This works also across Tasks.

You should of course only link parameters that have the same type and size on both ends of the link. Also you cannot link something to an output (as Destination); an output can only be a Source.

All possible xxx.link.json options are explained in the linking.schema.v3.json

xxx.link.json example

{
  "Version": "1.0.0",
  "Groups": [
    {
      "Name": "LinkExample",
      "SystemMode": "All",
      "Links": [
        {
          "Source": {
            "Path": "root/Control/boolOutput"
          },
          "Destination": {
            "Path": "root/Logic/boolInput"
          }
        }
      ]
    },
    {
      "Name": "Simulation",
      "SystemMode": "Simulation",
      "Links": [
        {
          "Source": {
            "Path": "root/Simulator/doubleOutput"
          },
          "Destination": {
            "Path": "root/Control/doubleInput"
          }
        }
      ]
    }
  ]
}

xxx.link.json explained

Inside the xxx.link.json you can create multiple "Groups", a group contains a "Name" and information about the action like: "links" and/or "setParameters". With the "systemMode" you can specify for which Application mode this group should be active. If you want to disable or enable groups from the xxx.link.json, you can use the "Enable": function.

image not found

#Version

You can apply a version to your xxx.link.json with "Version":, check out linking.schema.v3.json how to to set up your versioning.

#Groups

You can create your own "Group":, to assign a link or set a parameter.

#Name

Each group contains a "Name": in here you can specify a name to your liking.

#SystemMode

Inside the config.json you can define the Application Mode, per mode, different links can be created in the xxx.link.json. For each group the "systemMode": can be defined (All, Production or Simulation) with the "systemMode", you can specify in which Application Mode the group is active:

Application Mode SystemMode
Production All or Production
Simulation All or Simulation

#Enable

With the "Enable": flag you can enable or disable the current group, this is done by defining a True, or False statement.

#SetParameters

SetParameters are used to change the the "Value": of the specified "Path":.

Parameter Description
"Value": Here you can specify any type of Value that you want to assign to the Path.
"Force": Here you can specify if you want to Force the value, to the Path, This can either be True or False.
"Path": Here you can specify the Path, to which the Value is written. (path example: root/.../...)
"Index": Here you can specify the Index expressed as number, index 0 is equal to the the first element in a array[0].
"Length": Here you can specify the Length of elements expressed as a number. Example: If the "Index": 1, with "Length": 2, Index 1 and 2 are written to the Destination.

   "Name": "Simulation",
      "SystemMode": "Simulation",
      "SetParameters":
        {
          "Path": "root/Logic/:busToState/estop_buttons_channel1",
          "Value": [
            true,
            true,
            true,
            true,
            true,
            true,
            true,
            true
          ],
          "Force": true
        } 

image not found

"Links": are used to link the source to a destination, or an destination to a source, it is not possible to link multiple destinations to a source. But it is possible to link an source to multiple destinations.

In the "Source": and "Destination":: you fill in your preferred path (root/.../...). To the Source you can specify information like: "Gain":, "Offset":, "Index": , "Length": and for the Destination only a "Index": and "Length".

Parameter Description
"Source": Here you can specify the Path of the Source that you want to link to the Destination.
"Destination": Here you can specify the path of the destination.
"Gain": Here you can specify the Gain which is multiplied with Source, to get a new Destination value.
"Offset": Here you can specify the Offset applied to the Destination.
"Index": Here you can specify the Index expressed as number, index 0 is equal to the the first element in a array[0].
"Length": Here you can specify the Length of elements expressed as a number. Example: If the "Index": 1, with "Length": 2, you will write only Index 1 and 2 to the Destination.

      "Name": "Joystick",
      "SystemMode": "All",
      "Enable": true,
      "Links": [
        {
          "Gain": 1.0,
          "Offset": 0.0,
          "Source": {
            "Path": "root/Joystick1/axes",
            "Index": 4,
            "Length": 1
          },
          "Destination": {
            "Path": "root/Control/hostInJointVelocity",
            "Index": 0
          }
        }
      ]

image not found