def getCurrentState (): global lock lock.acquire() global currentState st = NavigationStatus() st.status = currentState.status st.msg = currentState.msg lock.release() rospy.loginfo ('\n\n********************** Getting Current state with value %s'%st) return st
#!/usr/bin/env python import roslib; roslib.load_manifest('navigation_sm_mock') import rospy from std_msgs.msg import String from pal_navigation_msgs.srv import * from pal_navigation_msgs.msg import NavigationStatus import threading import thread currentState = NavigationStatus() currentState.status = String('LOC') currentState.msg = String('') lock = threading.Lock() def getCurrentState (): global lock lock.acquire() global currentState st = NavigationStatus() st.status = currentState.status st.msg = currentState.msg lock.release() rospy.loginfo ('\n\n********************** Getting Current state with value %s'%st) return st def setCurrentState(st):