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

Improve failure reporting #17

Merged
merged 6 commits into from
Oct 13, 2020
Merged

Conversation

rhaschke
Copy link
Member

@rhaschke rhaschke commented Oct 8, 2020

Resolves #16.
I only partially handled your new request for a warning/error about an received, but outdated message.
It's implemented for TactileStateDisplay, but not for TactileContactDisplay. The latter would require this check for each and every contact received (within a message), which is somewhat costly.
You also note this issue "automatically", by not seeing wrenches displayed anymore, but no warning "no recent msg" popping up.

I tested this thoroughly with the enclosed `tactile_states` generator script:
#!/usr/bin/env python

from tactile_msgs.msg import TactileState
from sensor_msgs.msg import ChannelFloat32
from rosgraph_msgs.msg import Clock
from time import sleep
import rospy
import numpy

rospy.init_node('send_tactile_states')
pub = rospy.Publisher('tactile_states', TactileState, queue_size=1)

sim_time = rospy.get_param('use_sim_time', False)
clock_pub = rospy.Publisher('clock', Clock, queue_size=1)
clock_msg = Clock()

rate = rospy.Rate(10)
t = 0
period = 5

msg = TactileState()
msg.sensors.append(ChannelFloat32())
msg.sensors[0].name = rospy.get_param('~channel', 'tactile')
values = numpy.linspace(0, numpy.pi, num=rospy.get_param('~taxels', 64))
while not rospy.is_shutdown():
    stamp = rospy.Time.from_sec(t) if sim_time else rospy.Time.now()
    clock_msg.clock = stamp
    clock_pub.publish(clock_msg)
    print(stamp.secs)

    msg.header.stamp = stamp
    msg.sensors[0].values = 0.6 + 0.4 * numpy.sin(values + 2.*numpy.pi/period*t)
    pub.publish(msg)

    t += rate.sleep_dur.to_sec()
    sleep(rate.sleep_dur.to_sec())

@guihomework
Copy link

Hi,
since you tested thoroughly with a generator script, I will test with a rosbag.
I like the outdated message, it works well. great feature. One directly sees that the rosbag uses a wrong time and that the plugin was not started with use_sim_time.

The no message received yet is valid too, unless the clock resets. The tactile_plugin was used with default settings, so topic was /tactile_states,
Then I was publishing a bag file with a loop and clock published, with data was coming on /TactileGlove. The plugin cleared the "taxels buffer" at clock reset and also made the "no message received yet disappear" even if I did not tell the correct topic yet.
I think the same happens in the contact_display plugin.

I will review the code next

Copy link

@guihomework guihomework left a comment

Choose a reason for hiding this comment

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

Code seems fine to me, and I could not reproduce the bug I noticed this morning with a bagfile with contact_state_plugin remembering previous data. Was probably a misconfiguration of the clock somehow during that early tests.

@rhaschke
Copy link
Member Author

The plugin ... made the "no message received yet" disappear even if I did not tell the correct topic yet.

Indeed, rviz was resetting the display and thus all statuses when it noticed a time reset itself. Fixed now.

@rhaschke rhaschke force-pushed the improve-failure-reporting branch from 10a2706 to 57fb1e9 Compare October 13, 2020 06:35
@rhaschke rhaschke merged commit c63e578 into melodic-devel Oct 13, 2020
@rhaschke rhaschke deleted the improve-failure-reporting branch October 13, 2020 06:54
rhaschke added a commit that referenced this pull request Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide feedback about (no) incoming messages
2 participants