GithubHelp home page GithubHelp logo

Comments (7)

MatthijsBurgh avatar MatthijsBurgh commented on July 20, 2024

ping ;)

from geometry2.

MatthijsBurgh avatar MatthijsBurgh commented on July 20, 2024

@tfoote ping ;)

from geometry2.

tfoote avatar tfoote commented on July 20, 2024

There's no significant docs. You can find examples here and here

For converting:
You write a to and from message and register them with tf2_ros.ConvertRegistration()

For transforming:
You write the function to add it and then register it using the tf2_ros.TransformRegistration()

from geometry2.

MatthijsBurgh avatar MatthijsBurgh commented on July 20, 2024

For me it is unclear why all the to_msg and from_msg functions can just return the same message.

I would expect that if I have class A and I want to transform to class B, but there is no direct conversion from A to B, it will use the to_msg and from_msg way. So I have to go from A to a msg. Lets call it X. And then convert msg X to class B.

In my mind, msg X has to be ONE type of msg. As a random pair of to_msg and from_msg aren't compatible, unless the to_msg functions outputs a type, which the from_msg functions accepts. Otherwise AttributeError are doomed to happen IMO.

Maybe I am missing something, please explain.

from geometry2.

tfoote avatar tfoote commented on July 20, 2024

The first example I sent isn't the best as those datatypes are already messages. So the convert to and from message is an identity transform which is why they return themselves.

For the KDL datatypes you can see a more complex version https://github.com/ros/geometry2/blob/noetic-devel/tf2_kdl/src/tf2_kdl/tf2_kdl.py

The logic is to chain the conversions if they exist via a star topology. Any datatype X trying to go to Y look to apply from_msg<Y>(to_msg(X). Thus if X is already a msg it can return itself.

from geometry2.

MatthijsBurgh avatar MatthijsBurgh commented on July 20, 2024

What happens in the following situations?

  1. to_msg returns a PointStamped, but the from_msg can only handle PoseStamped as input.
  2. Again to_msg returns a PointStamped, but Y is a PoseStamped and its from_msg functions just returns the input msg. Just like
    def from_msg_msg(msg):
    return msg
    tf2_ros.ConvertRegistration().add_from_msg(Vector3Stamped, from_msg_msg)
    tf2_ros.ConvertRegistration().add_from_msg(PoseStamped, from_msg_msg)

from geometry2.

tfoote avatar tfoote commented on July 20, 2024
  1. The registrations are keyed on the datatype. A Vector3Stamped converter and a PoseStamped converter will never be chained.

  2. Those theto_msg and from_msg will not be paired like you said because they have different datatype keys.

The noop returns are required because in python we can't detect what the datatype is so we don't know if the datatype matches the input datatype. So convert always triggers to_msg then from_msg to make the conversion. If either end of that goal is already a message it will be the noop.

from geometry2.

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.