-
 

flex_sync package from flex_sync repo

flex_sync

Package Summary

Tags No category tags.
Version 2.0.0
License Apache2
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros-misc-utilities/flex_sync.git
VCS Type git
VCS Version release
Last Updated 2024-06-28
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

ros2 package for syncing variable number of topics

Additional Links

No additional links.

Maintainers

  • Bernd Pfrommer

Authors

No additional authors.

flex_sync

This ROS2 package with headers-only library that implements a message synchronization filter. It is similar to the well-known message_filters package, but is more flexible in that the number of topics to be synchronized does not have to be known at compile time, just their message types. This can be useful when you don’t know beforehand how many sensors of a given type will be on the robot.

Just like message_filters, flex_sync offers exact and approximate synchronization policies.

How to use

Here is code snippet that shows how to perform an exact synchronization between two Image messages and one Imu message:

    using sensor_msg::msg::Image;
    using sensor_msg::msg::Imu;
    using CallbackType = std::function<void(const std::vector<Image::ConstSharedPtr> &,
            const std::vector<Imu::ConstSharedPtr> &)>;

    class MyTest { // define class to handle callbacks
        public:
        void callback(const std::vector<Image::ConstSharedPtr> & msgvec1,
                      const std::vector<Imu::ConstSharedPtr> & msgvec2) {
            // should print out "got msgs: 2 + 1"
            std::cout << "got msgs: " << msgvec1.size() << " + " << msgvec2.size() << std::endl;
        }
    };
    MyTest my_test; // instantiate object to handle synchronized callbacks
    // synchronize two Image topics and one Imu topic
    const std::vector<std::vector<std::string>> topics =
       {{"image_topic_1", "image_topic_2"}, {"imu_topic_1"}};
    const size_t q_size = 10; // depth of sync queue
    flex_sync::ExactSync<Image, Imu> sync(topics,
        std::bind(&MyTest::callback, &my_test, std::placeholders::_1, std::placeholders::_2),
        q_size);
    // now feed images and IMU messages into the sync. If
    // the sync is successful there will be callbacks to MyTest::callback()
    sync->process("image_topic_1", std::make_shared<Image>()); // replace with valid message
    sync->process("image_topic_2", std::make_shared<Image>());
    sync->process("imu_topic_1", std::make_shared<Imu>());

Note that the number of topics does not have to be known at compile time, but it cannot change during the life time of the sync object.

Special note from the author

The code in this repo is absolutely hideous. The template syntax is cryptic to begin with, and I don’t use templates often enough to become good at them. Don’t ask me any questions on how this code works, I no longer understand it myself. It certainly could use some cleaning up by somebody who knows templates better. Having that said, I have not discovered any obvious bugs so far and I use it in two projects.

If you want to understand better how the sync code works, look at the ROS1 documentation and in particular the adaptive algorithm for the approximate time sync.

License

This software and any future contributions to it are licensed under the Apache License 2.0.

CHANGELOG

Changelog for package flex_sync

2.0.0 (2024-06-28)

  • initial release as ROS2 package
  • Contributors: Bernd Pfrommer

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged flex_sync at Robotics Stack Exchange

flex_sync package from flex_sync repo

flex_sync

Package Summary

Tags No category tags.
Version 2.0.0
License Apache2
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros-misc-utilities/flex_sync.git
VCS Type git
VCS Version release
Last Updated 2024-06-28
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

ros2 package for syncing variable number of topics

Additional Links

No additional links.

Maintainers

  • Bernd Pfrommer

Authors

No additional authors.

flex_sync

This ROS2 package with headers-only library that implements a message synchronization filter. It is similar to the well-known message_filters package, but is more flexible in that the number of topics to be synchronized does not have to be known at compile time, just their message types. This can be useful when you don’t know beforehand how many sensors of a given type will be on the robot.

Just like message_filters, flex_sync offers exact and approximate synchronization policies.

How to use

