Skip to content

smach_viewer: Can't view independent SMACH FSMs ("Path not available" at root "path: /") #18

Open

Description

@josephcoombe

In smach_viewer, I get a "Path not available" message and no visualization when the path is set to "/" as shown below:
screenshot 2018-04-18 08 43 21


From @jbohren's old rqt_smach.md, I expected to be able to view independent SMACH FSMs on the same canvas, specifically b/c rqt_smach.md has this screenshot:
image


Is this a bug in smach_viewer?

Also, is smach_viewer the successor to rqt_smach or do the two have different (but similar) capabilities?

Activity

  1. changed the title [-]smach_viewer: Can't view independent SMACH FSMs / "Path not available" at root "path: /"[/-] [+]smach_viewer: Can't view independent SMACH FSMs ("Path not available" at root "path: /")[/+] on Apr 18, 2018
  2. k-okada commented on Jul 22, 2018

    @k-okada
    Contributor

    @josephcoombe can you provide example to reproduce this? And rqt_smach should be newer this this package, but i’m not sure about the current status of that package.

  3. josephcoombe commented on Aug 9, 2018

    @josephcoombe
    Author

    Here's a simple example.

    1. Create test_fsm.py
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    
    
    from __future__ import print_function
    
    import rospy
    from rospy import Subscriber
    from smach import StateMachine, State
    import smach_ros
    
    from std_msgs.msg import String
    
    
    class Tic(State):
        def __init__(self):
            State.__init__(self, outcomes=['success'])
            self._active = False
            self._ros_rate = rospy.Rate(100)
            self._tic_received = False
            self._listener = Subscriber('tic', String, callback=self._listener_cb)
    
        def execute(self, ud):
            self._active = True
            while not rospy.is_shutdown() and not self._tic_received:
                self._ros_rate.sleep()
            self._active = False
            self._tic_received = False
            return 'success'
    
        def _listener_cb(self, msg):
            if self._active:
                self._tic_received = True
    
    
    if __name__ == '__main__':
        rospy.init_node('test_fsm', anonymous=True)
    
        top = StateMachine(outcomes=['success'])
        with top:
            StateMachine.add('TIC_A', Tic(), transitions={'success':'TIC_B'})
            StateMachine.add('TIC_B', Tic(), transitions={'success':'TIC_C'})
            StateMachine.add('TIC_C', Tic(), transitions={'success':'TIC_A'})
    
        sis = smach_ros.IntrospectionServer(str(rospy.get_name()), top, '/SM_ROOT' + str(rospy.get_name()))
        sis.start()
    
        top.execute()
    
        rospy.spin()
        sis.stop()
    
    1. chmod +x test_fsm.py
    2. roscore
    3. In two separate terminals, python test_fsm.py
    4. rosrun smach_viewer smach_viewer.py

    You should be able to view both state machines separately
    im1

    and
    im2

    but not together...
    im3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions