Closed nunoguedelha closed 2 years ago
Replaced visualization of EE wrench on Hip by the one on the foot:
yarpName
in the portInConfig
table.ICubTelemetry.state
definition, update, and respective ICubTelemetry.generateTelemetry
and OpenMct dictionary entries.default.json
in a new configuration folder config
.default.json
holds: the ports configuration portInConfig
; the servers configurations telemVizServer
, consoleServer
and openmctStaticServer
, with the 'host' and 'port' fields; the Yarp ports prefix robotYarpPortPrefix
(/icub
, /icubSim
).default.json
has a JSON format but its format was extended to support the use of variables in the JSON literals:
{
"robotYarpPortPrefix": "/icubSim",
...
"portInConfig": {
"sens.imu": {
"yarpName": "${this.robotYarpPortPrefix}/inertial",
...
},
...
}
}
./config/processedDefault.js
, by using string interpolation in Template literals [1], and the eval
function [2]. A traversal function applies this processing to each Importing a Javascript (JSON syntax) object from a JSON
file can be done through the usual require
primitive but doesn't require exporting the object in the JSON
file using module.exports
.
JSON
object in Javascript: https://stackoverflow.com/questions/7163061/is-there-a-require-for-json-in-node-jsnode-config
: https://github.com/lorenwest/node-config, https://blog.logrocket.com/creating-configuration-files-node-js-using-node-config/
Node-config organizes hierarchical configurations for your app deployments. => default configuration, development configuration, etc. :warning: Requires Node.js ≥ v10.0.0.
Jsonnet
, a DSL for JSON available on npm
as a wrapper for Node.js: https://jsonnet.org/,https://github.com/yosuke-furukawa/node-jsonnet
=> Allows to use variables within the JSON format.
Jsonnet | Generated JSON |
```js { person1: { name: "Alice", welcome: "Hello " + self.name + "!", }, person2: self.person1 { name: "Bob" }, } ``` | ```json { "person1": { "name": "Alice", "welcome": "Hello Alice!" }, "person2": { "name": "Bob", "welcome": "Hello Bob!" } } ``` |
But for the following reasons, I preferred to stick to the raw JSON format:
node-config
, which would be interesting to deploy later on our module.${<variable-name>}
.This was fixed by using directly the address and port bound to the net.Server
class object returned by the server creation and launch:
const telemServer = app.listen(<port>, <host>, function () {...});
https://nodejs.org/api/net.html#class-netserver https://nodejs.org/api/net.html#serveraddress
Updated the README. Work completed.
Implemented in #74 .
CC @traversaro @S-Dafarra @RiccardoGrieco
icubSim