Here is code snippet that shows how to perform an exact synchronization between two Image messages and one Imu message:

    using sensor_msg::msg::Image;
    using sensor_msg::msg::Imu;
    using CallbackType = std::function<void(const std::vector<Image::ConstSharedPtr> &,
            const std::vector<Imu::ConstSharedPtr> &)>;

    class MyTest { // define class to handle callbacks
        public:
        void callback(const std::vector<Image::ConstSharedPtr> & msgvec1,
                      const std::vector<Imu::ConstSharedPtr> & msgvec2) {
            // should print out "got msgs: 2 + 1"
            std::cout << "got msgs: " << msgvec1.size() << " + " << msgvec2.size() << std::endl;
        }
    };
    MyTest my_test; // instantiate object to handle synchronized callbacks
    // synchronize two Image topics and one Imu topic
    const std::vector<std::vector<std::string>> topics =
       {{"image_topic_1", "image_topic_2"}, {"imu_topic_1"}};
    const size_t q_size = 10; // depth of sync queue
    flex_sync::ExactSync<Image, Imu> sync(topics,
        std::bind(&MyTest::callback, &my_test, std::placeholders::_1, std::placeholders::_2),
        q_size);
    // now feed images and IMU messages into the sync. If
    // the sync is successful there will be callbacks to MyTest::callback()
    sync->process("image_topic_1", std::make_shared<Image>()); // replace with valid message
    sync->process("image_topic_2", std::make_shared<Image>());
    sync->process("imu_topic_1", std::make_shared<Imu>());

Note that the number of topics does not have to be known at compile time, but it cannot change during the life time of the sync object.

Special note from the author

The code in this repo is absolutely hideous. The template syntax is cryptic to begin with, and I don’t use templates often enough to become good at them. Don’t ask me any questions on how this code works, I no longer understand it myself. It certainly could use some cleaning up by somebody who knows templates better. Having that said, I have not discovered any obvious bugs so far and I use it in two projects.

If you want to understand better how the sync code works, look at the ROS1 documentation and in particular the adaptive algorithm for the approximate time sync.

License

This software and any future contributions to it are licensed under the Apache License 2.0.

CHANGELOG

Changelog for package flex_sync

2.0.0 (2024-06-28)

  • initial release as ROS2 package
  • Contributors: Bernd Pfrommer

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged flex_sync at Robotics Stack Exchange

flex_sync package from flex_sync repo

flex_sync

Package Summary

Tags No category tags.
Version 2.0.0
License Apache2
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros-misc-utilities/flex_sync.git
VCS Type git
VCS Version release
Last Updated 2024-06-28
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

ros2 package for syncing variable number of topics

Additional Links

No additional links.

Maintainers

  • Bernd Pfrommer

Authors

No additional authors.

flex_sync

This ROS2 package with headers-only library that implements a message synchronization filter. It is similar to the well-known message_filters package, but is more flexible in that the number of topics to be synchronized does not have to be known at compile time, just their message types. This can be useful when you don’t know beforehand how many sensors of a given type will be on the robot.

Just like message_filters, flex_sync offers exact and approximate synchronization policies.

How to use

Here is code snippet that shows how to perform an exact synchronization between two Image messages and one Imu message:

    using sensor_msg::msg::Image;
    using sensor_msg::msg::Imu;
    using CallbackType = std::function<void(const std::vector<Image::ConstSharedPtr> &,
            const std::vector<Imu::ConstSharedPtr> &)>;

    class MyTest { // define class to handle callbacks
        public:
        void callback(const std::vector<Image::ConstSharedPtr> & msgvec1,
                      const std::vector<Imu::ConstSharedPtr> & msgvec2) {
            // should print out "got msgs: 2 + 1"
            std::cout << "got msgs: " << msgvec1.size() << " + " << msgvec2.size() << std::endl;
        }
    };
    MyTest my_test; // instantiate object to handle synchronized callbacks
    // synchronize two Image topics and one Imu topic
    const std::vector<std::vector<std::string>> topics =
       {{"image_topic_1", "image_topic_2"}, {"imu_topic_1"}};
    const size_t q_size = 10; // depth of sync queue
    flex_sync::ExactSync<Image, Imu> sync(topics,
        std::bind(&MyTest::callback, &my_test, std::placeholders::_1, std::placeholders::_2),
        q_size);
    // now feed images and IMU messages into the sync. If
    // the sync is successful there will be callbacks to MyTest::callback()
    sync->process("image_topic_1", std::make_shared<Image>()); // replace with valid message
    sync->process("image_topic_2", std::make_shared<Image>());
    sync->process("imu_topic_1", std::make_shared<Imu>());

Note that the number of topics does not have to be known at compile time, but it cannot change during the life time of the sync object.

Special note from the author

The code in this repo is absolutely hideous. The template syntax is cryptic to begin with, and I don’t use templates often enough to become good at them. Don’t ask me any questions on how this code works, I no longer understand it myself. It certainly could use some cleaning up by somebody who knows templates better. Having that said, I have not discovered any obvious bugs so far and I use it in two projects.

If you want to understand better how the sync code works, look at the ROS1 documentation and in particular the adaptive algorithm for the approximate time sync.

License

This software and any future contributions to it are licensed under the Apache License 2.0.

