Skip to content

Commit

Permalink
use userdata=None for functions which don't userdata
Browse files Browse the repository at this point in the history
This way you can easily use smach_states seperate
Just this file, but should be done in all smach_states
  • Loading branch information
MatthijsBurgh committed Jun 7, 2017
1 parent d938e07 commit 4cd9069
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions robot_smach_states/src/robot_smach_states/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, robot=None):
'abort'])
self.robot = robot

def execute(self, userdata):
def execute(self, userdata=None):
self.robot.lights.set_color(0,0,1) #be sure lights are blue

self.robot.head.reset()
Expand Down Expand Up @@ -67,7 +67,7 @@ def location_2d(self, location):

return e_loc.pose.frame.p.x(), e_loc.pose.frame.p.y(), rz

def execute(self, userdata):
def execute(self, userdata=None):
if isinstance(self.initial_position, str):
x,y,phi = self.location_2d(self.initial_position)
elif len(self.initial_position) == 3: #Tuple or list
Expand Down Expand Up @@ -101,7 +101,7 @@ def __init__(self, robot, trigger, topic):

self.pub = rospy.Publisher(topic, std_msgs.msg.String, queue_size=10)

def execute(self, userdata):
def execute(self, userdata=None):
self.pub.publish(std_msgs.String(data=trigger))
return 'triggered'

Expand Down Expand Up @@ -135,7 +135,7 @@ def __init__(self, robot, triggers, topic, rate = 1.0):
rospy.loginfo('topic: /%s', topic)
rospy.loginfo('rate: %d Hz', self.rate)

def execute(self, userdata):
def execute(self, userdata=None):
self.trigger_received = False
#rospy.logwarn("Waiting for trigger (any of {0}) on topic /trigger".format(self.triggers))
while not rospy.is_shutdown() and not self.trigger_received:
Expand Down Expand Up @@ -251,7 +251,7 @@ def __init__(self, robot, designator, attempts = 1, sleep_interval = 1, outcomes
self.attempts = attempts
self.sleep_interval = sleep_interval

def execute(self, userdata):
def execute(self, userdata=None):
counter = 0

while counter < self.attempts:
Expand Down

0 comments on commit 4cd9069

Please sign in to comment.