Exemple #1
0
    void Start()
    {
        _currentMesh  = new Mesh();
        _meshRenderer = GetComponent <SkinnedMeshRenderer>();
        _poseUpdater  = new SMPLPoseUpdater(this.transform);
        _client       = new Client();

        // must match the name of the object in the scene
        _imuIdToName.Add(_rArmId, "r_arm");
        _imuIdToName.Add(_rLegId, "r_leg");
        _imuIdToName.Add(_lArmId, "l_arm");
        _imuIdToName.Add(_lLegId, "l_leg");
        _imuIdToName.Add(_pelvisId, "pelvis");
        _imuIdToName.Add(_headId, "head");

        // must match name in definition of SMPL model
        _imuIdToBoneName.Add(_rArmId, "R_Elbow");
        _imuIdToBoneName.Add(_rLegId, "R_Knee");
        _imuIdToBoneName.Add(_lArmId, "L_Elbow");
        _imuIdToBoneName.Add(_lLegId, "L_Knee");
        _imuIdToBoneName.Add(_pelvisId, "Pelvis");
        _imuIdToBoneName.Add(_headId, "Head");

        // to determine location where to display IMU sensors
        _imuIdToVertex.Add(_rArmId, 5431);   // right arm
        _imuIdToVertex.Add(_rLegId, 4583);   // right leg
        _imuIdToVertex.Add(_lArmId, 1962);   // left arm
        _imuIdToVertex.Add(_lLegId, 1096);   // left leg
        _imuIdToVertex.Add(_pelvisId, 3021); // pelvis
        _imuIdToVertex.Add(_headId, 412);

        // intialize control object that handles communication to XSens device
        _xda = new MyXda();

        // scan for devices
        ScanForStations();

        // enable radio for master device found when scanning for stations
        EnableRadio();
        _totalConnectedMTWs = _masterDevice.childCount();

        UnityEngine.Debug.Log("Waiting for MTWs to connect to the master.");

        // connect to inference server
        _client.ConnectToTcpServer();

        // load the model into a TensorFlow session
        LoadModel();
    }