示例#1
0
 def end_cb(self, req):
     if req.data == True:
         self.odom_end = self.odom[:]
         self.end = False
         self.calibration()
     res = SetBoolResponse()
     res.success = True
     res.message = "recieved"
     return res
示例#2
0
 def emergency_stop_cb(self, req):
     if req.data == True:
         self.emergency_stop = True
     else:
         self.emergency_stop = False
     res = SetBoolResponse()
     res.success = True
     res.message = "recieved"
     return res
示例#3
0
 def clear_cb(self, req):
     if req.data == True:
         self.clear = True
     else:
         self.clear = False
     res = SetBoolResponse()
     res.success = True
     res.message = "recieved"
     return res
示例#4
0
	def station_keeping_cb(self, req):
		if req.data == True:
			self.goal = self.stop_pos
			self.is_station_keeping = True
		else:
			self.is_station_keeping = False
		res = SetBoolResponse()
		res.success = True
		res.message = "recieved"
		return res
示例#5
0
 def activacion(self, req):
 
     if req.data == True:
         self.flag = True
         rospy.loginfo(rospy.get_caller_id() + "Recibida peticion de True")
         return SetBoolResponse(True, "Activado")
     else:
         self.flag = False
         rospy.loginfo(rospy.get_caller_id() + "Recibida peticion de False")
         return SetBoolResponse(False, "Desactivado")
示例#6
0
def stringCallback(req):
    # 显示请求数据
    if req.data:
        rospy.loginfo("Hello ROS!")

        # 反馈数据
        return SetBoolResponse(True, "Print Successully")
    else:
        # 反馈数据
        return SetBoolResponse(False, "Print Failed")
示例#7
0
 def handleSetEnabledSrv(self, req):
     res = SetBoolResponse()
     res.success = False
     try:
         self.listeningMovementProxy.setEnabled(req.data)
         res.success = True
         return res
     except RuntimeError, e:
         rospy.logerr("Exception caught:\n%s", e)
         return res
 def handleSetEnabledSrv(self, req):
     res = SetBoolResponse()
     res.success = False
     try:
         self.backgroundMovementProxy.setEnabled(req.data)
         res.success = True
         return res
     except RuntimeError, e:
         rospy.logerr("Exception caught:\n%s", e)
         return res
示例#9
0
 def enable_detection(self, req):
     global enable_node
     enable_node = req.data
     res = SetBoolResponse()
     res.success = True
     if enable_node:
         res.message = "Node enabled"
     else:
         res.message = "Node disabled"
     return res
示例#10
0
def serviceCallback(msg):
    """Enable Service Callback

    Arguments:
        msg {BoolMsg} -- TRUE/FALSE
    """
    global enabled
    enabled = msg.data
    response = SetBoolResponse()
    response.success = True
    return response
示例#11
0
  def setLoopFlagServiceCallback(self, req):
    res = SetBoolResponse()

    self.loop_flag = req.data
    res.success = True
    if req.data == True:
      res.message = "Starting publishing images in loop."
    else:
      res.message = "Stopping publishing images in loop."

    return res
def grasp_something(request):
    if (request.data == True):
        length = 0.03
    elif (request.data == False):
        length = 0.021
    gripper_client = actionlib.SimpleActionClient('/gripper_move',
                                                  GripperMoveAction)
    gripper_move(gripper_client, length, 10, 10, 10)
    response = SetBoolResponse()
    response.success = True
    return response
示例#13
0
    def moveCloser(self, req):

        if req.data:
            self.approach_now = True
            self.orientation_fixed = False
            self.update_robot_pose()
            return SetBoolResponse(True, "Service is successfully called")

        else:
            self.approach_now = False
            return SetBoolResponse(False, "Service is not successfully called")
示例#14
0
def buzzer_callback(msg):
    if not isinstance(msg, SetBoolRequest):
        return
    if msg.data:
        driver.buzzer_open()
    else:
        driver.buzzer_close()

    response = SetBoolResponse()
    response.success = True
    return response
示例#15
0
    def enable_service_cb(self, req):
        self.enable_trajectory = req.data
        resp = SetBoolResponse()
        resp.success = True

        if req.data:
            resp.message = "Topp Tracker enabled successfully."
        else:
            resp.message = "Topp Tracker disabled successfully."

        return resp
示例#16
0
    def _handle_foodload(self, req):
        rospy.logdebug("Request of LoadFood Recieved..Processing")
        calibration_req = SetBoolRequest()
        calibration_req.data = req.data
        cal_response = self._calibrate_load_sensor_client(calibration_req)

        rospy.logdebug("Calibration complete!")
        response = SetBoolResponse()
        response.success = cal_response.success
        response.message = cal_response.message
        return response
示例#17
0
def string_callback(req):
    getpoetry()
    if req.data:
        ttt = rospy.get_param('truth').replace('。', '')
        print(ttt)
        print(poetry[ttt])
        #text = "床前明月光,疑是地上霜。举头望明月,低头思故乡。".encode('gbk')
        XF_text(poetry[ttt].encode('gbk'))
        return SetBoolResponse(True, "Print Successully")
    else:
        return SetBoolResponse(False, "Print Failed")
