@@ -81,12 +81,14 @@ def __init__(self, name):
81
81
82
82
def preempt_cb (self ):
83
83
rospy .loginfo ('Server preempted' )
84
+ print ("Canceling current instructions" )
84
85
self ._canceled .cancel ()
85
86
publisher .move_base_action_client ().cancel_all_goals ()
86
87
87
88
def execute_cb (self , goal ):
88
89
# Setting the rate of execution.
89
90
if not self ._canceled is None and not self ._canceled .is_canceled ():
91
+ print ("Should cancel a goal first" )
90
92
rospy .loginfo ('Received a set of instructions without canceling the previous ones' )
91
93
return
92
94
r = rospy .Rate (1 )
@@ -347,7 +349,8 @@ def doaction(self, action, node):
347
349
self .publish_feedback ("%s:Charge(%s): START" % (node , secs ))
348
350
if self .cp1 is None :
349
351
self .cp1 = cp1 .CP1_Instructions ()
350
- status , msg = self .cp1 .charge (seconds = secs )
352
+ self .cp1 .track_battery_charge ()
353
+ status , msg = self .cp1 .charge ()
351
354
if self ._canceled .is_canceled ():
352
355
self .publish_feedback ("%s:Charge(%s): CANCELED" % (node , secs ))
353
356
return False
@@ -365,13 +368,13 @@ def checkcond(self, cond):
365
368
# we currently only support checking for visible objects and if an object is
366
369
# nearby
367
370
if cond .operator == VISIBLE :
368
- print "Checking if %s is visible..." % cond .params [0 ]
369
- print "Is %s visible?" % cond .params [0 ]
371
+ print ( "Checking if %s is visible..." % cond .params [0 ])
372
+ print ( "Is %s visible?" % cond .params [0 ])
370
373
ans = raw_input ()
371
374
return ans in ("yes" , "y" , "" , "\n " )
372
- elif cond .operatopr == STOP :
373
- print "Checking if %s is within %s distance..." % (cond .params [1 ], cond .params [0 ])
374
- print "Is %s within %s distance?" % (cond .params [1 ], cond .params [0 ])
375
+ elif cond .operator == STOP :
376
+ print ( "Checking if %s is within %s distance..." % (cond .params [1 ], cond .params [0 ]) )
377
+ print ( "Is %s within %s distance?" % (cond .params [1 ], cond .params [0 ]) )
375
378
ans = raw_input ()
376
379
return ans in ("yes" , "y" , "" , "\n " )
377
380
@@ -423,14 +426,15 @@ def eval(self, ast):
423
426
config = config2
424
427
break ;
425
428
if status == WAITING :
426
- print "Robot is waiting for input! But this shouldn't happen in this simulation! What's going on?"
429
+ print ( "Robot is waiting for input! But this shouldn't happen in this simulation! What's going on?" )
427
430
break
428
431
elif status == TERMINATED :
429
- print "Finished!"
432
+ print ( "Finished!" )
430
433
self .publish_feedback ("Finished!" );
431
434
break
432
435
elif status == FAIL :
433
- print "Failed!"
436
+ print ( "Failed!" )
437
+ print ("Here" )
434
438
self .publish_feedback ("Terminating because of failure" )
435
439
break
436
440
else :
0 commit comments