ros-tooling / topic_tools Goto Github PK
View Code? Open in Web Editor NEWTools for directing, throttling, selecting, and otherwise manipulating ROS 2 topics at a meta-level.
License: Apache License 2.0
Tools for directing, throttling, selecting, and otherwise manipulating ROS 2 topics at a meta-level.
License: Apache License 2.0
Hello,
Are the binaries for these packages available? I know, this is a feature request channel, but was not sure where to ask for it..
Implement a priority multiplexer like cmd_vel_mux (https://github.com/kobuki-base/cmd_vel_mux/blob/devel/src/cmd_vel_mux.cpp) for generic topic types. The multiplexer would give preference to the highest priority topic that published within a given time window, suppressing all other topics.
Note that this tool would replace cmd_vel_mux, but allow for uses with other topic types.
We are currently pursuing the implementation of input/output suppressors/inhibitors, as described in the subsumtion architecture, as described in here:
https://people.csail.mit.edu/brooks/papers/AIM-864.pdf
This other paper claims to have implemented it in ROS (1) but no source is available:
file:///home/mllofriu/Downloads/Subsumption%20Model%20Implemented%20on%20ROS%20for%20Mobile%20Robots%20_Li16.pdf
A new tool, say priority_mux, is implemented.
It allows to specify a list of topics of a generic, but equal, type. The order in which topics are published determines their relative priority, the first one being the highest priority one.
It contains a parameter that specifies the length of the time window, T, in seconds. Once an input topic publishes a message which is forwarded by the multiplexer, all lower priority topics will be suppressed for T seconds. Any topics with a higher priority topics, however, can be forwarded right away.
The feature could be implemented by combining features from topic_tools/mux and cmd_vel_mux. The services and selection logic can be stripped from mux, and the time window logic can be migrated from cmd_vel_mux.
We can certainly help implement or implement it. We just wanted to check if it is something this team would be interested in incorporating to topic_tools. As well as to check if you maybe know any other existing tool that can be used for this purpose.
Hello,
Just curious how to use this with ros2 foxy, I run into issues when cloning the repo and building from source.
best regards
Is this package supported for ROS2 - Foxy? I assumed it is because it does not say other wise. But I am unable to build it with foxy? There is no branch for Foxy either. Please clarify if this is indeed supported for foxy or not?
Segmentation fault occurring when stopping the publisher and restarting while keeping the ros2 run topic throttle message active.
In two separate terminals, publish two messages
$ ros2 topic pub -r 10 /greetings std_msgs/msg/String "{data: 'Hello from terminal'}"
$ ros2 topic pub -r 10 /welcome std_msgs/msg/String "{data: 'Hello from terminal'}"
In two new terminals, run the commands,
$ ros2 run topic_tools throttle messages /greetings 1
$ ros2 run topic_tools throttle messages /welcome 1
on doing a ros2 topic list, the following topics are visible:
/greetings
/greetings_throttle
/parameter_events
/rosout
/welcome
/welcome_throttle
Press control + c in terminal two (or in one) where the $ ros2 topic pub -r 10 /welcome std_msgs/msg/String "{data: 'Hello from terminal'}" was entered.
and rerun the command again.
** clear and concise description of what you expected to happen **
** clear and concise description of what actually happened. include copied logs whenever possible **
In the terminal where the following command was entered, $ ros2 run topic_tools throttle messages /welcome
the following occurred.
[ros2run]: Segmentation fault
Is there any chance to keep the throttle active and connect again without segmentation fault when the topic starts to publish again?
Additional info
Traceback (most recent call last):
File "/opt/ros/humble/bin/ros2", line 33, in
sys.exit(load_entry_point('ros2cli==0.18.5', 'console_scripts', 'ros2')())
File "/opt/ros/humble/lib/python3.10/site-packages/ros2cli/cli.py", line 89, in main
rc = extension.main(parser=parser, args=args)
File "/opt/ros/humble/lib/python3.10/site-packages/ros2topic/command/topic.py", line 41, in main
return extension.main(args=args)
File "/opt/ros/humble/lib/python3.10/site-packages/ros2topic/verb/hz.py", line 89, in main
return main(args)
File "/opt/ros/humble/lib/python3.10/site-packages/ros2topic/verb/hz.py", line 104, in main
_rostopic_hz(node.node, topic, window_size=args.window_size, filter_expr=filter_expr,
File "/opt/ros/humble/lib/python3.10/site-packages/ros2topic/verb/hz.py", line 274, in _rostopic_hz
rt.print_hz(topic)
File "/opt/ros/humble/lib/python3.10/site-packages/ros2topic/verb/hz.py", line 244, in print_hz
print('average rate: %.3f\n\tmin: %.3fs max: %.3fs std dev: %.5fs window: %s'
BrokenPipeError: [Errno 32] Broken pipe
Thanks
The transform tool fails to properly resolve the names of topics specified as relative to a non-root namespace.
Tool runs, subscribes to /my_namespace/chatter
and emits /my_namespace/xformed
.
Tool stalls with:
WARNING: topic [/my_namespacechatter] does not appear to be published yet
ros2 run demo_nodes_cpp talker --ros-args -r __ns:=/my_namespace
ros2 run topic_tools transform chatter xformed std_msgs/String "std_msgs.msg.String(data=m.data[-1])" --import std_msgs --wait-for-start --ros-args -r __ns:=/my_namespace
hello,
I experienced a bug with mux only to find that it was fixed already in the iron branch. The released version is quite old:
root@logi-XMG-CORE-REN-M20:/code# apt install ros-iron-topic-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ros-iron-topic-tools is already the newest version (1.0.0-3jammy.20230908.173839).
The 1.0.0 tag is from March 2022.
Can you please release a more recent tag? Thanks
Basically porting https://github.com/ros/ros_comm/blob/noetic-devel/tools/topic_tools/src/demux.cpp to ROS2
demux is a generic ROS topic demultiplexer: one input topic is fanned out to 1 of N output topics. A service is provided to select between the outputs
ros2 run topic_tools demux <intopic> <outtopic1> [outtopic2...]
select
serviceadd
servicedelete
servicelist
serviceMight be a good first issue since the ROS1 version already exists and this is very similar to Mux which has already been ported to ROS2.
It seems the original ROS1 code also didn't have any unit tests for demux
Would be nice to have ros/ros_comm#639 in ROS2
Right now this package was released into Humble and Iron pointing to the main
branch - there's no guarantee this code will continue to build in those distros if we keep building against Rolling.
We should create dedicated release branches for those distros and fix them if necessary to build in those environments, then update rosdistro with a new patch release pointing to the proper branches.
See topic_tools
documentation https://github.com/ros-tooling/topic_tools/issues/new?assignees=&labels=enhancement&template=feature_request.md&title= - we should try to adhever
N/A
in_topic
s and one outtopic
~/selected
~/select
selects the active input topic~/add
adds a new input topic~/delete
removes an input topic~lazy
- if True, don't subscribe to input topic unless there is at least one subscriber on the output topic~initial_topic
selects the initial choice for input, if unset, default to first topic in arguments.rclcpp::GenericSubscription
/ rclcpp::GenericPublisher
to get generics.ros2 run
launch_testing
to test compositiionIt would be immensly helpful to be able to set the parameters of transform
via a yaml parameter file. For example, in a launch file:
Node(
package='topic_tools',
executable='transform_node.py',
name='transform',
output='screen',
parameters=[
{'input': '/conemap'},
{'output-topic': '/conemap_rviz'},
{'output-type': 'visualization_msgs/MarkerArray'},
{'expression': 'conemap_to_markerarray.convert(m)'},
{'import': ['conemap_to_markerarray']}
])
This way one can make a pip-installable python package, and withou worrying about any ROS implementation details just run it as a very simple ros node. I have a working implementation of this feature in my fork, although I'm a newbie to ros and it's probably full of bugs etc
You can use both command line arguments and ros parameters to alter transform
settings.
I would like this package to allow operations on synced topics. The use case that I'm thinking of is when the inputs are coming from a camera, ie, camera_info
and image_raw
topics.
In this case, throttle may drop/throttle messages on one topic, but for different timestamps for the other topic. Hence the outputs are throttled but the downstream exact sync of the throttled messages will fail.
Are there any efforts to enable doing the same operation on synced topics?
See http://wiki.ros.org/topic_tools/drop
N/A
ros2 run
Use rclcpp::GenericPublisher/Subscription
Add tests
Currently throttle
takes only one input topic (intopic
in the readme). Able being to pass in multiple intopic
's can be a useful enhancement.
Possible use case: through a single terminal command, throttle RGB and depth data coming in from an RGBD camera.
None.
n
input topics in parallel and publish on n
output topics.Spinning n
threads, one for each intopic
-outtopic
pair. n
should probably have a cap but not entirely sure what's a good way to decide on the number.
n >= 1
topics.See http://wiki.ros.org/topic_tools/throttle
N/A
ros2 run
Use rclcpp::GenericSubscription/Publisher
Unit tests for Node
Foxy build fails with a CMake Error.
ament_python_install_package() called with unused arguments:
SETUP_CFG;topic_tools/setup.cfg
Foxy build does not fail.
Foxy build fails.
topic_tools
repo to an existing Foxy colcon/ament workspace.colcon build
# git log -n1
commit 41511029241805da470beb77703d7c3ef1801141 (HEAD -> main, origin/main, origin/HEAD)
Author: Daisuke Nishimatsu <[email protected]>
Date: Tue Nov 30 08:37:28 2021 +0900
Workaround for galactic build (#18)
Signed-off-by: wep21 <[email protected]>
# colcon build --packages-up-to topic_tools
Starting >>> topic_tools
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
Not searching for unused variables given on the command line. [0/91149]
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ament_cmake_auto: 0.9.9 (/opt/ros/foxy/share/ament_cmake_auto/cmake)
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3")
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using all available rosidl_typesupport_c: rosidl_typesupport_fastrtps_c;rosidl_typesupport_introspection_c
-- Found rosidl_adapter: 1.2.1 (/opt/ros/foxy/share/rosidl_adapter/cmake)
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1f")
-- Found FastRTPS: /opt/ros/foxy/include
-- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp
-- Found rmw_implementation_cmake: 1.0.3 (/opt/ros/foxy/share/rmw_implementation_cmake/cmake)
-- Using RMW implementation 'rmw_fastrtps_cpp' as default
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
CMake Error at /opt/ros/foxy/share/ament_cmake_python/cmake/ament_python_install_package.cmake:34 (message):
ament_python_install_package() called with unused arguments:
SETUP_CFG;topic_tools/setup.cfg
Call Stack (most recent call first):
/opt/ros/foxy/share/ament_cmake_python/cmake/ament_python_install_package.cmake:28 (_ament_cmake_python_install_package)
CMakeLists.txt:24 (ament_python_install_package)
-- Configuring incomplete, errors occurred!
See also "/root/colcon_ws/build/topic_tools/CMakeFiles/CMakeOutput.log".
See also "/root/colcon_ws/build/topic_tools/CMakeFiles/CMakeError.log".
--- stderr: topic_tools
CMake Error at /opt/ros/foxy/share/ament_cmake_python/cmake/ament_python_install_package.cmake:34 (message):
ament_python_install_package() called with unused arguments:
SETUP_CFG;topic_tools/setup.cfg
Call Stack (most recent call first):
/opt/ros/foxy/share/ament_cmake_python/cmake/ament_python_install_package.cmake:28 (_ament_cmake_python_install_package)
CMakeLists.txt:24 (ament_python_install_package)
---
Failed <<< topic_tools [5.82s, exited with code 1]
Summary: 0 packages finished [7.84s]
1 package failed: topic_tools
1 package had stderr output: topic_tools
See http://wiki.ros.org/topic_tools/relay
Relay an input topic to a different output topic, with some configuration
N/A
~lazy
- don't subscribe to input topic unless there is at least one subscriber on the output topicrclcpp::GenericPublisher/Subscription
KeyboardInterrupt
exception on shutdown
Clean shutdown
[relay_field-69] Traceback (most recent call last):
[relay_field-69] File "/opt/ros/iron/lib/topic_tools/relay_field", line 33, in <module>
[relay_field-69] sys.exit(load_entry_point('topic-tools==1.2.0', 'console_scripts', 'relay_field')())
[relay_field-69] File "/opt/ros/iron/lib/python3.10/site-packages/topic_tools/relay_field.py", line 226, in main
[relay_field-69] node.destroy_node()
[relay_field-69] File "/opt/ros/iron/lib/python3.10/site-packages/rclpy/node.py", line 1887, in destroy_node
[relay_field-69] self.__node.destroy_when_not_in_use()
[relay_field-69] KeyboardInterrupt
** Steps to reproduce the behavior, e.g.
ros2 topic pub /chatter std_msgs/String "{}"
ros2 run topic_tools relay_field /chatter /chatter2 std_msgs/String "{data: m.data}"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.