smartsenselab/sensecam-control

camera does not move using vapix_control

Biaocsu opened this issue · 2 comments

Hi, thanks for you work

I want to use vapix_control method with speed para, However, the camera does not move, maybe the problem is http in vapix_control.py file , but how do I change it, whats the rule ?

please give some advices, really thanks

Having the same issue here... Did you find the solution?!

It is possible that your camera has multiple stream profiles. By default the API is set up to control profile 1, for me this wasa fish eye viewport since my PTZ is all digital. There is no PTZ operation to do here. However if you go to the definition for _camera_command in vapix_control.py, you will find a dict called base_q_args. There is an item called camera in there, you can change it to the appropriate stream that you are working with. This solved the issue for me. Perhaps worth updating this repo with a setup option for this.

def _camera_command(self, payload: dict):
        """
        Function used to send commands to the camera
        Args:
            payload: argument dictionary for camera control

        Returns:
            Returns the response from the device to the command sent

    logging.info('camera_command(%s)', payload)

    base_q_args = {
        'camera': 6,
        'html': 'no',
        'timestamp': int(time.time())
    }

    payload2 = CameraControl.__merge_dicts(payload, base_q_args)

    url = 'http://' + self.__cam_ip + '/axis-cgi/com/ptz.cgi'

    resp = requests.get(url, auth=HTTPDigestAuth(self.__cam_user, self.__cam_password),
                        params=payload2)

    if (resp.status_code != 200) and (resp.status_code != 204):
        soup = BeautifulSoup(resp.text, features="lxml")
        logging.error('%s', soup.get_text())
        if resp.status_code == 401:
            sys.exit(1)

    return resp