Giter Club home page Giter Club logo

Comments (9)

jhurliman avatar jhurliman commented on August 25, 2024 1

The @foxglove/ros1 library connects directly as a ROS 1 node using rostcp. It only supports ROS 1, but a separate ROS 2 library is in progress. It sounds like roslibjs is the right fit for what you need right now. Looking forward to what you create.

from rosmsg.

MrBlenny avatar MrBlenny commented on August 25, 2024 1

Yep thanks - was very helpful.
I've made a very basic version here which includes generated types for ros2 foxy. Hoping I'll find the time to add some of the other features soon.
https://github.com/Greenroom-Robotics/ros-typescript-generator

from rosmsg.

jhurliman avatar jhurliman commented on August 25, 2024

This is definitely possible, but the best way to approach it depends on what you're trying to achieve. Do you want to do binary serialization or deserialization of ROS messages? Or do you just need TypeScript definitions for the structure of your messages but don't need to actually (de)serialize? If you need serialization or deserialization, you'll need to pair this library with https://github.com/foxglove/rosmsg-serialization.

You can find an example of TypeScript definition generation in https://github.com/foxglove/rosmsg-msgs-common/blob/main/src/index.ts. It would need to be adapted to use either roslibjs + the websocket bridge or https://github.com/foxglove/ros1 for a direct ROS connection, and query for all data types + message definitions before creating .d.ts files.

If you provide more information about your use case I might be able to generalize it into an example tool we could include in one of these repos.

from rosmsg.

MrBlenny avatar MrBlenny commented on August 25, 2024

Thanks jhurliman.

That rosmsg-msgs-common generation / parse logic looks perfect. I'll have a go making and open-sourcing a CLI.

I was initially thinking about using roslibjs and simply annotating the topic.subscribe so the de/serialisation is not so critical. What are the benefits of foxglove's ros lib over roslibjs? (I am primaily using ros2)

from rosmsg.

amacneil avatar amacneil commented on August 25, 2024

Sounds like above question has been answered so closing issue. Feel free to add comments or reopen if needed.

from rosmsg.

amacneil avatar amacneil commented on August 25, 2024

Very cool!

from rosmsg.

defunctzombie avatar defunctzombie commented on August 25, 2024

@jhurliman Any plans to tackle this? I see you re-opened it some time ago and self-assigned.

from rosmsg.

jhurliman avatar jhurliman commented on August 25, 2024

This would be a good item to bump up the list. I will queue it up for the next week or two.

from rosmsg.

jhurliman avatar jhurliman commented on August 25, 2024

After looking into this further, I'm going to close the ticket as not planned. The main challenge is getting concatenated message definitions. This requires either connecting to rosbridge, implementing the same directory traversing logic from ROS1 ala gendeps --cat, and/or implementing ROS2 index parsing ala mcap convert. This kind of socket code, filesystem traversal, and index parsing code is currently outside the scope of this repository. It would be better suited for a separate repo similar to the ros-typescript-generator linked in a previous comment.

from rosmsg.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.