// Use this for initialization
    void Start()
    {
        // Create a texture for the depth image and color image
        depthTexture = new Texture2D(width, height, TextureFormat.R16, false);
        colorTexture = new Texture2D(2, 2);

        depthTopic = "movo_camera/sd/image_depth_rect";
        colorTopic = "movo_camera/sd/image_color_rect/compressed";
        wsc.Subscribe(depthTopic, "sensor_msgs/Image", compression, framerate);
        wsc.Subscribe(colorTopic, "sensor_msgs/CompressedImage", compression, framerate);
        InvokeRepeating("UpdateTexture", 0.1f, 0.1f);
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        // Create a texture for the depth image and color image
        depthTexture = new Texture2D(width, height, TextureFormat.R16, false);
        colorTexture = new Texture2D(2, 2);


        wsc        = GameObject.Find("WebsocketClient").GetComponent <WebsocketClient>();
        depthTopic = "kinect2/sd/image_depth_rect";
        colorTopic = "kinect2/sd/image_color_rect/compressed";
        wsc.Subscribe(depthTopic, "sensor_msgs/Image", compression, framerate);
        wsc.Subscribe(colorTopic, "sensor_msgs/CompressedImage", compression, framerate);
        InvokeRepeating("UpdateTexture", 0.1f, 0.1f);
    }
示例#3
0
 // Use this for initialization
 void Start()
 {
     Debug.Log("TFListener Starting");
     wsc = GameObject
           .Find("WebsocketClient").GetComponent <WebsocketClient>();
     wsc.Subscribe(topic, "std_msgs/String", 0, (success) => { this.subscribed = success; });
 }
示例#4
0
 void Start()
 {
     // Get the live websocket client
     wsc = GameObject.Find("WebsocketClient").GetComponent <WebsocketClient>();
     wsc.Subscribe(ik_topic, "std_msgs/String", 0);
     rend = GetComponent <Renderer>();
     InvokeRepeating("CheckIK", 0.1f, 0.1f);
 }
示例#5
0
        static async Task Main(string[] args)
        {
            try
            {
                Console.CancelKeyPress += CancelKeyPressed;

                var token = ApiToken;
                while (string.IsNullOrWhiteSpace(token))
                {
                    Console.Write("Please specify your api token: ");
                    token = Console.ReadLine();
                }

                Console.WriteLine("Connecting to Finnhub...");
                cl = new WebsocketClient(token);
                await cl.Connect(cts.Token);

                Console.WriteLine("Connected.");

                foreach (var symbol in symbols)
                {
                    await cl.Subscribe(symbol, cts.Token);

                    Console.WriteLine($"Subscribed {symbol}");
                }

                while (!cancelPressed)
                {
                    var msg = await cl.Receive(cts.Token);

                    switch (msg)
                    {
                    case PingMessage ping:
                        Console.WriteLine("Ping");
                        break;

                    case ErrorMessage err:
                        Console.WriteLine($"ERROR returned by Finnhub: {err.Msg}");
                        break;

                    case TradeMessage trade:
                        var tradeMsg = string.Join("\n", trade.Data.Select(t => $"{t.S} - #{t.V} x {t.P}"));
                        Console.WriteLine($"Trade: {tradeMsg}");
                        break;

                    default:
                        Console.WriteLine($"WARNING: Unknown message received.");
                        break;
                    }
                }
            }
            catch (OperationCanceledException) { }
            catch (WebSocketException wse)
            {
                Console.WriteLine($"CONNECTION ERROR: {wse}");
            }
        }
    // Use this for initialization
    void Start()
    {
        texture = new Texture2D(width, height, TextureFormat.RGB565, false);
        GetComponent <Renderer> ().material.mainTexture = texture;
        GameObject wso = GameObject.FindWithTag("WebsocketTag");

        wsc   = wso.GetComponent <WebsocketClient> ();
        topic = "kinect2/sd/image_depth_rect";
        wsc.Subscribe(topic, "sensor_msgs/Image", compression, framerate);
    }
示例#7
0
 void Start()
 {
     // Get the live websocket client
     wsc = GameObject.Find("WebsocketClient").GetComponent <WebsocketClient>();
     wsc.Subscribe(ik_topic, "std_msgs/String", 0);
     foreach (GameObject obj in objectsToMakeRed)
     {
         renderersOfOjects.Add(obj.GetComponent <Renderer>());
     }
     InvokeRepeating("CheckIK", 0.1f, 0.1f);
 }
示例#8
0
    // Use this for initialization
    void Start()
    {
        wsc = GameObject.Find("WebsocketClient").GetComponent <WebsocketClient>();
        wsc.Subscribe(topic, "std_msgs/String", 0);

        //Attach table stuff
        GameObject basePivot = GameObject.Find("basePivot");          // replace with hashmap
        GameObject table     = GameObject.Find("Table");

        table.transform.SetParent(basePivot.transform);                    //make table the parent object of the base pivot
        table.transform.localPosition = new Vector3(0f, -.15f, 0f);        //new local position
        table.transform.localScale    = new Vector3(0.2123f, 1f, 0.2123f); //local scaling of robot
    }
    void Start()
    {
        //rendering texture for the RGB feed
        rend    = GetComponent <Renderer>();
        texture = new Texture2D(2, 2);
        rend.material.mainTexture = texture;

        wsc   = GameObject.Find("WebsocketClient").GetComponent <WebsocketClient>();
        topic = "cameras/" + arm + "_hand_camera/image_compressed/compressed";
        wsc.Subscribe(topic, "sensor_msgs/CompressedImage", framerate);

        InvokeRepeating("RenderTexture", .5f, 1.0f / framerate);
    }
    // Use this for initialization
    void Start()
    {
        texture = new Texture2D(width, height, TextureFormat.ARGB4444, false);
        rend    = GetComponent <Renderer> ();
        rend.material.mainTexture = texture;
        rend.material.SetTextureScale("_MainTex", new Vector2(-1, 1));
        material.mainTexture = texture;
        //image = new byte[85151];
        wsc   = GameObject.Find("WebsocketClient").GetComponent <WebsocketClient>();
        topic = "openni/depth_registered/hw_registered/image_rect_raw";
        wsc.Subscribe(topic, "sensor_msgs/Image", compression, framerate);

        InvokeRepeating("RenderTexture", .5f, 1.0f / framerate);
    }
示例#11
0
    // Use this for initialization
    void Start()
    {
        projector = GetComponent <Projector> ();

        texture          = new Texture2D(2, 2, TextureFormat.ASTC_RGBA_4x4, false);
        texture.wrapMode = TextureWrapMode.Clamp;
        projector.material.SetTexture("_ShadowTex", texture);


        GameObject wso = GameObject.FindWithTag("WebsocketTag");

        wsc   = wso.GetComponent <WebsocketClient> ();
        topic = "cameras/" + arm + "_hand_camera/image_compressed/compressed";
        wsc.Subscribe(topic, "sensor_msgs/CompressedImage", compression, framerate);

        Invoke("attachToGripper", 0.2f);          // wait a bit to make sure the gripper object has been made

        InvokeRepeating("renderTexture", .5f, 1.0f / framerate);
    }
示例#12
0
 // Use this for initialization
 void Start()
 {
     wsc = GameObject.Find("WebsocketClient").GetComponent <WebsocketClient>();
     wsc.Subscribe(topic, "std_msgs/String", 0);
 }