[jsk_topic_tools] Add filtered relay node which can filter a topic and transform it.#1757
Open
iory wants to merge 3 commits intojsk-ros-pkg:masterfrom
Open
[jsk_topic_tools] Add filtered relay node which can filter a topic and transform it.#1757iory wants to merge 3 commits intojsk-ros-pkg:masterfrom
iory wants to merge 3 commits intojsk-ros-pkg:masterfrom
Conversation
nakane11
reviewed
Aug 24, 2022
Member
nakane11
left a comment
There was a problem hiding this comment.
I checked this node works well.
I cannot come up with real example like jsk-ros-pkg/jsk_robot#1570 right now because input and filter should be simple, but in such cases this node is useful.
Member
|
since jsk-ros-pkg/jsk_robot#1570 has been closed and currently we do not have usage for this node. So may be we can leave this PR and re-start discussion / review until we found another use cases. |
Member
Author
|
OK. We will wait until someone needs this node. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this?
rostopic echohas a filter function, but it cannot publish a topic.topic_tools/transformcan format a topic and publish it, but it does not have the ability to filter.Transforming while filtering a topic is simple and powerful.
This node provides a filter and publish (i.e. relay) functions.
Subscribing Topic
~input(rospy/AnyMsg)Input message.
Publishing Topic
~output(~output_type)Output topic. You can specify
~output_typeparam to publish topic.Parameters
~output_type(String, required)Message type of output_topic like
std_msgs/Float32. This is the input for the get_message_class function.~filter(String, default:None)Condition of messages that match a specified Python expression.
The Python expression can access any of the Python builtins plus:
topic(the topic of the message),m(the message) andt(time of message).For example,
~inputtopic isstd_msgs/Stringand if you want to check whether a sentence is ahello, you can do the following.filter: m.data == 'hello'Note that, use escape sequence when using the following symbols
<(<),>(>),&(&),'(')and"(")in launch file.~transform(String, default:m)Python expression that transform the input messages, which are given in the variable m. The default expression is
m, which results in forwarding input (which can be a topic field) into output_topic.~import(List[String], default:[])List of Python modules to import and use in the expression.
Usage
Example
The following example subscribe to
/right_endeffector/wrenchand only those with a force norm greater than 10 are published as/right_endeffector/force_norm.Use case
jsk-ros-pkg/jsk_robot#1570