示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        MyUISetting();

        DBSetting();

        //ROSTMSに接続
        wsc = GameObject.Find("Android Ros Socket Client").GetComponent <AndroidRosSocketClient>();
        try {
            wsc.Advertiser(publih_name, "tms_msg_db/TmsdbStamped");
        }
        catch { }

        //タッチ関連システム取得
        recog = GameObject.Find("Touch Recognition System").GetComponent <TouchRecognition>();
        InitPosition();
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        if (wsc.conneciton_state != wscCONST.STATE_CONNECTED)
        {
            time += Time.deltaTime;
            if (time > 3.0f)
            {
                time = 0.0f;
                wsc.Connect();
                wsc.Advertiser(publih_name, "tms_msg_db/TmsdbStamped");
            }
        }
        else
        {
            if (!init_flag)
            {
                InitPosition();
            }
        }

        //タッチした場所をデータベースに登録
        if (recog.touch_start && recog.touch_on_image)
        {
            //Debug.Log("Touch: " + recog.touch_position_of_refrigerator.ToString("f2"));

            int dropdown_value = dropdown.value;
            data_list[dropdown_value].time  = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString("00") + "-" + DateTime.Now.Day.ToString("00") + "T";
            data_list[dropdown_value].time += DateTime.Now.Hour.ToString("00") + ":" + DateTime.Now.Minute.ToString("00") + ":" + DateTime.Now.Second.ToString("00") + "." + DateTime.Now.Millisecond.ToString();
            data_list[dropdown_value].x     = recog.touch_position_of_refrigerator.x + offset_x_refrigerator;
            data_list[dropdown_value].y     = recog.touch_position_of_refrigerator.y + offset_y_refrigerator;
            data_list[dropdown_value].z     = offset_z_refrigerator;
            data_list[dropdown_value].state = 1;

            Publish(data_list[dropdown_value]);

            recog.ChangeImagePosition(image_list[dropdown_value]);

            Debug.Log("Change: " + data_list[dropdown_value].name + "(" + dropdown_value + "), " + new Vector3((float)data_list[dropdown_value].x, (float)data_list[dropdown_value].y, (float)data_list[dropdown_value].z).ToString("f2"));
        }
    }