CHANGELOG

Changelog for package flex_sync

2.0.0 (2024-06-28)

  • initial release as ROS2 package
  • Contributors: Bernd Pfrommer

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged flex_sync at Robotics Stack Exchange

flex_sync package from flex_sync repo

flex_sync

Package Summary

Tags No category tags.
Version 2.0.0
License Apache2
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Checkout URI https://github.com/ros-misc-utilities/flex_sync.git
VCS Type git
VCS Version release
Last Updated 2024-06-28
Dev Status DEVELOPED
CI status No Continuous Integration
Released RELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

ros2 package for syncing variable number of topics

Additional Links

No additional links.

Maintainers

  • Bernd Pfrommer

Authors

No additional authors.

flex_sync

This ROS2 package with headers-only library that implements a message synchronization filter. It is similar to the well-known message_filters package, but is more flexible in that the number of topics to be synchronized does not have to be known at compile time, just their message types. This can be useful when you don’t know beforehand how many sensors of a given type will be on the robot.

Just like message_filters, flex_sync offers exact and approximate synchronization policies.

How to use

Here is code snippet that shows how to perform an exact synchronization between two Image messages and one Imu message:

    using sensor_msg::msg::Image;
    using sensor_msg::msg::Imu;
    using CallbackType = std::function<void(const std::vector<Image::ConstSharedPtr> &,
            const std::vector<Imu::ConstSharedPtr> &)>;

    class MyTest { // define class to handle callbacks
        public:
        void callback(const std::vector<Image::ConstSharedPtr> & msgvec1,
                      const std::vector<Imu::ConstSharedPtr> & msgvec2) {
            // should print out "got msgs: 2 + 1"
            std::cout << "got msgs: " << msgvec1.size() << " + " << msgvec2.size() << std::endl;
        }
    };
    MyTest my_test; // instantiate object to handle synchronized callbacks
    // synchronize two Image topics and one Imu topic
    const std::vector<std::vector<std::string>> topics =
       {{"image_topic_1", "image_topic_2"}, {"imu_topic_1"}};
    const size_t q_size = 10; // depth of sync queue
    flex_sync::ExactSync<Image, Imu> sync(topics,
        std::bind(&MyTest::callback, &my_test, std::placeholders::_1, std::placeholders::_2),
        q_size);
    // now feed images and IMU messages into the sync. If
    // the sync is successful there will be callbacks to MyTest::callback()
    sync->process("image_topic_1", std::make_shared<Image>()); // replace with valid message
    sync->process("image_topic_2", std::make_shared<Image>());
    sync->process("imu_topic_1", std::make_shared<Imu>());

Note that the number of topics does not have to be known at compile time, but it cannot change during the life time of the sync object.

Special note from the author

The code in this repo is absolutely hideous. The template syntax is cryptic to begin with, and I don’t use templates often enough to become good at them. Don’t ask me any questions on how this code works, I no longer understand it myself. It certainly could use some cleaning up by somebody who knows templates better. Having that said, I have not discovered any obvious bugs so far and I use it in two projects.

If you want to understand better how the sync code works, look at the ROS1 documentation and in particular the adaptive algorithm for the approximate time sync.

License

This software and any future contributions to it are licensed under the Apache License 2.0.

CHANGELOG

Changelog for package flex_sync

2.0.0 (2024-06-28)

  • initial release as ROS2 package
  • Contributors: Bernd Pfrommer

Wiki Tutorials

This package does not provide any links to tutorials in it's rosindex metadata. You can check on the ROS Wiki Tutorials page for the package.

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged flex_sync at Robotics Stack Exchange

No version for distro noetic. Known supported distros are highlighted in the buttons above.
No version for distro ardent. Known supported distros are highlighted in the buttons above.
No version for distro bouncy. Known supported distros are highlighted in the buttons above.
No version for distro crystal. Known supported distros are highlighted in the buttons above.
No version for distro eloquent. Known supported distros are highlighted in the buttons above.
No version for distro dashing. Known supported distros are highlighted in the buttons above.
No version for distro galactic. Known supported distros are highlighted in the buttons above.
No version for distro foxy. Known supported distros are highlighted in the buttons above.
No version for distro lunar. Known supported distros are highlighted in the buttons above.
No version for distro jade. Known supported distros are highlighted in the buttons above.
No version for distro indigo. Known supported distros are highlighted in the buttons above.
No version for distro hydro. Known supported distros are highlighted in the buttons above.
No version for distro kinetic. Known supported distros are highlighted in the buttons above.
No version for distro melodic. Known supported distros are highlighted in the buttons above.