ros-visualization / executive_smach_visualization Goto Github PK
View Code? Open in Web Editor NEWA ROS-based introspection tool for visualizing the structure and state of SMACH plans.
A ROS-based introspection tool for visualizing the structure and state of SMACH plans.
ROS Kinetic, Ubuntu 16.04
$ uname -a
Linux daikimaekawa-ThinkPad-X230 4.4.0-154-generic #181-Ubuntu SMP Tue Jun 25 05:29:03 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ dot -V
dot - graphviz version 2.38.0 (20140413.2041)
Hello,
I followed the tutorial for learning smach but when it came to visualize the state machine by running rosrun smach_viewer smach_viewer.py
. I have this errors that appears :
wxversion 2.8 is not installed, installed versions are ['3.0-gtk3']
Gtk-Message: 11:47:05.233: Failed to load module "canberra-gtk-module"
wxversion 2.8 is not installed, installed versions are ['3.0-gtk3']
(smach_viewer.py:1744): GLib-GObject-WARNING **: 11:47:05.887: cannot register existing type 'GdkDisplayManager'
(smach_viewer.py:1744): GLib-CRITICAL **: 11:47:05.887: g_once_init_leave: assertion 'result != 0' failed
(smach_viewer.py:1744): GLib-GObject-CRITICAL **: 11:47:05.887: g_object_new_with_properties: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
Do you know why I receive this error and how to fix it ?
Thanks for your help
I've tried to implement a simple SMACH state-machine and visualize it with smach_viewer. According to the terminal output, the state machine itself runs perfectly fine.
When I start smach_viewer, it throws the following error:
[ERROR] [1599821587.164191]: bad callback: <bound method SmachViewerFrame._status_msg_update of <__main__.SmachViewerFrame; proxy of <Swig Object of type 'wxFrame *' at 0x55616f7eb050> >> Traceback (most recent call last): File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback cb(msg) File "/home/faps/catkin_ws/src/executive_smach_visualization/smach_viewer/scripts/smach_viewer.py", line 844, in _status_msg_update if container.update_status(msg): File "/home/faps/catkin_ws/src/executive_smach_visualization/smach_viewer/scripts/smach_viewer.py", line 185, in update_status self._local_data._data = pickle.loads(msg.local_data) File "/usr/lib/python2.7/pickle.py", line 1388, in loads return Unpickler(file).load() File "/usr/lib/python2.7/pickle.py", line 864, in load dispatch[key](self) File "/usr/lib/python2.7/pickle.py", line 1157, in load_get self.append(self.memo[self.readline()[:-1]]) KeyError: 'AJ9cQA'
I'm using:
My state-machine is implemented as follows:
#!/usr/bin/env python3
import smach
import smach_ros
import rospy
class t1(smach.State):
def __init__(self, outcomes=['successful', 'failed']):
smach.State.__init__(self, outcomes)
def execute(self, userdata):
return 'successful'
class t2(smach.State):
def __init__(self, outcomes=['successful']):
smach.State.__init__(self, outcomes)
def execute(self, userdata):
return 'successful'
class t3(smach.State):
def __init__(self, outcomes=['successful']):
smach.State.__init__(self, outcomes)
def execute(self, userdata):
return 'successful'
if __name__=="__main__":
rospy.init_node('test_state_machine')
sm_top = smach.StateMachine(outcomes=['success'])
with sm_top:
smach.StateMachine.add('T1', t1(),
transitions={'successful': 'T2', 'failed': 'T3'})
smach.StateMachine.add('T2', t2(),
transitions={'successful': 'T1'})
smach.StateMachine.add('T3', t3(),
transitions={'successful': 'success'})
# Create and start the introspection server
sis = smach_ros.IntrospectionServer('introspection_server', sm_top, '/SM_ROOT')
sis.start()
# Execute SMACH plan
outcome = sm_top.execute()
# Wait for ctrl-c to stop the application
rospy.spin()
sis.stop()
Did I miss something or do you have any ideas what could cause the problem?
In smach_viewer, I get a "Path not available" message and no visualization when the path is set to "/" as shown below:
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:
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?
Like "import StringIO" in File "~/smach_viewer/smach_viewer.py", line 44, in import StringIO
I would deeply appreciate that if you can update this lib to the noetic version.
Enhancement request.
Saving Dot code or image as available in rqt_graph would be nice.
Hey all,
In the documentation of Smach it says Smach is a stand-alone library with ROS integration added.
I tried this and it does work in python by itself.
Now im wondering if the smach viewer can also be ran as a stand alone tool, so without the use of ROS.
Kind regards,
Jan Tromp
Would it be possible to trigger a new binary release for noetic?
We're happily using part of the work done in #46. So it would be nice if this could be released.
Hey everyone,
The smach viewer was working okay but at random moments it would close itself for no reason.
Error being:
Segmentation fault (core dumped)
At startup i got the message:
wxversion 2.8 is not installed, installed versions are ['3.0-gtk2']
wxversion 2.8 is not installed, installed versions are ['3.0-gtk2']
So i thought maybe update this, maybe that will fix it.
so i updated wxPython by (found in this link https://wiki.wxpython.org/How%20to%20install%20wxPython):
pip install -U \ -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 \wxPython
This downloaded 102 MB of data and installed the following packages:
Pillow, six, wxPython
After that i started the smach viewer again and got the following error:
Traceback (most recent call last):
File "/home/assembly_project/src/executive_smach_visualization/smach_viewer/scripts/smach_viewer.py", line 77, in
from smach_viewer import xdot
File "/home/assembly_project/src/executive_smach_visualization/smach_viewer/src/smach_viewer/xdot/init.py", line 1, in
import wxxdot
File "/home/assembly_project/src/executive_smach_visualization/smach_viewer/src/smach_viewer/xdot/wxxdot.py", line 45, in
gdkLib = wx.lib.wxcairo._findGDKLib()
AttributeError: 'module' object has no attribute '_findGDKLib'
Anyone able to help me get this back?
I am not that expecrienced with linux so i dont know what all the commands mean when installing something.
I'm afraid i messed it up and i'm not able to fix this by myself.
If there are any questions or things unclear, feel free to drop a comment.
Kind regards,
Jan Tromp
Would you mind releasing these packages also for the newest distribution ROS Noetic? :)
I can start smach_viewer like:
rosrun smach_viewer smach_viewer.py
I like to start it as a node inside a launch file like:
<node pkg="smach_viewer" name="smach_viewer" type="smach_viewer.py"/>
However I always get following error message:
usage: smach_viewer.py [-h] [-f]
smach_viewer.py: error: unrecognized arguments: __name:=smach_viewer_1 __log:=/tmp/ros_stephanh/7f335adc-a762-11e7-9444-0cc47ae2606c/smach_viewer_1-4.log
[smach_viewer_1-4] process has died [pid 30266, exit code 2, cmd /hri/localdisk/stephanh/care_ros_ws/src/executive_smach_visualization/smach_viewer/scripts/smach_viewer.py __name:=smach_viewer_1 __log:=/tmp/ros_stephanh/7f335adc-a762-11e7-9444-0cc47ae2606c/smach_viewer_1-4.log].
log file: /tmp/ros_stephanh/7f335adc-a762-11e7-9444-0cc47ae2606c/smach_viewer_1-4*.log
I think this is because the ROS remapping arguments are not removed from sys.argv before argparsing. A solution that worked for me is following code inside smach_viewer.py
if __name__ == '__main__':
rospy.init_node('smach_viewer', argv=sys.argv, anonymous=False, disable_signals=True, log_level=rospy.INFO)
sys.argv = rospy.myargv(argv=sys.argv)
main()
However, I am not sure if this is the correct way to do it.
ModuleNotFoundError: No module named 'StringIO'
in python3
From https://docs.python.org/3.0/whatsnew/3.0.html
The StringIO and cStringIO modules are gone. Instead, import the io module and use io.StringIO or io.BytesIO for text and data respectively.
possible solution:
try:
import StringIO
except ImportError:
from io import StringIO
It seems xdot api has changed in Ubuntu 14.04/ Indigo and this breaks smach_viewer.py. The details are in the following question I posted on answers.ros.org.
http://answers.ros.org/question/186955/smach_viewer-does-not-work-in-indigo/
The error message when I run smach_viewer.py is as follows.
[aravind@jeeves simple_smach]$ rosrun smach_viewer smach_viewer.py
Exception in thread Thread-6:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(_self.__args, *_self.__kwargs)
File "/opt/ros/indigo/lib/smach_viewer/smach_viewer.py", line 848, in _update_graph
self.set_dotcode(dotstr,zoom=False)
File "/opt/ros/indigo/lib/smach_viewer/smach_viewer.py", line 866, in set_dotcode
if self.widget.set_dotcode(dotcode, None):
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/wxxdot.py", line 455, in set_dotcode
self.set_xdotcode(xdotcode)
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/wxxdot.py", line 483, in set_xdotcode
self.graph = parser.parse()
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/xdot.py", line 1146, in parse
DotParser.parse(self)
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/xdot.py", line 951, in parse
self.parse_graph()
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/xdot.py", line 960, in parse_graph
self.parse_stmt()
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/xdot.py", line 993, in parse_stmt
self.parse_subgraph()
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/xdot.py", line 974, in parse_subgraph
self.parse_stmt()
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/xdot.py", line 993, in parse_stmt
self.parse_subgraph()
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/xdot.py", line 974, in parse_subgraph
self.parse_stmt()
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/xdot.py", line 1009, in parse_stmt
self.handle_node(id, attrs)
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/xdot.py", line 1120, in handle_node
shapes.extend(parser.parse())
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/xdot.py", line 608, in parse
points = self.read_polygon()
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/xdot.py", line 503, in read_polygon
x, y = self.read_point()
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/xdot.py", line 486, in read_point
x = self.read_number()
File "/opt/ros/indigo/lib/python2.7/dist-packages/xdot/xdot.py", line 480, in read_number
return int(self.read_code())
ValueError: invalid literal for int() with base 10: '79.92'
It seems the smach_viewer.py script did not make it into the Hydro Debian packages under Ubuntu 12.04. Was that an oversight? Or is it no longer compatible?
I have been looking at the various forks( @jbohren 's as well) to find a way to run the smach_viewer on Kinetic but without success.
I know you guys are struggling with the new version of wxPython and xdot.
Whether it runs on the new coming rqt plugin or not, I would love to know if someone succeeded in running a viewer for smach on Kinetic.
Keep on the great work!
Hi guys ๐, after nearly two years, the issue of porting SMACH to ROS 2 is alive again. Current details can be found here โก๏ธ ros/executive_smach#70. It might be a good idea to synchronize porting of both executive_smach and executive_smach_visualization. I suggest that the maintainer of this repository create a ros2
branch so that there is something to merge pull requests to.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.