Ask Your Question
0

unable to import smach

asked 2014-03-09 04:12:53 -0500

Massbuilder gravatar image

updated 2014-03-09 04:13:14 -0500

I want to integrate a state machine using the smach libraryto my robot but when I tried running the first tutorial I got this error message/ ImportError: No module named smach/ On the documentation page I found no installation instructions. Does smach come standard with groovy and I am importing wrong or does it need to be install it separately when using groovy?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-03-09 05:40:54 -0500

Pi Robot gravatar image

I can't remember if smach is installed by default with Groovy, but you can try installing it manually like this:

$ sudo apt-get install ros-groovy-executive-smach*

Then you can try import commands like this:

import smach
from smach import State, StateMachine, CBState
from smach_ros import SimpleActionState, IntrospectionServer

--patrick

edit flag offensive delete link more

Comments

didn't work however I did run rostopic list and confirmed it is on my computer. And I am importing it properly, What could the problem be

Massbuilder gravatar image Massbuilder  ( 2014-03-09 08:02:44 -0500 )edit

I'm not sure what you mean by "running rostopic list" to confirm that it is on your computer since this command does not show what is installed. Can you please update your question with the command you actually ran and the output you are seeing that confirms that you have smach installed? Thanks.

Pi Robot gravatar image Pi Robot  ( 2014-03-09 09:46:22 -0500 )edit

I noticed something a little funny but don't know what to make of it. There is a file under ros_smach called test with test programs in it. I ran some of these and they work and they import from smach, I even got one running as I write this. Weird huh!

Massbuilder gravatar image Massbuilder  ( 2014-03-09 10:53:37 -0500 )edit
1

OK, that sounds like either your manifest.xml file (rosbuild) or your package.xml file (catkin) is missing the required dependencies on smach. Is your test script inside a package of your own creating? If so, add dependencies for smach, smach_ros and smach_msgs in your manifest.xml or package.xml file. The smach_ros package.xml illustrates the syntax for catkin.

Pi Robot gravatar image Pi Robot  ( 2014-03-09 13:40:22 -0500 )edit

In response to the first question I was trying to add the script to a package I made several months ago.

Massbuilder gravatar image Massbuilder  ( 2014-03-10 03:31:16 -0500 )edit

Is it a rosbuild package (manifest.xml) or catkin? (package.xml).

Pi Robot gravatar image Pi Robot  ( 2014-03-10 14:11:25 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-03-09 04:12:53 -0500

Seen: 501 times

Last updated: Mar 09 '14