GithubHelp home page GithubHelp logo

Comments (9)

facontidavide avatar facontidavide commented on June 13, 2024

I need more context to answer this question.
Serialization and deserialization need a schema, as it is called in most of serialization libraries.
In ROS a schema is the MessageDefinition.

When you want to serialize message, which schema are you using? Will it be a ROS message or your own?

For example, let's say that you deserialized a JointState.

Now you are telling me that you want to "serialize it back". What do you mean exactly?

If your answer is "just re-publish the very same message as I received as a JointState" than it is easy using ShapeShifter.

from ros_type_introspection.

rhaschke avatar rhaschke commented on June 13, 2024

Let's keep the example of a JointState msg. I received the message, deserialized it with your lib, now modified some values in the data structures provided by the deserialization output. This modified output should now be serialized again (of course using the same message definition) and published.

from ros_type_introspection.

facontidavide avatar facontidavide commented on June 13, 2024

Good news: I can do this and I can create an example that show you how.
Bad news: it is impossible to change the size of any vector, including strings.

In my use case, I was changing the timestamp, so no problem:

https://github.com/facontidavide/PlotJuggler/blob/master/plugins/ROS/TopicPublisherROS/statepublisher_rostopic.cpp#L189-L209

If you want to change values of a Pose, Point, Quaternion, Time, values in a covariance matrix, or any other type with fixed size, than it is OK.

Adding generic serialization capabilities to this library would require a lot of work, and I am not planning to work on this.

Unless, of course, there is a client that really need this and is willing to sponsor its development ;)

from ros_type_introspection.

rhaschke avatar rhaschke commented on June 13, 2024

The PlotJuggler example, you are referring to, actually uses ROS serialization/deserialization methods for the compile-time-known Header type. In my case, the type would not be known at compile time.
Would this still be possible?

from ros_type_introspection.

facontidavide avatar facontidavide commented on June 13, 2024

Would this still be possible?

Out of the box? No.

I can imagine how this can be done, but only if we never change the size of any array/string.

Saving somewhere the offset in memory for each field, if should be possible to rewrite an area of the serialized memory in place, and later you can republish it using ShapeShifter.

from ros_type_introspection.

rhaschke avatar rhaschke commented on June 13, 2024

Would this still be possible?

Out of the box? No.

That's a pity. Thanks a lot anyways. I'm sure your work will be useful for me in another context in the future.

from ros_type_introspection.

facontidavide avatar facontidavide commented on June 13, 2024

If you need this feature or, in general, if you need this library to be adapted to your needs, you may want to consider the possibility to hire me as freelancer to modify the original code.
Whenever an open source is sponsored, I am happy to offer rates well below the standard in our industry.

If you are interested, you can contact me at [email protected]

from ros_type_introspection.

facontidavide avatar facontidavide commented on June 13, 2024

I just pushed a branch related to this issue, just in case...

from ros_type_introspection.

rhaschke avatar rhaschke commented on June 13, 2024

Thanks for this offer, but I can't pay software development myself.
I would be happy to be paid for my open-source activity as well ;-)

from ros_type_introspection.

Related Issues (20)

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.