@foxglove/schemas 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +6 -0
- package/README.md +6 -5
- package/internal/generateRos.d.ts +3 -1
- package/internal/generateRos.d.ts.map +1 -1
- package/internal/generateRos.js +25 -11
- package/internal/generateRos.js.map +1 -1
- package/internal/generateRos.test.js +8 -8
- package/internal/generateRos.test.js.map +1 -1
- package/internal/generateRos.test.ts +8 -6
- package/internal/generateRos.ts +34 -17
- package/internal/schemas.d.ts.map +1 -1
- package/internal/schemas.js +17 -0
- package/internal/schemas.js.map +1 -1
- package/internal/schemas.ts +18 -0
- package/package.json +1 -1
- package/python/foxglove-schemas-flatbuffer/setup.cfg +1 -1
- package/python/foxglove-schemas-protobuf/setup.cfg +1 -1
- package/schemas/README.md +26 -0
- package/schemas/flatbuffer/LocationFix.fbs +8 -0
- package/schemas/jsonschema/LocationFix.json +20 -0
- package/schemas/jsonschema/index.d.ts +20 -0
- package/schemas/jsonschema/index.d.ts.map +1 -1
- package/schemas/jsonschema/index.js +20 -0
- package/schemas/jsonschema/index.js.map +1 -1
- package/schemas/jsonschema/index.ts +20 -0
- package/schemas/proto/foxglove/LocationFix.proto +8 -0
- package/schemas/ros1/LocationFix.msg +6 -0
- package/schemas/ros2/LocationFix.msg +6 -0
- package/schemas/typescript/LocationFix.d.ts +5 -0
- package/schemas/typescript/LocationFix.d.ts.map +1 -1
- package/schemas/typescript/LocationFix.ts +7 -0
- package/scripts/updateGeneratedFiles.js +6 -2
- package/scripts/updateGeneratedFiles.js.map +1 -1
- package/scripts/updateGeneratedFiles.ts +6 -2
package/.github/workflows/ci.yml
CHANGED
|
@@ -168,6 +168,12 @@ jobs:
|
|
|
168
168
|
package-name: foxglove_msgs
|
|
169
169
|
target-ros1-distro: ${{ matrix.ros_distribution }}
|
|
170
170
|
vcs-repo-file-url: ""
|
|
171
|
+
|
|
172
|
+
- name: Downgrade pydocstyle as a workaround for ament_lint error https://github.com/ament/ament_lint/pull/428
|
|
173
|
+
if: ${{ matrix.ros_distribution == 'galactic' }}
|
|
174
|
+
run: |
|
|
175
|
+
sudo pip install pydocstyle==6.1.1
|
|
176
|
+
|
|
171
177
|
- name: build and test ros2
|
|
172
178
|
if: ${{ matrix.ros_version == 2 }}
|
|
173
179
|
uses: ros-tooling/action-ros-ci@master
|
package/README.md
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Message schemas supported by [Foxglove Studio](https://studio.foxglove.dev)
|
|
4
4
|
|
|
5
|
-
| Language/Framework | Package name
|
|
6
|
-
| --------------------- |
|
|
7
|
-
| JavaScript/TypeScript | `@foxglove/schemas`
|
|
8
|
-
| Python + Protobuf | `foxglove-schemas-protobuf`
|
|
9
|
-
|
|
|
5
|
+
| Language/Framework | Package name | Version |
|
|
6
|
+
| --------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
+
| JavaScript/TypeScript | `@foxglove/schemas` | [](https://www.npmjs.com/package/@foxglove/schemas) |
|
|
8
|
+
| Python + Protobuf | `foxglove-schemas-protobuf` | [](https://pypi.org/project/foxglove-schemas-protobuf/) |
|
|
9
|
+
| Python + FlatBuffers | `foxglove-schemas-flatbuffer` | [](https://pypi.org/project/foxglove-schemas-flatbuffer/) |
|
|
10
|
+
| ROS | `foxglove_msgs` | [](https://index.ros.org/p/foxglove_msgs/github-foxglove-schemas/#melodic) [](https://index.ros.org/p/foxglove_msgs/github-foxglove-schemas/#noetic) [](https://index.ros.org/p/foxglove_msgs/github-foxglove-schemas/#foxy) [](https://index.ros.org/p/foxglove_msgs/github-foxglove-schemas/#galactic) [](https://index.ros.org/p/foxglove_msgs/github-foxglove-schemas/#humble) [](https://index.ros.org/p/foxglove_msgs/github-foxglove-schemas/#rolling) |
|
|
10
11
|
|
|
11
12
|
## Introduction
|
|
12
13
|
|
|
@@ -12,7 +12,9 @@ type RosMsgDefinitionWithDescription = {
|
|
|
12
12
|
rosFullInterfaceName: string;
|
|
13
13
|
fields: RosMsgFieldWithDescription[];
|
|
14
14
|
};
|
|
15
|
-
export declare function generateRosMsg(def: RosMsgDefinitionWithDescription
|
|
15
|
+
export declare function generateRosMsg(def: RosMsgDefinitionWithDescription, { rosVersion }: {
|
|
16
|
+
rosVersion: 1 | 2;
|
|
17
|
+
}): string;
|
|
16
18
|
export declare function generateRosMsgDefinition(schema: FoxgloveMessageSchema, { rosVersion }: {
|
|
17
19
|
rosVersion: 1 | 2;
|
|
18
20
|
}): RosMsgDefinitionWithDescription;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateRos.d.ts","sourceRoot":"","sources":["generateRos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAG9F,OAAO,EAAE,qBAAqB,EAAqB,MAAM,SAAS,CAAC;AAEnE,KAAK,0BAA0B,GAAG,sBAAsB,GAAG;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,KAAK,+BAA+B,GAAG;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,8GAA8G;IAC9G,oBAAoB,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,0BAA0B,EAAE,CAAC;CACtC,CAAC;
|
|
1
|
+
{"version":3,"file":"generateRos.d.ts","sourceRoot":"","sources":["generateRos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAG9F,OAAO,EAAE,qBAAqB,EAAqB,MAAM,SAAS,CAAC;AAEnE,KAAK,0BAA0B,GAAG,sBAAsB,GAAG;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,KAAK,+BAA+B,GAAG;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,8GAA8G;IAC9G,oBAAoB,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,0BAA0B,EAAE,CAAC;CACtC,CAAC;AAuBF,wBAAgB,cAAc,CAC5B,GAAG,EAAE,+BAA+B,EACpC,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,CAAC,GAAG,CAAC,CAAA;CAAE,GACpC,MAAM,CAsCR;AAmCD,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,qBAAqB,EAC7B,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,CAAC,GAAG,CAAC,CAAA;CAAE,GACpC,+BAA+B,CA0FjC;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,qBAAqB,EAC7B,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,CAAC,GAAG,CAAC,CAAA;CAAE,GACpC,MAAM,CA+BR"}
|
package/internal/generateRos.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateRosMsgMergedSchema = exports.generateRosMsgDefinition = exports.generateRosMsg = void 0;
|
|
4
4
|
const rosmsg_msgs_common_1 = require("@foxglove/rosmsg-msgs-common");
|
|
5
|
-
function primitiveToRos(type
|
|
5
|
+
function primitiveToRos(type) {
|
|
6
6
|
switch (type) {
|
|
7
7
|
case "string":
|
|
8
8
|
return "string";
|
|
@@ -10,13 +10,17 @@ function primitiveToRos(type, { rosVersion }) {
|
|
|
10
10
|
return "bool";
|
|
11
11
|
case "float64":
|
|
12
12
|
return "float64";
|
|
13
|
-
case "time":
|
|
14
|
-
return rosVersion === 2 ? "builtin_interfaces/Time" : "time";
|
|
15
|
-
case "duration":
|
|
16
|
-
return rosVersion === 2 ? "builtin_interfaces/Duration" : "duration";
|
|
17
13
|
}
|
|
18
14
|
}
|
|
19
|
-
function
|
|
15
|
+
function timeDurationToRos(type, { rosVersion }) {
|
|
16
|
+
if (type === "time") {
|
|
17
|
+
return rosVersion === 2 ? "builtin_interfaces/Time" : "time";
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return rosVersion === 2 ? "builtin_interfaces/Duration" : "duration";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function generateRosMsg(def, { rosVersion }) {
|
|
20
24
|
let source = "";
|
|
21
25
|
source += `# ${def.rosFullInterfaceName}\n`;
|
|
22
26
|
if (def.description != undefined) {
|
|
@@ -44,7 +48,11 @@ function generateRosMsg(def) {
|
|
|
44
48
|
}
|
|
45
49
|
constant = `=${field.valueText}`;
|
|
46
50
|
}
|
|
47
|
-
|
|
51
|
+
let type = field.type;
|
|
52
|
+
if (type === "time" || type === "duration") {
|
|
53
|
+
type = timeDurationToRos(type, { rosVersion });
|
|
54
|
+
}
|
|
55
|
+
source += `${type}${field.isArray === true ? `[${field.arrayLength ?? ""}]` : ""} ${field.name}${constant}\n`;
|
|
48
56
|
}
|
|
49
57
|
return source;
|
|
50
58
|
}
|
|
@@ -134,8 +142,14 @@ function generateRosMsgDefinition(schema, { rosVersion }) {
|
|
|
134
142
|
else if (field.type.name === "uint32") {
|
|
135
143
|
fieldType = "uint32";
|
|
136
144
|
}
|
|
145
|
+
else if (field.type.name === "time") {
|
|
146
|
+
fieldType = "time";
|
|
147
|
+
}
|
|
148
|
+
else if (field.type.name === "duration") {
|
|
149
|
+
fieldType = "duration";
|
|
150
|
+
}
|
|
137
151
|
else {
|
|
138
|
-
fieldType = primitiveToRos(field.type.name
|
|
152
|
+
fieldType = primitiveToRos(field.type.name);
|
|
139
153
|
}
|
|
140
154
|
break;
|
|
141
155
|
}
|
|
@@ -164,7 +178,7 @@ function generateRosMsgMergedSchema(schema, { rosVersion }) {
|
|
|
164
178
|
dependencies.push(dep);
|
|
165
179
|
}
|
|
166
180
|
}
|
|
167
|
-
let result = generateRosMsg(generateRosMsgDefinition(schema, { rosVersion }));
|
|
181
|
+
let result = generateRosMsg(generateRosMsgDefinition(schema, { rosVersion }), { rosVersion });
|
|
168
182
|
for (const dep of dependencies) {
|
|
169
183
|
let name;
|
|
170
184
|
let source;
|
|
@@ -175,12 +189,12 @@ function generateRosMsgMergedSchema(schema, { rosVersion }) {
|
|
|
175
189
|
rosMsgInterfaceName: dep.name,
|
|
176
190
|
rosFullInterfaceName: dep.name,
|
|
177
191
|
fields: rosmsg_msgs_common_1.ros1[dep.name].definitions,
|
|
178
|
-
});
|
|
192
|
+
}, { rosVersion });
|
|
179
193
|
}
|
|
180
194
|
else {
|
|
181
195
|
const definition = generateRosMsgDefinition(dep.schema, { rosVersion });
|
|
182
196
|
name = definition.rosMsgInterfaceName;
|
|
183
|
-
source = generateRosMsg(definition);
|
|
197
|
+
source = generateRosMsg(definition, { rosVersion });
|
|
184
198
|
}
|
|
185
199
|
result += `================================================================================\nMSG: ${name}\n${source}`;
|
|
186
200
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateRos.js","sourceRoot":"","sources":["generateRos.ts"],"names":[],"mappings":";;;AACA,qEAAoD;AAiBpD,SAAS,cAAc,CACrB,
|
|
1
|
+
{"version":3,"file":"generateRos.js","sourceRoot":"","sources":["generateRos.ts"],"names":[],"mappings":";;;AACA,qEAAoD;AAiBpD,SAAS,cAAc,CACrB,IAA0E;IAE1E,QAAQ,IAAI,EAAE;QACZ,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC;QAChB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;KACpB;AACH,CAAC;AAED,SAAS,iBA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AM,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;YACxE,IAAI,GAAG,UAAU,CAAC,mBAAmB,CAAC;YACtC,MAAM,GAAG,cAAc,CAAC,UAAU,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;SACrD;QACD,MAAM,IAAI,0FAA0F,IAAI,KAAK,MAAM,EAAE,CAAC;KACvH;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAlCD,gEAkCC"}
|
|
@@ -235,7 +235,7 @@ describe("generateRosMsgDefinition", () => {
|
|
|
235
235
|
"isArray": false,
|
|
236
236
|
"isComplex": false,
|
|
237
237
|
"name": "field_duration",
|
|
238
|
-
"type": "
|
|
238
|
+
"type": "duration",
|
|
239
239
|
},
|
|
240
240
|
{
|
|
241
241
|
"arrayLength": undefined,
|
|
@@ -243,7 +243,7 @@ describe("generateRosMsgDefinition", () => {
|
|
|
243
243
|
"isArray": false,
|
|
244
244
|
"isComplex": false,
|
|
245
245
|
"name": "field_time",
|
|
246
|
-
"type": "
|
|
246
|
+
"type": "time",
|
|
247
247
|
},
|
|
248
248
|
{
|
|
249
249
|
"arrayLength": undefined,
|
|
@@ -291,7 +291,7 @@ describe("generateRosMsgDefinition", () => {
|
|
|
291
291
|
"isArray": true,
|
|
292
292
|
"isComplex": false,
|
|
293
293
|
"name": "field_duration_array",
|
|
294
|
-
"type": "
|
|
294
|
+
"type": "duration",
|
|
295
295
|
},
|
|
296
296
|
{
|
|
297
297
|
"arrayLength": undefined,
|
|
@@ -299,7 +299,7 @@ describe("generateRosMsgDefinition", () => {
|
|
|
299
299
|
"isArray": true,
|
|
300
300
|
"isComplex": false,
|
|
301
301
|
"name": "field_time_array",
|
|
302
|
-
"type": "
|
|
302
|
+
"type": "time",
|
|
303
303
|
},
|
|
304
304
|
{
|
|
305
305
|
"arrayLength": undefined,
|
|
@@ -339,7 +339,7 @@ describe("generateRosMsgDefinition", () => {
|
|
|
339
339
|
"isArray": true,
|
|
340
340
|
"isComplex": false,
|
|
341
341
|
"name": "field_duration_fixed_array",
|
|
342
|
-
"type": "
|
|
342
|
+
"type": "duration",
|
|
343
343
|
},
|
|
344
344
|
{
|
|
345
345
|
"arrayLength": 3,
|
|
@@ -347,7 +347,7 @@ describe("generateRosMsgDefinition", () => {
|
|
|
347
347
|
"isArray": true,
|
|
348
348
|
"isComplex": false,
|
|
349
349
|
"name": "field_time_fixed_array",
|
|
350
|
-
"type": "
|
|
350
|
+
"type": "time",
|
|
351
351
|
},
|
|
352
352
|
{
|
|
353
353
|
"arrayLength": 3,
|
|
@@ -446,7 +446,7 @@ describe("generateRosMsg", () => {
|
|
|
446
446
|
it("generates msg file for ROS 1", () => {
|
|
447
447
|
expect((0, generateRos_1.generateRosMsg)((0, generateRos_1.generateRosMsgDefinition)(testFixtures_1.exampleMessageWithoutArrayOfBytes, {
|
|
448
448
|
rosVersion: 1,
|
|
449
|
-
}))).toMatchInlineSnapshot(`
|
|
449
|
+
}), { rosVersion: 1 })).toMatchInlineSnapshot(`
|
|
450
450
|
"# foxglove_msgs/ExampleMessage
|
|
451
451
|
# An example type
|
|
452
452
|
|
|
@@ -537,7 +537,7 @@ describe("generateRosMsg", () => {
|
|
|
537
537
|
it("generates msg file for ROS 2", () => {
|
|
538
538
|
expect((0, generateRos_1.generateRosMsg)((0, generateRos_1.generateRosMsgDefinition)(testFixtures_1.exampleMessageWithoutArrayOfBytes, {
|
|
539
539
|
rosVersion: 2,
|
|
540
|
-
}))).toMatchInlineSnapshot(`
|
|
540
|
+
}), { rosVersion: 2 })).toMatchInlineSnapshot(`
|
|
541
541
|
"# foxglove_msgs/msg/ExampleMessage
|
|
542
542
|
# An example type
|
|
543
543
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateRos.test.js","sourceRoot":"","sources":["generateRos.test.ts"],"names":[],"mappings":";;AAAA,6CAAmE;AAEnE,+CAIuB;AACvB,uCAAmD;AACnD,iDAAmE;AAEnE,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAA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C9E,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QAEhB,MAAM,CAAC,GAAG,EAAE,CACV,IAAA,cAAsB,EAAC,IAAA,wCAA0B,EAAC,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAC9F,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -239,7 +239,7 @@ describe("generateRosMsgDefinition", () => {
|
|
|
239
239
|
"isArray": false,
|
|
240
240
|
"isComplex": false,
|
|
241
241
|
"name": "field_duration",
|
|
242
|
-
"type": "
|
|
242
|
+
"type": "duration",
|
|
243
243
|
},
|
|
244
244
|
{
|
|
245
245
|
"arrayLength": undefined,
|
|
@@ -247,7 +247,7 @@ describe("generateRosMsgDefinition", () => {
|
|
|
247
247
|
"isArray": false,
|
|
248
248
|
"isComplex": false,
|
|
249
249
|
"name": "field_time",
|
|
250
|
-
"type": "
|
|
250
|
+
"type": "time",
|
|
251
251
|
},
|
|
252
252
|
{
|
|
253
253
|
"arrayLength": undefined,
|
|
@@ -295,7 +295,7 @@ describe("generateRosMsgDefinition", () => {
|
|
|
295
295
|
"isArray": true,
|
|
296
296
|
"isComplex": false,
|
|
297
297
|
"name": "field_duration_array",
|
|
298
|
-
"type": "
|
|
298
|
+
"type": "duration",
|
|
299
299
|
},
|
|
300
300
|
{
|
|
301
301
|
"arrayLength": undefined,
|
|
@@ -303,7 +303,7 @@ describe("generateRosMsgDefinition", () => {
|
|
|
303
303
|
"isArray": true,
|
|
304
304
|
"isComplex": false,
|
|
305
305
|
"name": "field_time_array",
|
|
306
|
-
"type": "
|
|
306
|
+
"type": "time",
|
|
307
307
|
},
|
|
308
308
|
{
|
|
309
309
|
"arrayLength": undefined,
|
|
@@ -343,7 +343,7 @@ describe("generateRosMsgDefinition", () => {
|
|
|
343
343
|
"isArray": true,
|
|
344
344
|
"isComplex": false,
|
|
345
345
|
"name": "field_duration_fixed_array",
|
|
346
|
-
"type": "
|
|
346
|
+
"type": "duration",
|
|
347
347
|
},
|
|
348
348
|
{
|
|
349
349
|
"arrayLength": 3,
|
|
@@ -351,7 +351,7 @@ describe("generateRosMsgDefinition", () => {
|
|
|
351
351
|
"isArray": true,
|
|
352
352
|
"isComplex": false,
|
|
353
353
|
"name": "field_time_fixed_array",
|
|
354
|
-
"type": "
|
|
354
|
+
"type": "time",
|
|
355
355
|
},
|
|
356
356
|
{
|
|
357
357
|
"arrayLength": 3,
|
|
@@ -454,6 +454,7 @@ describe("generateRosMsg", () => {
|
|
|
454
454
|
generateRosMsgDefinition(exampleMessageWithoutArrayOfBytes, {
|
|
455
455
|
rosVersion: 1,
|
|
456
456
|
}),
|
|
457
|
+
{ rosVersion: 1 },
|
|
457
458
|
),
|
|
458
459
|
).toMatchInlineSnapshot(`
|
|
459
460
|
"# foxglove_msgs/ExampleMessage
|
|
@@ -550,6 +551,7 @@ describe("generateRosMsg", () => {
|
|
|
550
551
|
generateRosMsgDefinition(exampleMessageWithoutArrayOfBytes, {
|
|
551
552
|
rosVersion: 2,
|
|
552
553
|
}),
|
|
554
|
+
{ rosVersion: 2 },
|
|
553
555
|
),
|
|
554
556
|
).toMatchInlineSnapshot(`
|
|
555
557
|
"# foxglove_msgs/msg/ExampleMessage
|
package/internal/generateRos.ts
CHANGED
|
@@ -17,8 +17,7 @@ type RosMsgDefinitionWithDescription = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
function primitiveToRos(
|
|
20
|
-
type: Exclude<FoxglovePrimitive, "uint32" | "bytes">,
|
|
21
|
-
{ rosVersion }: { rosVersion: 1 | 2 },
|
|
20
|
+
type: Exclude<FoxglovePrimitive, "uint32" | "bytes" | "time" | "duration">,
|
|
22
21
|
) {
|
|
23
22
|
switch (type) {
|
|
24
23
|
case "string":
|
|
@@ -27,14 +26,21 @@ function primitiveToRos(
|
|
|
27
26
|
return "bool";
|
|
28
27
|
case "float64":
|
|
29
28
|
return "float64";
|
|
30
|
-
case "time":
|
|
31
|
-
return rosVersion === 2 ? "builtin_interfaces/Time" : "time";
|
|
32
|
-
case "duration":
|
|
33
|
-
return rosVersion === 2 ? "builtin_interfaces/Duration" : "duration";
|
|
34
29
|
}
|
|
35
30
|
}
|
|
36
31
|
|
|
37
|
-
|
|
32
|
+
function timeDurationToRos(type: "time" | "duration", { rosVersion }: { rosVersion: 1 | 2 }) {
|
|
33
|
+
if (type === "time") {
|
|
34
|
+
return rosVersion === 2 ? "builtin_interfaces/Time" : "time";
|
|
35
|
+
} else {
|
|
36
|
+
return rosVersion === 2 ? "builtin_interfaces/Duration" : "duration";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function generateRosMsg(
|
|
41
|
+
def: RosMsgDefinitionWithDescription,
|
|
42
|
+
{ rosVersion }: { rosVersion: 1 | 2 },
|
|
43
|
+
): string {
|
|
38
44
|
let source = "";
|
|
39
45
|
source += `# ${def.rosFullInterfaceName}\n`;
|
|
40
46
|
if (def.description != undefined) {
|
|
@@ -63,7 +69,11 @@ export function generateRosMsg(def: RosMsgDefinitionWithDescription): string {
|
|
|
63
69
|
}
|
|
64
70
|
constant = `=${field.valueText}`;
|
|
65
71
|
}
|
|
66
|
-
|
|
72
|
+
let type = field.type;
|
|
73
|
+
if (type === "time" || type === "duration") {
|
|
74
|
+
type = timeDurationToRos(type, { rosVersion });
|
|
75
|
+
}
|
|
76
|
+
source += `${type}${field.isArray === true ? `[${field.arrayLength ?? ""}]` : ""} ${
|
|
67
77
|
field.name
|
|
68
78
|
}${constant}\n`;
|
|
69
79
|
}
|
|
@@ -169,8 +179,12 @@ export function generateRosMsgDefinition(
|
|
|
169
179
|
isArray = true;
|
|
170
180
|
} else if (field.type.name === "uint32") {
|
|
171
181
|
fieldType = "uint32";
|
|
182
|
+
} else if (field.type.name === "time") {
|
|
183
|
+
fieldType = "time";
|
|
184
|
+
} else if (field.type.name === "duration") {
|
|
185
|
+
fieldType = "duration";
|
|
172
186
|
} else {
|
|
173
|
-
fieldType = primitiveToRos(field.type.name
|
|
187
|
+
fieldType = primitiveToRos(field.type.name);
|
|
174
188
|
}
|
|
175
189
|
break;
|
|
176
190
|
}
|
|
@@ -205,22 +219,25 @@ export function generateRosMsgMergedSchema(
|
|
|
205
219
|
}
|
|
206
220
|
}
|
|
207
221
|
|
|
208
|
-
let result = generateRosMsg(generateRosMsgDefinition(schema, { rosVersion }));
|
|
222
|
+
let result = generateRosMsg(generateRosMsgDefinition(schema, { rosVersion }), { rosVersion });
|
|
209
223
|
for (const dep of dependencies) {
|
|
210
224
|
let name: string;
|
|
211
225
|
let source: string;
|
|
212
226
|
if (dep.type === "ros") {
|
|
213
227
|
name = dep.name;
|
|
214
|
-
source = generateRosMsg(
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
228
|
+
source = generateRosMsg(
|
|
229
|
+
{
|
|
230
|
+
originalName: dep.name,
|
|
231
|
+
rosMsgInterfaceName: dep.name,
|
|
232
|
+
rosFullInterfaceName: dep.name,
|
|
233
|
+
fields: ros1[dep.name].definitions,
|
|
234
|
+
},
|
|
235
|
+
{ rosVersion },
|
|
236
|
+
);
|
|
220
237
|
} else {
|
|
221
238
|
const definition = generateRosMsgDefinition(dep.schema, { rosVersion });
|
|
222
239
|
name = definition.rosMsgInterfaceName;
|
|
223
|
-
source = generateRosMsg(definition);
|
|
240
|
+
source = generateRosMsg(definition, { rosVersion });
|
|
224
241
|
}
|
|
225
242
|
result += `================================================================================\nMSG: ${name}\n${source}`;
|
|
226
243
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AA64CpE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsClC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;CAO/B,CAAC"}
|
package/internal/schemas.js
CHANGED
|
@@ -1157,31 +1157,48 @@ const LocationFix = {
|
|
|
1157
1157
|
name: "LocationFix",
|
|
1158
1158
|
description: "A navigation satellite fix for any Global Navigation Satellite System",
|
|
1159
1159
|
fields: [
|
|
1160
|
+
{
|
|
1161
|
+
name: "timestamp",
|
|
1162
|
+
type: { type: "primitive", name: "time" },
|
|
1163
|
+
description: "Timestamp of the message",
|
|
1164
|
+
protobufFieldNumber: 6,
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
name: "frame_id",
|
|
1168
|
+
type: { type: "primitive", name: "string" },
|
|
1169
|
+
description: "Frame for the sensor. Latitude and longitude readings are at the origin of the frame.",
|
|
1170
|
+
protobufFieldNumber: 7,
|
|
1171
|
+
},
|
|
1160
1172
|
{
|
|
1161
1173
|
name: "latitude",
|
|
1162
1174
|
type: { type: "primitive", name: "float64" },
|
|
1163
1175
|
description: "Latitude in degrees",
|
|
1176
|
+
protobufFieldNumber: 1,
|
|
1164
1177
|
},
|
|
1165
1178
|
{
|
|
1166
1179
|
name: "longitude",
|
|
1167
1180
|
type: { type: "primitive", name: "float64" },
|
|
1168
1181
|
description: "Longitude in degrees",
|
|
1182
|
+
protobufFieldNumber: 2,
|
|
1169
1183
|
},
|
|
1170
1184
|
{
|
|
1171
1185
|
name: "altitude",
|
|
1172
1186
|
type: { type: "primitive", name: "float64" },
|
|
1173
1187
|
description: "Altitude in meters",
|
|
1188
|
+
protobufFieldNumber: 3,
|
|
1174
1189
|
},
|
|
1175
1190
|
{
|
|
1176
1191
|
name: "position_covariance",
|
|
1177
1192
|
type: { type: "primitive", name: "float64" },
|
|
1178
1193
|
description: "Position covariance (m^2) defined relative to a tangential plane through the reported position. The components are East, North, and Up (ENU), in row-major order.",
|
|
1179
1194
|
array: 9,
|
|
1195
|
+
protobufFieldNumber: 4,
|
|
1180
1196
|
},
|
|
1181
1197
|
{
|
|
1182
1198
|
name: "position_covariance_type",
|
|
1183
1199
|
type: { type: "enum", enum: PositionCovarianceType },
|
|
1184
1200
|
description: "If `position_covariance` is available, `position_covariance_type` must be set to indicate the type of covariance.",
|
|
1201
|
+
protobufFieldNumber: 5,
|
|
1185
1202
|
},
|
|
1186
1203
|
],
|
|
1187
1204
|
};
|