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

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

Open
josephcoombe opened this issue Apr 18, 2018 · 2 comments

Comments

@josephcoombe
Copy link

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?

@josephcoombe josephcoombe 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: /") Apr 18, 2018
@k-okada
Copy link
Contributor

k-okada commented Jul 22, 2018

@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.

@josephcoombe
Copy link
Author

josephcoombe commented Aug 9, 2018

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants