-
Notifications
You must be signed in to change notification settings - Fork 202
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
Add tf2::BufferCoreInterface and tf2_ros::AsyncBufferInterface to use in tf2_ros::MessageFilter #121
Conversation
After an offline discussion with @wjwwood and @tfoote, I've done some refactoring. I still need to implement the timeout for |
In order to implement the asynchronous timeout I've introduced the interface I realized that geometry2/tf2_ros/test/message_filter_test.cpp Lines 62 to 64 in d751313
|
What? the |
I meant Edit: We can pass a |
I see what you mean now. Oof. Does it make sense to move all the stuff (timeout based waitFor and the timer creation interface) into I suppose we could add a new signature for |
Yeah, I don't think it makes sense to add the new async API to Unless there's a use-case for passing a |
Only if you wanted to backport it and not break API. Otherwise, unless @tfoote sees a different reason, I think changing it would be ok. |
I've already broken API by changing the signature of |
I think this is ready for review. Here's a description of the changes:
Pending review and approval, I'll curate the commits so that they reflect the above description. |
See proposed usage in RViz: ros2/rviz#422 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks good to me. One small nitpick/suggestion on the exception type.
@@ -108,7 +109,7 @@ class BufferCore | |||
|
|||
/** \brief Clear all data */ | |||
TF2_PUBLIC | |||
void clear(); | |||
void clear() override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also mildly concerned about making these functions virtual (though I don't see an alternative), because it will now require a vtable lookup, and these functions are called very frequently. Just bringing it up in case anyone else agrees, but I don't see an alternative at the moment as the standard way to avoid a vtable is CRTP and the way we're using this with plugins I think makes that option not viable.
a4e45f5
to
60b0758
Compare
I've rebased to get the fix from #127. The last three commits are new since the last review. |
tf2::BufferCore implements this interface. The plan is to use the interface in place of tf2::BufferCore (for example, in tf2_ros::MessageFilter). This gives applications a way to provide custom implementations of the core TF interface. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Add concrete class tf2_ros::CreateTimerROS that implements the new interface. The interface will be used by tf2_ros::Buffer to implement asynchronous operations. Providing a separate interface for interacting with timers lets us keep a separation of concerns when it comes to executing user-defined callbacks. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
The new interface declares a single method waitForTransform. The interface is implemented by tf2_ros::Buffer, which makes use of tf2_ros::CreateTimerInterface. This makes it easier for users to make asynchronous transform requests, rather than using the methods provided by the base class tf2::BufferCore. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
This change applications to use the message filter with custom buffer implementations. The buffer type provided must implement tf2::BufferCoreInterface and tf2_ros::AsyncBufferInterface, which is enforced with static assertions. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
60b0758
to
1d097dc
Compare
@jacobperron this code is not compiling for me and I'm unable to figure out why. The trouble seems to be with the added
If I explicitly add
Any suggestions? |
@jdlangs I can reproduce the error if I source a binary installation of Dashing and then try to compile geometry2. If I build ROS 2 from source, then I do not run into this issue. I suspect there's a mix-up happening with the Dashing installation, which doesn't contain the changes introduced in this PR, where tf2_ros is linking against the binary installation of tf2. Edit: fixed in #156 Since the message filter is referencing |
This work is towards enabling the use of MessageFilter in RViz (see ros2/rviz#375 (comment)).
The idea is to make RViz transformer plugins extend the new
tf2::FrameTransformerInterface
so that we can take advantage oftf2::MessageFilter
with different transformer plugins (not justtf2::BufferCore
).This PR does three things:
tf2::FrameTransformerInterface
(533ccd6)tf2::BufferCore
implement the interface (f4c2c98)tf2::MessageFilter
use the interface (9550875)