def destroy(req):
    print "received this request: ", req
    print "Roger that!.."
    # do your logic here and send a respinse after it
    response = SetBoolResponse()
    response.success = True
    if req.data:
        response.message = "You are victorious!"
    else:
        response.message = "enemy spared!"
    return response
示例#19
0
    def calibrate_callback(self, req):

        rospy.logdebug(
            "Request of Load Sensor Calibration Received..Processing")
        self.calibrate(adding_object=req.data)
        rospy.logdebug("Load Sensor Calibration  complete!")
        response = SetBoolResponse()
        response.success = True
        response.message = "Calibration " + str(
            self._carrying_object) + " to weight=" + str(self._tare)
        return response
    def crash_callback(self, request):
        response = SetBoolResponse()
        avg_lsr = (self.laser_data.ranges[-2] + self.laser_data.ranges[2]) / 2

        if avg_lsr <= self.distance:
            # close enough to wall
            response.success = True
        else:
            response.success = False

        return response
示例#21
0
 def estop_cb(self, req):
     if req.data == True:
         self.emergencyStop = True
         rospy.loginfo("EStop")
     else:
         self.emergencyStop = False
         rospy.loginfo("Release EStop")
     res = SetBoolResponse()
     res.success = True
     res.message = "recieved"
     return res
示例#22
0
 def handleDisableBasicAwareness(self, req):
     res = SetBoolResponse()
     res.success = False
     try:
         self.proxy.basic_awareness.setEnabled(False) #True of False
         res.success = True
         res.message = str("Disabled")
         return res
     except RuntimeError, e:
         rospy.logerr("Exception caught:\n%s", e)
         return res
示例#23
0
 def emergency_stop_cb(self, req):
     if req.data == True:
         self.emergency_stop = True
         rospy.loginfo("Mode: Joystick")
     else:
         self.emergency_stop = False
         rospy.loginfo("Mode: Autonomous")
     res = SetBoolResponse()
     res.success = True
     res.message = "recieved"
     return res
示例#24
0
 def setStandByCb(self, req):
     '''
         ROS service server to enable/disable safety override
     '''
     response = SetBoolResponse()
     
     self.set_desired_standby_mode = req.data
     
     response.success = True
     response.message = 'received petition to set the standby mode to %d'%req.data
    
     return response
示例#25
0
def setOdometry(data):
    global odometryData, robViewMode
    resp = SetBoolResponse()
    odometryData = data
    robViewMode = 3
    udp.view3Send[1] = robViewMode  # mode number
    udp.view3Send[2] = int(odometryData.position.x)
    udp.view3Send[3] = int(odometryData.position.y)
    udp.view3Send[4] = int(odometryData.orientation.z)

    resp.ok = (sendRobView() == 1)
    return [resp.ok, ""]
示例#26
0
 def no_signal_cb(self, req):
     if req.data == True:
         self.check_no_signal = True
         rospy.loginfo("No Signal")
     else:
         self.check_no_signal = False
         self.motor_msg.vertical = 0
         rospy.loginfo("Got Signal")
     res = SetBoolResponse()
     res.success = True
     res.message = "recieved"
     return res
示例#27
0
 def _lock_cb(self, msg):
     """
     @brief Can be used to get sync access to server
     """
     if msg.data:
         self._mutex.acquire()
     else:
         try:
             self._mutex.release()
         except BaseException:
             return SetBoolResponse(False, "Mutex already unlocked.")
     return SetBoolResponse(True, "Ok")
示例#28
0
 def thread_bg(self, client, request):
     wx.CallAfter(self.show_dialog)
     self.action_stop()
     rospy.sleep(1)
     try:
         resp = client.call(request)
         wx.CallAfter(self.update_reply_show, resp)
     except rospy.ServiceException, e:
         resp = SetBoolResponse()
         resp.success = False
         resp.message = 'no such service in simulation'
         wx.CallAfter(self.update_reply_show, resp)
示例#29
0
	def dive_cb(self, req):
		if req.data == True:
			rospy.loginfo("Start Diving")
			self.time_start = time.time()
			self.start_diving = True
		else:
			rospy.loginfo("Stop Diving")
			self.start_diving = False
		res = SetBoolResponse()
		res.success = True
		res.message = "recieved"
		return res
示例#30
0
 def navigation_cb(self, req):
     if req.data == True:
         rospy.loginfo("Start Navigation")
         self.start_navigation = True
         self.set_path_succ = False
     else:
         rospy.loginfo("Stop Navigation")
         self.start_navigation = False
     res = SetBoolResponse()
     res.success = True
     res.message = "recieved"
     return res
示例#31
0
def setOdometry(data):
    global odometryData, robViewMode
    resp = SetBoolResponse()
    odometryData = data
    robViewMode = 3
    udp.view3Send[4] = robViewMode  # mode number
    udp.view3Send[8] = int(odometryData.position.x)
    udp.view3Send[12] = int(odometryData.position.y)
    udp.view3Send[16] = int(odometryData.orientation.z)

    udp.sendRobView()
    resp.success = True
    return resp
	def start_aruco_place(self, req):
		success = self.pick_type.pick_and_place_aruco("place")
		reply = SetBoolResponse()
		reply.success = success
		reply.message = ""
		return reply