ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi,

I had the same problem. I use MonitorState in a Concurrence container and want to store some data in userdata.

To get it working i had to do the following:

In file monitor_state.py i changed line 29 from

self._sub = rospy.Subscriber(self._topic, self._msg_type, self._cb, callback_args=[ud])

to

self._sub = rospy.Subscriber(self._topic, self._msg_type, self._cb, callback_args=ud)

and overloaded the smach_ros.MonitorState.__init__ function to accept my desired input and output keys.

class MonitorState2(smach_ros.MonitorState):
    def __init__(self, topic, msg_type, cond_cb, max_checks=-1):
    smach.State.__init__(self,
            outcomes=['nav_error', 'pose_reached'],
            input_keys=['user_pose'],
            output_keys=['user_pose', 'robot_current_pose'])

    self._topic = topic 
    self._msg_type = msg_type 
    self._cond_cb = cond_cb 
    self._max_checks = max_checks 
    self._n_checks = 0 

    self._trigger_cond = threading.Condition()