Open nunoguedelha opened 1 year ago
The plugin implementing this behaviour could have been implemented within the openmct framework directly, next to the plugin staticRootPlugin
, but we implement it in yarp-openmct
for now, for not further diverging from the official openmct release, as previous fixes/developments are still to be submitted.
The implementation steps are:
[x] copy staticRootPlugin
implementation code from Open-MCT module to folder openmctStaticServer/plugins/staticImportObjectPlugin
[x] Replace AMD module definition (define
function) by ECMA Script Javascript module definition (import
primitives) (refer to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)
Different module specifications:
module.exports
and require()
.define[]()
and import
.export
or export default
and import
.[x] Define StaticImportObjectPlugin rootIdentifiers in a dictionary
exchange
folder.openmct.install(StaticImportObjectPlugin(...))
for
importing the new panel .json file. for each imported file, a unique specific
namespace must be used, as the plugin install call returns to the OpenMCT
ObjectAPI an object provider with a closure on the imported data and
rootIdentifier
. For each StaticImportObjectPlugin
install call, a different
rootIdentifier
is defined, with a specific unique namespace and always the
key root
.rootIdentifier
shall not be added to the root in the plugin
anymore. Instead, they shall be defined in a dictionary defining the folder
structure meant to contain the imported panels. Define and add that dictionary:
mySavedPanels
.rootIdentifier
.staticImportObjectPlugin
plugin to overwrite the key and namespace of the root domain object containing
the imported domain objects (rootIdentifier).ObjectProvider
defined in the dictionary plugin, while the leaf elements have to be processed
by the StaticModelProvider
object provider defined in the plugin
StaticImportObjectPlugin
.
For that purpose, In the dictionary plugin, getFolderTelemetryEntryKeys
needs
to return keys and namespaces, as rootIdentifier
object namespaces won't be
the same as their parent folder. [x] Add input rootLocation
to StaticImportObjectPlugin
plugin.
It's cleaner to set the original location of the imported objects under the main folder "My Saved Panels".
[x] Add JointTracking exported panels.
This is a fast implementation. Ideally, the dictionary and installation of StaticImportObjectPlugin
instances for adding exported panels should be automatic in the future, but for now we hardcode them. Each line installing a StaticImportObjectPlugin
instance in openmctStaticServer/index.html
, e.g.
https://github.com/ami-iit/yarp-openmct/blob/fbd69b24de04b631ad86016161c69d6414c830fd/openmctStaticServer/index.html#L137-L139
...attaches an exported panel to the respective domain object in the dictionary dictionaryMySavedPanels .json
, namely
https://github.com/ami-iit/yarp-openmct/blob/fbd69b24de04b631ad86016161c69d6414c830fd/openmctStaticServer/plugins/conf/dictionaryMySavedPanels.json#L10-L12
For each line, the only thing that changes is the panel number (has to be unique and match the respective one in the dictionary), and the file name.
The feature can be implemented in two steps. The user actions mentioned below would be performed through the client GUI on the browser.:
[x] #160 Provide to the user a folder in the telemetry visualiser app repository where the user could save exported predefined panels (
json
files). Such panels would then be made available on the client visualiser on the browser, among the other telemetry entries.Example of json exported panel
```json { "openmct": { "4edc453c-8535-4912-897c-36c3028e7778": { "composition": [{ "namespace": "", "key": "ee9c1e48-9e89-4b87-8fd2-0652919d514f" }, { "namespace": "", "key": "1e30f98b-c3e1-4ea7-8f82-a93c40ac0f4f" }, { "namespace": "", "key": "ec67ddff-b798-4b30-8023-152bd8747f9c" }], "configuration": {}, "name": "Right Upper Leg Tracking", "type": "telemetry.plot.stacked", "location": "mine", "modified": 1661529970146, "persisted": 1661529955896, "id": "4edc453c-8535-4912-897c-36c3028e7778", "identifier": { "namespace": "", "key": "4edc453c-8535-4912-897c-36c3028e7778" } }, "ee9c1e48-9e89-4b87-8fd2-0652919d514f": { "composition": [{ "namespace": "yarpopenmct.vectorCollectionsTelemetry", "key": "walkingController.logger", "index": "0" }, { "namespace": "yarpopenmct.vectorCollectionsTelemetry", "key": "walkingController.logger", "index": "1" }], "configuration": { "series": [{ "identifier": { "namespace": "yarpopenmct.vectorCollectionsTelemetry", "key": "walkingController.logger", "index": "0" }, "yKey": "value.joints_state::positions::desired.26" }, { "identifier": { "namespace": "yarpopenmct.vectorCollectionsTelemetry", "key": "walkingController.logger", "index": "1" }, "yKey": "value.joints_state::positions::measured.26" }], "yAxis": {}, "xAxis": {}, "filters": {} }, "name": "Right Hip Pitch Tracking", "type": "telemetry.plot.overlay", "location": "4edc453c-8535-4912-897c-36c3028e7778", "modified": 1661529760851, "id": "ee9c1e48-9e89-4b87-8fd2-0652919d514f", "persisted": 1661529760851, "identifier": { "namespace": "", "key": "ee9c1e48-9e89-4b87-8fd2-0652919d514f" } }, "1e30f98b-c3e1-4ea7-8f82-a93c40ac0f4f": { "composition": [{ "namespace": "yarpopenmct.vectorCollectionsTelemetry", "key": "walkingController.logger", "index": "0" }, { "namespace": "yarpopenmct.vectorCollectionsTelemetry", "key": "walkingController.logger", "index": "1" }], "configuration": { "series": [{ "identifier": { "namespace": "yarpopenmct.vectorCollectionsTelemetry", "key": "walkingController.logger", "index": "0" }, "yKey": "value.joints_state::positions::desired.27" }, { "identifier": { "namespace": "yarpopenmct.vectorCollectionsTelemetry", "key": "walkingController.logger", "index": "1" }, "yKey": "value.joints_state::positions::measured.27" }], "yAxis": {}, "xAxis": {}, "filters": {} }, "name": "Right Hip Roll Tracking", "type": "telemetry.plot.overlay", "location": "4edc453c-8535-4912-897c-36c3028e7778", "modified": 1661529770660, "id": "1e30f98b-c3e1-4ea7-8f82-a93c40ac0f4f", "persisted": 1661529770660, "identifier": { "namespace": "", "key": "1e30f98b-c3e1-4ea7-8f82-a93c40ac0f4f" } }, "ec67ddff-b798-4b30-8023-152bd8747f9c": { "composition": [{ "namespace": "yarpopenmct.vectorCollectionsTelemetry", "key": "walkingController.logger", "index": "0" }, { "namespace": "yarpopenmct.vectorCollectionsTelemetry", "key": "walkingController.logger", "index": "1" }], "configuration": { "series": [{ "identifier": { "namespace": "yarpopenmct.vectorCollectionsTelemetry", "key": "walkingController.logger", "index": "0" }, "yKey": "value.joints_state::positions::desired.28" }, { "identifier": { "namespace": "yarpopenmct.vectorCollectionsTelemetry", "key": "walkingController.logger", "index": "1" }, "yKey": "value.joints_state::positions::measured.28" }], "yAxis": {}, "xAxis": {}, "filters": {} }, "name": "Right Hip Yaw Tracking", "type": "telemetry.plot.overlay", "location": "4edc453c-8535-4912-897c-36c3028e7778", "modified": 1661529781095, "id": "ec67ddff-b798-4b30-8023-152bd8747f9c", "persisted": 1661529781095, "identifier": { "namespace": "", "key": "ec67ddff-b798-4b30-8023-152bd8747f9c" } } }, "rootId": "4edc453c-8535-4912-897c-36c3028e7778" } ```StaticImportObjectPlugin
install instances automatically fromexchange
contents.