def callback(self, config, level):
        #self.speedControl = config.speed_control

        # create temporary message and fill with data from dynamic reconfigure
        temp_msg = Axis()
        temp_msg.pan = config.pan
        temp_msg.tilt = config.tilt
        temp_msg.zoom = config.zoom
        temp_msg.focus = config.focus
        temp_msg.brightness = config.brightness
        temp_msg.autofocus = config.autofocus

        # check sanity and apply values
        self.cmd(temp_msg)

        # read sanitized values and update GUI
        config.pan = self.msg.pan
        config.tilt = self.msg.tilt
        config.zoom = self.msg.zoom
        config.focus = self.msg.focus
        config.brightness = self.msg.brightness
        config.autofocus = self.msg.autofocus

        # update GUI with sanitized values
        return config
Esempio n. 2
0
    def callback(self, config, level):
        """Deprecated."""
        #self.speedControl = config.speed_control

        if self._executing_reconfigure or (hasattr(self, '_camera_controller') and (self._camera_controller._executing_parameter_update or self._camera_controller._executing_reconfigure)):
            return config

        with self._reconfigure_mutex:
            self._executing_reconfigure = True

            # create temporary message and fill with data from dynamic reconfigure
            command = Axis()
            command.pan = config.pan
            command.tilt = config.tilt
            command.zoom = config.zoom
            command.focus = config.focus
            command.brightness = config.brightness
            command.autofocus = config.autofocus

            # check sanity and apply values
            self.cmd(command)

            # read sanitized values and update GUI
            config.pan = command.pan
            config.tilt = command.tilt
            config.zoom = command.zoom
            config.focus = self._camera_controller._focus
            config.brightness = self._camera_controller._brightness
            config.autofocus = self._camera_controller._autofocus

            self._executing_reconfigure = False

            # update GUI with sanitized values
            return config
Esempio n. 3
0
 def dynamicReconfigCallback(self, config, level):
     #self.speedControl = config.speed_control
     
     # create temporary message and fill with data from dynamic reconfigure
     temp_msg = Axis()
     temp_msg.pan = config.pan
     temp_msg.tilt = config.tilt
     temp_msg.zoom = config.zoom
     temp_msg.focus = config.focus
     temp_msg.brightness = config.brightness
     temp_msg.autofocus = config.autofocus
     
     # check sanity and apply values
     self.cmdCallback(temp_msg)
     
     # read sanitized values and update GUI
     config.pan = self.msg.pan
     config.tilt = self.msg.tilt
     config.zoom = self.msg.zoom
     config.focus = self.msg.focus
     config.brightness = self.msg.brightness
     config.autofocus = self.msg.autofocus
     
     # update GUI with sanitized values
     return config
Esempio n. 4
0
def ptz():
    global image_1
     #rospy.init_node('axis_ptz_random_move')
      #  self.pub = rospy.Publisher('/cmd', Axis)
    pub = rospy.Publisher('/cmd', Axis)
    pub1 = rospy.Publisher('/chatter', Image)
    rospy.init_node('ptzcmd', anonymous=True)
    bridge=CvBridge()
    Message=Axis()
    sub=rospy.Subscriber('/image_raw/compressed', CompressedImage,callback,queue_size=1)
    r = rospy.Rate(40)
        
    while not rospy.is_shutdown():
        pan1=float(raw_input("Enter pan:"))
        tilt1=float(raw_input("Enter tilt:"))
        zoom1=float(raw_input("Enter zoom:"))
        brightness1=float(raw_input("Enter brightness:"))
        #auto=True
        Message.pan=pan1
        Message.tilt=tilt1
        Message.zoom=zoom1
        Message.brightness=brightness1
        #Message.autofocus=auto
        pub.publish(Message)
        r.sleep()