linking
4 minute read
/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
you can set
motorcortex parameters and define links
between these parameters. This way you can communicate data from one Module to another Module. This works also across Tasks.
You are only allowed to link parameters that have the same data type
and size
on both ends of the link. It is not allowed to link parameterType: output
as Destination
, an output
can only be a Source
.
All possible xxx.link.json
options are explained in the
linking.schema.v4.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.
#Version
You can apply a version
to your xxx.link.json
with "Version":
, check out
linking.schema.v4.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
}
#Links
"Links":
are used to link a source
to a destination
, it is allowed to link a source to multiple destinations, but it is not allowed to link multiple sources to one destination.
In the "Source":
and "Destination":
: you fill in your preferred path (root/.../...
). To the Source
you can specify information like: "Gain":
, "Offset":
, "Index":
, "Length":
, "Invert":
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 . |
"Invert": |
Here you can invert the Source , invert is only applied to a value 0 or 1 . |
"Gain": |
Here you can specify the Gain , the Source is multiplied by the defined Gain 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 . |
Note
The order of information sending to the Destination
is first the Offset
, after which the Source * Gain
is added.
"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
}
}
]