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

fuse -> ROS 2 fuse_publishers: Port fuse_publishers #299

Merged
merged 5 commits into from
Dec 30, 2022

Conversation

methylDragon
Copy link
Collaborator

@methylDragon methylDragon commented Dec 15, 2022

See: #276

Description

This PR ports the entirety of fuse_publishers, including:

  • CMakeLists and packages
  • Source code
  • Tests
  • Other stuff like docs are in other PRs.

Notably, the AsyncPublisher class in fuse_core was updated (together with its tests)
I also changed the signature of its constructor to make use of initialize to set executor threads as well as pass it the appropriate NodeInterfaces.

In order to avoid specifying all manner of node interfaces in the AsyncPublisher class, I made it so that the derived publisher classes shadow their internal interface variable (and also call the parent's initialize method).

TODOs were left in downstream packages (models and tutorials) to update the usage of AsyncPublisher just like how it was done in fuse_publishers.


Furthermore, there's a missing signature in tf2_ros::Buffer that allows for buffer construction with node-like types. I left a TODO. I don't think it's too important, since it's only for logging/debugging with service calls.

Also, I realized I could just declare parameters instead of loading them in via yaml files, so I changed around some of the tests to reflect that...

Notes

Pinging @svwilliams for visibility.

@methylDragon methylDragon force-pushed the rolling-publishers branch 5 times, most recently from 96bfbd8 to d95e745 Compare December 20, 2022 08:17
@methylDragon methylDragon changed the title fuse -> ROS 2 fuse_publishers: Port fuse_publishers (WIP) fuse -> ROS 2 fuse_publishers: Port fuse_publishers Dec 20, 2022
@methylDragon methylDragon marked this pull request as ready for review December 20, 2022 08:29
@methylDragon
Copy link
Collaborator Author

methylDragon commented Dec 20, 2022

@ros-pull-request-builder run tests please!

Build Status

@methylDragon methylDragon force-pushed the rolling-publishers branch 3 times, most recently from 3e45013 to f9d587a Compare December 20, 2022 09:04
@methylDragon
Copy link
Collaborator Author

methylDragon commented Dec 20, 2022

@ros-pull-request-builder run tests please!
Build Status

Only instabilities are linters!

fuse_core/include/fuse_core/publisher.hpp Outdated Show resolved Hide resolved
fuse_publishers/fuse_plugins.xml Show resolved Hide resolved
fuse_publishers/src/pose_2d_publisher.cpp Outdated Show resolved Hide resolved
fuse_publishers/test/test_pose_2d_publisher.cpp Outdated Show resolved Hide resolved
fuse_publishers/test/test_pose_2d_publisher.cpp Outdated Show resolved Hide resolved
fuse_publishers/test/test_pose_2d_publisher.cpp Outdated Show resolved Hide resolved
fuse_publishers/test/test_pose_2d_publisher.cpp Outdated Show resolved Hide resolved
fuse_publishers/test/test_pose_2d_publisher.cpp Outdated Show resolved Hide resolved
fuse_publishers/test/test_path_2d_publisher.cpp Outdated Show resolved Hide resolved
@methylDragon
Copy link
Collaborator Author

methylDragon commented Dec 21, 2022

Build Status

Likewise, only linters

* @param[in] name A unique name to give this plugin instance
* @param[in] name The number of threads to use with this publisher
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, remove this line

void AsyncPublisher::initialize(const std::string & name)
void AsyncPublisher::initialize(
node_interfaces::NodeInterfaces<
node_interfaces::Base,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, I think this could use ALL_RCLCPP_NODE_INTERFACES macro. The macro says fuse_core::..., but I think that will still work inside the fuse_core namespace.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I missed this one

@@ -45,7 +45,7 @@ class MyPublisher : public fuse_core::AsyncPublisher
{
public:
MyPublisher()
: fuse_core::AsyncPublisher(0),
: fuse_core::AsyncPublisher(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, 1 to match the ROS 1 test:

fuse_core::AsyncPublisher(1),

std::string base_frame_; //!< The name of the robot's base_link frame
fuse_core::UUID device_id_; //!< The UUID of the device to be published
rclcpp::Clock::SharedPtr clock_; //!< The publisher's clock, for timestamping and logging
rclcpp::Logger logger_; //!< The publisher's logger, shared_ptr for deferred init
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, update comment to remove shared_ptr


// Send the graph to the Publisher to trigger message publishing
publisher.notify(transaction_, graph_);

// Verify the subscriber received the expected pose
rclcpp::Time timeout = node_->now() + rclcpp::Duration::from_seconds(10.0);
while ((!received_pose_msg_) && (node_->now() < timeout))
rclcpp::Time timeout = node->now() + rclcpp::Duration::from_seconds(20.0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was the timeout increased from 10s to 20s?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that it sometimes times out if left at 10 seconds, same with the ones below

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! I wonder if the timeout was happening because of the extra 5 second sleep that was removed #299 (comment)

I changed the timeouts back to 10 seconds and didn't see any failures in 100 runs using:

colcon test --event-handlers console_direct+ --packages-select fuse_publishers --ctest-args -R _2d_publisher --retest-until-fail 100

methylDragon#4


// Send the graph to the Publisher to trigger message publishing
publisher.notify(transaction_, graph_);

// Verify the subscriber received the expected pose
rclcpp::Time timeout = node_->now() + rclcpp::Duration::from_seconds(10.0);
while ((!received_pose_with_covariance_msg_) && (node_->now() < timeout))
rclcpp::Time timeout = node->now() + rclcpp::Duration::from_seconds(20.0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question about the timeout increase

// Send the graph to the Publisher to trigger message publishing
publisher.notify(transaction_, graph_);

// Verify the subscriber received the expected pose
rclcpp::Time timeout = node_->now() + rclcpp::Duration::from_seconds(10.0);
while ((!received_tf_msg_) && (node_->now() < timeout))
rclcpp::Time timeout = node->now() + rclcpp::Duration::from_seconds(20.0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question about the timeout increase

fuse_publishers/test/test_pose_2d_publisher.cpp Outdated Show resolved Hide resolved
fuse_publishers/test/test_path_2d_publisher.cpp Outdated Show resolved Hide resolved
methylDragon and others added 3 commits December 29, 2022 16:23
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
@methylDragon methylDragon merged commit 5f4c5ed into locusrobotics:rolling Dec 30, 2022
@methylDragon methylDragon deleted the rolling-publishers branch December 30, 2022 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants