The most direct way would be to use the parameter_bridge instead of the dynamic_bridge
https://github.com/ros2/ros1_bridge#example-4-bridge-only-selected-topics-and-services
The above instructions ^ will work with the ros1_bridge provided by your ROS distribution.
In my own work, I found the separation of the two to be a bit limiting and instead manually combined the parameter_bridge and dynamic_bridge in my team's fork. https://github.com/usdot-fhwa-stol/ros1_bridge (ROS2 foxy). Launched with
rosparam load bridge.yml && source /opt/ros/foxy/setup.bash && ros2 run ros1_bridge dynamic_bridge
To use my fork you would need to compile it following the ros1_bridge instructions. The bridge.yml file takes precedence over the dynamic behavior.
Originally posted by msmcconnell with karma: 268 on 2022-08-16
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by iimata on 2022-08-16:
first, thank u bro for you help
i tried to bridge my laserscanner
data and i got this error
[INFO] [1660674982.068587236]
[ros_bridge]: create bidirectional
bridge for topic /depth_scan
failed to create bidirectional bridge
for topic '/depth_scan' with ROS 2
type 'sensor_msgs/LaserScan': No
template specialization for the pair
Trying to create bridge for ROS 2
service
'/depthimage_to_laserscan/get_loggers'
with type 'roscpp/GetLoggers'
failed to create bridge ROS 1 service
'/depthimage_to_laserscan/get_loggers'
no conversion for type
'roscpp/GetLoggers'
Trying to create bridge for ROS 1
service '/add_two_ints' with type
'example_interfaces/srv/AddTwoInts'
failed to create bridge ROS 2 service
'/add_two_ints' no conversion for
type
'example_interfaces/srv/AddTwoInts'
Comment by ravijoshi on 2022-08-16:
@mh-ta: I wonder if you need to compile your IDL files with ros1_bridge
first. I have found the ros1_bridge
working all right this way.
Comment by iimata on 2022-08-17:
its work fine bro ..
but im using kinect camera to generate a laser scan data,
the camera launch file generates alot of topics that i dont need such as(/camera/depth/image_raw)which it has a heavy data to bridge, and it is making alot of lag
Comment by iimata on 2022-08-17:
i solved the problem, i wrote the ros1 type topic it has to be a ros2 type