Comments (11)
Thank you for the issue report @vilhjalmur89
I can confirm this issue happens for both static_bridge
and simple_bridge
. With the simple_bridge
you get some additional logging that shows this in action:
dhood@osrf-esteve:~ [~]$ simple_bridge__rmw_opensplice_cpp
I heard from ROS 1 from: [/rostopic_17524_1481068220810]
I heard from ROS 1: [static_bridge__rmw_opensplice_cpp is running]
Passing along to ROS 2: [static_bridge__rmw_opensplice_cpp is running]
^Csignal_handler(2)
dhood@osrf-esteve:~ [~]$ simple_bridge__rmw_fastrtps_cpp
I heard from ROS 1 from: [/rostopic_17588_1481068239197]
I heard from ROS 1: [static_bridge__rmw_fastrtps_cpp is running]
Passing along to ROS 2: [static_bridge__rmw_fastrtps_cpp is running]
I heard from ROS 2: [static_bridge__rmw_fastrtps_cpp is running]
Passing along to ROS 1: [static_bridge__rmw_fastrtps_cpp is running]
I heard from ROS 1 from myself
This doesn't seem to be an issue for the dynamic_bridge
. Hopefully you can find that useful until we get around to looking into this. If you are interested in investigating yourself, we would gladly welcome a pull request. My current suspicion is that the logic to ignore publishers/subscribers from the bridge itself that exists in the dynamic bridge (e.g.
ros1_bridge/src/dynamic_bridge.cpp
Line 380 in cc1479b
from ros1_bridge.
This is also a problem with the parameter_bridge
. Additional filtering based on the node name of the bridge etc. is only implemented in the dynamic_bridge
atm.
from ros1_bridge.
Ok, so the problem is that ros2_callback()
sends messages back to ROS1 without any filtering:
ros1_bridge/include/ros1_bridge/factory.hpp
Lines 145 to 159 in d7954c9
ros1_callback
does it perfectly but I don't think that there's currently a way to get connection_header
or caller_id
in ROS2 rclcpp
. There's also no way to check by timestamp as a lot of msgs
do not have header
included.
I have implemented simple logic that checks if current ROS2 message equals to the last message published by ros1_callback
but it's not allowing to send two exactly equal messages in a row.
ros1_bridge/include/ros1_bridge/factory.hpp
Lines 104 to 143 in d7954c9
Please tell me if you have an idea how to solve it, maybe I missed something and there's a way to get some metadata about the message?
from ros1_bridge.
I have implemented simple logic that checks if current ROS2 message equals to the last message published by
ros1_callback
but it's not allowing to send two exactly equal messages in a row.
That approach wouldn't be acceptable since dropping "duplicate" messages would be changing the data flow and is therefore not desired.
Please tell me if you have an idea how to solve it, maybe I missed something and there's a way to get some metadata about the message?
As mentioned above the dynamic_bridge
already implements the filtering based on the node name of the source of the message (see e.g. https://github.com/ros2/ros1_bridge/blob/master/src/dynamic_bridge.cpp#L504-L507). This logic should be moved into a function which can then be reused by the different variants of the bridge.
from ros1_bridge.
The lines that you linked are filtering messages that were published on ROS1 by the bridge. ROS2 part is here:
ros1_bridge/src/dynamic_bridge.cpp
Lines 658 to 672 in 48a373f
ros2_callback
in factory.hpp
from ros1_bridge.
but I don't think that there's currently a way to get connection_header or caller_id in ROS2 rclcpp.
Not sure this is exactly what you're looking for, but you can get the message info from our C api and that contains the publisher GUID. You can also get the GUID for any publishers that you have a reference to, so you could compare if messages are from a publisher in the same node/process.
This is the function that returns the message info:
This is the message info structure:
These are the functions that which allow you to get a GUID for a publisher and then compare two GUID:
rclcpp
uses it to find intra process pairs:
And then allows you to get it in a callback:
I didn't follow this issue very closely, but maybe it would help.
from ros1_bridge.
@wjwwood Good to know, thank you! I was hoping to access GUID in this callback:
ros1_bridge/include/ros1_bridge/factory.hpp
Line 146 in d7954c9
but after hours of untangling this code I still don't quite understand how. And it looks like I can't use
dispatch()
either.from ros1_bridge.
@ArkadiuszNiemiec this callback here needs to have the message info argument as well:
ros1_bridge/include/ros1_bridge/factory.hpp
Lines 95 to 99 in d7954c9
So that the create_subscription
call right after that:
ros1_bridge/include/ros1_bridge/factory.hpp
Line 100 in d7954c9
Knows to pass it into the callback function. You can then pass the message info from the above linked lambda into the ros2_callback
function you referenced just now.
from ros1_bridge.
Thank you for explaining this. I have just created a pull request.
from ros1_bridge.
This issue should be now fixed by the #113.
from ros1_bridge.
I'll close, please comment if the problem isn't fixed by #113.
from ros1_bridge.
Related Issues (20)
- Bridge generates and compiles code for all ROS 2 interfaces, even the ones without ROS 1 counterpart HOT 2
- ROS1 Bridge not working.
- symbol lookup error HOT 1
- Mapping rules file for nested custom messages
- Many packages not found by find_ros1_package() during build
- Data Type conversion directly
- Unstable behavior of std::bad_alloc HOT 2
- help wirh ros melodic and dashing bridg (it failed) HOT 1
- ros1_bridge dashing problem HOT 3
- ROS2 Foxy: bridge causing continuous errors from realsense on depth image HOT 3
- ROS2 Humble: how can I subscribe topic?
- No executable found ros1_bridge on Ubuntu 20.04 with ROS2 Humble and ROS Noetic
- ros bridge is crashing as soon as I try to run it. HOT 2
- The factors affecting the maximum frequency of topics in the ROS1 bridge HOT 1
- parameter bridge ability to rename topic
- can map custom srv but msg
- ros1_brigde cannot convert ros1bag data into ros2bag because of Qos mismatch
- build fail in Ubuntu 22.04
- ros1_bridge build error in Windows HOT 1
- Build with ROS2 Jazzy and ROS noetic HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ros1_bridge.