Skip to content
Snippets Groups Projects
Commit c94ab2b6 authored by User expired's avatar User expired :spy_tone1:
Browse files

added rvr led status

parent 1dd46f3b
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@ from vision_msgs.msg import Detection2D, ObjectHypothesisWithPose
from minibot_msgs.srv import set_url
import time
from threading import Thread
from sphero_rvr_msgs.srv import TriggerLedEvent, TriggerLedEventRequest
# *** CONSTANTS ***
......@@ -168,9 +169,34 @@ def detect_sign(img_rgb_stream, image_timestamp):
pub_result_img.publish(cmprsmsg)
def call_rvr_color_event(event_id: TriggerLedEventRequest, stop_current_event: bool):
# start rvr color event
service = "rvr/trigger_led_event"
try:
rospy.wait_for_service(service, timeout=0.5)
call = rospy.ServiceProxy(service, TriggerLedEvent)
response = call.call(TriggerLedEventRequest(stop_current_event=stop_current_event, event_id=event_id))
if not response.success:
raise rospy.ServiceException("Failed to set rvr status lights")
except rospy.ROSException as e:
# if the service is not available we just ignore this
pass
except rospy.ServiceException as e:
rospy.logerr("Service call failed: %s" % e)
def set_model_callback(req):
call_rvr_color_event(event_id=TriggerLedEventRequest.DOWNLOAD_MODEL, stop_current_event=False)
success = sign_classifier.setNewModel(req.url)
call_rvr_color_event(stop_current_event=True, event_id=-1)
if not success:
call_rvr_color_event(stop_current_event=False, event_id=TriggerLedEventRequest.ERROR)
return success
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment