#!/usr/bin/env python
# encoding: utf-8
"""
@author: simin. Gong
@license: (C) Copyright 2013-2023 Spacemit Corporation Limited.
@contact: simin.gong@spacemit.com
@file: pos_plugin.py
@date: 2024/12/17 15:32 
@desc:
"""
import os
import time
from ai_tool.plugins.camera_detect import libs
from ai_tool.plugins import CameraDetectPlugin

lib_path = os.path.dirname(libs.__file__)

rtmpose_path = os.path.join(lib_path, 'rtmpose-t.sim.q.onnx')

class CameraPosePlugin(CameraDetectPlugin):

    def __init__(self):
        super(CameraPosePlugin, self).__init__()


    def run_camera_plugin(self):
        from .rtm_pose_node import RTMPostNode
        from .usb_cam_node import UsbCamNode
        detect = RTMPostNode("dete0", rtmpose_path, self.data_callback)
        self.usb_cam = UsbCamNode("usbCam0", 1, self.data_callback)
        detect.attach_to([self.usb_cam])
        self.usb_cam.start()
        self.start_time = time.time()
        self.e_Event.wait()
        self.usb_cam.stop_cap()
        print('进程结束')
