ubi-agni / tactile_toolbox

software to handle tactile sensors in ROS
9 stars 5 forks source link

Improve failure reporting #17

Closed rhaschke closed 3 years ago

rhaschke commented 3 years ago

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: ```python #!/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 commented 3 years ago

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

rhaschke commented 3 years ago

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.