Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove parseRos2idl implementation #37

Merged
merged 2 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 6 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

[The Robot Operating System (ROS)](https://www.ros.org/) defines a simplified message description language for describing data types. This library parses those message definitions and can round trip them back into a canonical string format suitable for checksum generation. The parsed definitions are useful for serialization or deserialization when paired with other libraries.

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.
This library supports both [ROS1](http://wiki.ros.org/msg) and [ROS 2](https://docs.ros.org/en/galactic/Concepts/About-ROS-Interfaces.html) message definitions.

## Usage

```Typescript
import { parse, parseRos2idl, stringify } from "@foxglove/rosmsg";
import { parse, stringify } from "@foxglove/rosmsg";

const definitionStr = `# geometry_msgs/msg/Pose
geometry_msgs/msg/Point position
Expand All @@ -37,51 +37,6 @@ const messageDefinition = parse(definitionStr, {ros2: true}); // for ROS 2 defin

// stringify(messageDefinition) will return a canonical string, similar to
// _definitionStr_

// 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 {
double x;
double y;
double z;
};
};
};

================================================================================
IDL: geometry_msgs/msg/Quaternion

module geometry_msgs {
module msg {
struct Quaternion {
double x;
double y;
double z;
double w;
};
};
};
`;

const messageDefinition = parseRos2idl(ros2idlDefinitionStr);

// print the parsed message definition structure
console.log(JSON.stringify(messageDefinition, null, 2));
```
Expand Down Expand Up @@ -161,6 +116,10 @@ Prints:
]
```

## ROS 2 IDL Support

See (`@foxglove/ros2idl-parser`)[https://github.com/foxglove/omgidl/packages/ros2idl-parser] for our implementation of `ros2idl` schema support.

## License

@foxglove/rosmsg is licensed under the [MIT License](https://opensource.org/licenses/MIT).
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@foxglove/rosmsg",
"version": "4.2.2",
"description": "Parser for ROS .msg and .idl definitions",
"description": "Parser for ROS and ROS 2 .msg definitions",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -16,7 +16,6 @@
"msg",
"srv",
"msgdef",
"idl",
"parser",
"grammar"
],
Expand Down
Loading
Loading