Closed nunoguedelha closed 1 year ago
Allow the user to access, from the visualizer client, exported panels stored in the remote server exchange folder
The plugin implementing this behaviour could have been implemented within the openmct framework directly, next to the plugin
staticRootPlugin
, but we implement it inyarp-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 folderopenmctStaticServer/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:
- CommonJS: commonly used on Node.js, characterized by the use of
module.exports
andrequire()
.- AMD: commonly used on browser code, characterized by the use of
define[]()
andimport
.- ECMA Script (ES6): natively supported and commonly used on browser code, characterized by the use of
export
orexport default
andimport
.[x] Define StaticImportObjectPlugin rootIdentifiers in a dictionary
- Add a joint tracking exported panel .json file (left ankle pitch tracking) to the
exchange
folder.- add another call to
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 androotIdentifier
. For eachStaticImportObjectPlugin
install call, a differentrootIdentifier
is defined, with a specific unique namespace and always the keyroot
.- The identifiers
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
.- The leaf elements in the dictionary define the identifiers
rootIdentifier
.
Their specific namespace and key shall be used by thestaticImportObjectPlugin
plugin to overwrite the key and namespace of the root domain object containing the imported domain objects (rootIdentifier).- Folder objects in the dictionary have to be processed by the
ObjectProvider
defined in the dictionary plugin, while the leaf elements have to be processed by theStaticModelProvider
object provider defined in the pluginStaticImportObjectPlugin
. For that purpose, In the dictionary plugin,getFolderTelemetryEntryKeys
needs to return keys and namespaces, asrootIdentifier
object namespaces won't be the same as their parent folder.[x] Add input
rootLocation
toStaticImportObjectPlugin
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 aStaticImportObjectPlugin
instance inopenmctStaticServer/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 dictionarydictionaryMySavedPanels .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.
Originally posted by @nunoguedelha in https://github.com/ami-iit/yarp-openmct/issues/151#issuecomment-1319490278
@S-Dafarra @RiccardoGrieco you could already try this in your demo this week.
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" } ```