@foxglove/rosmsg
Advanced tools
Comparing version 4.2.0 to 4.2.1
{ | ||
"name": "@foxglove/rosmsg", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"description": "Parser for ROS .msg and .idl definitions", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -11,3 +11,3 @@ # @foxglove/rosmsg | ||
This library supports both [ROS1](http://wiki.ros.org/msg) and [ROS2](https://docs.ros.org/en/galactic/Concepts/About-ROS-Interfaces.html) message definitions. | ||
This library supports both [ROS1](http://wiki.ros.org/msg), [ROS 2](https://docs.ros.org/en/galactic/Concepts/About-ROS-Interfaces.html), and the [ROS 2 IDL subset](https://design.ros2.org/articles/idl_interface_definition.html)message definitions. | ||
@@ -17,10 +17,10 @@ ## Usage | ||
```Typescript | ||
import { parse, stringify } from "@foxglove/rosmsg"; | ||
import { parse, parseRos2idl, stringify } from "@foxglove/rosmsg"; | ||
const definitionStr = `# geometry_msgs/Pose | ||
geometry_msgs/Point position | ||
geometry_msgs/Quaternion orientation | ||
const definitionStr = `# geometry_msgs/msg/Pose | ||
geometry_msgs/msg/Point position | ||
geometry_msgs/msg/Quaternion orientation | ||
=== | ||
MSG: geometry_msgs/Point | ||
MSG: geometry_msgs/msg/Point | ||
float64 x | ||
@@ -31,3 +31,3 @@ float64 y | ||
=== | ||
MSG: geometry_msgs/Quaternion | ||
MSG: geometry_msgs/msg/Quaternion | ||
float64 x | ||
@@ -44,2 +44,46 @@ float64 y | ||
// ROS2IDL equivalent example | ||
const ros2idlDefinitionStr = ` | ||
================================================================================ | ||
IDL: geometry_msgs/msg/Pose | ||
module geometry_msgs { | ||
module msg { | ||
struct Pose { | ||
geometry_msgs::msg::Point position; | ||
geometry_msgs::msg::Quaternion orientation; | ||
}; | ||
}; | ||
}; | ||
================================================================================ | ||
IDL: geometry_msgs/msg/Point | ||
module geometry_msgs { | ||
module msg { | ||
struct Point { | ||
long double x; | ||
long double y; | ||
long double z; | ||
}; | ||
}; | ||
}; | ||
================================================================================ | ||
IDL: geometry_msgs/msg/Quaternion | ||
module geometry_msgs { | ||
module msg { | ||
struct Quaternion { | ||
long double x; | ||
long double y; | ||
long double z; | ||
long double w; | ||
}; | ||
}; | ||
}; | ||
`; | ||
const messageDefinition = parseRos2idl(ros2idlDefinitionStr); | ||
// print the parsed message definition structure | ||
@@ -56,3 +100,3 @@ console.log(JSON.stringify(messageDefinition, null, 2)); | ||
{ | ||
"type": "geometry_msgs/Point", | ||
"type": "geometry_msgs/msg/Point", | ||
"isArray": false, | ||
@@ -63,3 +107,3 @@ "name": "position", | ||
{ | ||
"type": "geometry_msgs/Quaternion", | ||
"type": "geometry_msgs/msg/Quaternion", | ||
"isArray": false, | ||
@@ -72,3 +116,3 @@ "name": "orientation", | ||
{ | ||
"name": "geometry_msgs/Point", | ||
"name": "geometry_msgs/msg/Point", | ||
"definitions": [ | ||
@@ -96,3 +140,3 @@ { | ||
{ | ||
"name": "geometry_msgs/Quaternion", | ||
"name": "geometry_msgs/msg/Quaternion", | ||
"definitions": [ | ||
@@ -99,0 +143,0 @@ { |
@@ -295,3 +295,2 @@ import { parseRos2idl as parse } from "./parseRos2idl"; | ||
double double_value; | ||
long double long_double_value; | ||
char char_value; | ||
@@ -350,3 +349,3 @@ wchar wchar_value; | ||
{ | ||
type: "float32", | ||
type: "float64", | ||
name: "double_value", | ||
@@ -356,7 +355,2 @@ isComplex: false, | ||
{ | ||
type: "float64", | ||
name: "long_double_value", | ||
isComplex: false, | ||
}, | ||
{ | ||
type: "uint8", | ||
@@ -750,3 +744,3 @@ name: "char_value", | ||
const float FLOAT_CONSTANT = 1.25; | ||
const long double EXP_DOUBLE_CONSTANT = 1.25e-3; | ||
const double EXP_DOUBLE_CONSTANT = 1.25e-3; | ||
}; | ||
@@ -753,0 +747,0 @@ }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
468442
177
6453