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

Header format changed in ROS2 #109

Open
tlpss opened this issue Feb 3, 2023 · 3 comments
Open

Header format changed in ROS2 #109

tlpss opened this issue Feb 3, 2023 · 3 comments

Comments

@tlpss
Copy link

tlpss commented Feb 3, 2023

The sequence ID has apparently been dropped in ROS2 so if you try to use the Header class you get an error:
image

self.data["seq"] = seq

Possible solutions include a flag to switch between ROS1 and ROS2 or adding a separate ROS2 Header class:

class ROS2Header(UserDict):
    """Represents a message header of the ROS 2 type std_msgs/Header."""

    def __init__(self, stamp=None, frame_id=None):
        self.data = {}
        self.data["stamp"] = Time(stamp["secs"], stamp["nsecs"]) if stamp else None
        self.data["frame_id"] = frame_id
@tlpss
Copy link
Author

tlpss commented Feb 3, 2023

and this would also require dealing with the new class here

@gonzalocasas
Copy link
Member

Thanks for the report!

@LeisAlAyoubi
Copy link

The sequence ID has apparently been dropped in ROS2 so if you try to use the Header class you get an error: image

self.data["seq"] = seq

Possible solutions include a flag to switch between ROS1 and ROS2 or adding a separate ROS2 Header class:

class ROS2Header(UserDict):
    """Represents a message header of the ROS 2 type std_msgs/Header."""

    def __init__(self, stamp=None, frame_id=None):
        self.data = {}
        self.data["stamp"] = Time(stamp["secs"], stamp["nsecs"]) if stamp else None
        self.data["frame_id"] = frame_id

I'm using your ROS2Header-Class but when Im echoing the topic and looking at the message, It seems that the frame_id is not being populated with the string I put in. It works fine with the stamp tho. Is this an issue for you too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants