Skip to content
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

[jsk_topic_tools] Eval at every timer callback #1758

Merged
merged 2 commits into from Nov 16, 2022

Conversation

iory
Copy link
Member

@iory iory commented Aug 24, 2022

What is this?

Changed boolean node to evaluate condition each time a topic is published.
For example, a condition that checks whether a certain topic has arrived within one second look like this.

  <node name="shutdown_selector"
        pkg="jsk_topic_tools" type="boolean_node.py"
        output="screen"
        clear_params="true"
        respawn="true" >
    <remap from="~input1" to="$(arg battery_state_topic)" />
    <remap from="~input2" to="$(arg shutdown_unchecked_topic)" />
    <remap from="~output/and" to="/execute_shutdown" />
    <rosparam>
      number_of_input: 2
      input1_condition: "m.is_charging is False"
      input2_condition: "(rospy.Time.now() - t).to_sec() &lt; 1.0"
    </rosparam>
  </node>

Use case

jsk-ros-pkg/jsk_robot#1570

Copy link
Member

@nakane11 nakane11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously this node evaluated conditions when a new input message arrived.
This PR enables comparing the time when receiving the input with the current time.

I confirmed that the example works and (rate/threshold) of outputs are set to True.

doc/jsk_topic_tools/scripts/boolean_node.rst Show resolved Hide resolved
@k-okada k-okada merged commit 92da344 into jsk-ros-pkg:master Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants