How do I add my smach state machine to a catkin package?
How can I incorporate a new state machine into my existing catkin project? I have followed the smach tutorials and based my state machine on one of the tutorials. I got it working at first by using the roslib.load_manifest('smach_tutorials') to reference the smach_tutorials package (when testing it from within a rosbuild package). However, when I try to move the script to a new, catkin package of my own, and load my own manifest, I cannot get it to run. I am using Groovy.
I try to run it with: rosrun mypackage mystatemachine.py
I get the error:
import smach ImportError: No module named smach <
I have done the following: 1) Set my pythonpath in .bashrc: export PYTHONPATH=$PYTHONPATH:$ROS_ROOT/core/roslib/src
2) Added build_depend and run_depend tags to my package.xml for smach, smach_ros and rospy
3) added a setup.py to my project and catkin_python_setup() to my CMakeLists.txt
4) Tried the import roslib tag and without in my state machine script.
All with no luck.
Is there a tutorial or example for getting a smach state machine to work in a catkin package? I can get this script to work if I leave it in the smach_tutorials, but I would rather have it run from within my own package.
Thanks in advance!
I found that if I added the smach_tutorials package to my catkin_ws and also keep the "import roslib; roslib.load_manifest('smach_tutorials')" at the top of the smach script, then the state machine will run in my catkin project. The problem still remains - why do I need the smach_tutorials package?