Exemple #1
0
    // Start is called before the first frame update
    void Start()
    {
        filePath = getPath();
        string[] rowDataTemp = new string[11];
        rowDataTemp[0]  = "Timestamp";
        rowDataTemp[1]  = "x_POS";
        rowDataTemp[2]  = "y_POS";
        rowDataTemp[3]  = "z_POS";
        rowDataTemp[4]  = "x_ANGLE";
        rowDataTemp[5]  = "y_ANGLE";
        rowDataTemp[6]  = "z_ANGLE";
        rowDataTemp[7]  = "gasInput";
        rowDataTemp[8]  = "break";
        rowDataTemp[9]  = "steering";
        rowDataTemp[10] = "splash";
        sb.AppendLine(string.Join(",", rowDataTemp));
        InvokeRepeating("ReportPose", 1.0f, 0.01f);

        gasInput   = 0.0;
        breakInput = 0.0;
        steerInput = 0.0;


        // create stream info and outlet
        info = new liblsl.StreamInfo("UnityCamPos2", "CamPos", 11, 100, liblsl.channel_format_t.cf_float32, "CamPos_sourceID");
        // chns = info.desc().append_child("channels");

        outlet = new liblsl.StreamOutlet(info);
    }
    // Use this for initialization
    void Start()
    {
        liblsl.StreamInfo info = new liblsl.StreamInfo(source_id, "Markers", 1, 0, liblsl.channel_format_t.cf_int32, "myuniquesourceid123456");
        outlet = new liblsl.StreamOutlet(info);

        Debug.Log("[LSL] initialized!");
    }
Exemple #3
0
 void Start()
 {
     liblsl.StreamInfo streamInfo = new liblsl.StreamInfo(StreamName, StreamType, 1, liblsl.IRREGULAR_RATE, liblsl.channel_format_t.cf_string, StreamId);
     // TODO: You should probably add XML metadata to the stream so the recipient knows how to interpret the strings.
     currentSample = new string[1];
     outlet        = new liblsl.StreamOutlet(streamInfo);
 }
    // Use this for initialization
    void Start()
    {
        if (EVENT_MARKER_TYPE == LSL_EVENT_MARKER)
        {
            info   = new liblsl.StreamInfo("Unity_Event_Marker", "Markers", 1, 0, liblsl.channel_format_t.cf_string, "msi");
            outlet = new liblsl.StreamOutlet(info);
        }

        var stimulusManagerObject = GameObject.Find("Stimulus Manager");

        stimulusManager = stimulusManagerObject.GetComponent <StimulusManager>();

        var textUpdaterObject = GameObject.Find("Text Updater");

        textUpdater = textUpdaterObject.GetComponent <TextUpdater>();
        textUpdater.setText("Welcome");

        //Shuffle(conditions);

        orders = new int[TARGET_NUM];
        for (int i = 0; i < TARGET_NUM; ++i)
        {
            orders[i] = i;
        }
        Shuffle(orders);

        state = 5;
    }
        /// <summary>
        /// Connects to a Unicorn.
        /// </summary>
        /// <param name="serial">The serial of the device to connect.</param>
        private void ConnectionThread_DoWork(string serial, string streamName)
        {
            try
            {
                UpdateUIElements(DeviceStates.Connecting);

                //Open device
                _device = new Unicorn(serial);

                //Initialize lsl
                _lslInfo   = new liblsl.StreamInfo(streamName, "Data", (int)_device.GetNumberOfAcquiredChannels(), Unicorn.SamplingRate, liblsl.channel_format_t.cf_float32, serial);
                _lslOutlet = new liblsl.StreamOutlet(_lslInfo);

                UpdateUIElements(DeviceStates.Connected);
            }
            catch (DeviceException ex)
            {
                _device = null;
                UpdateUIElements(DeviceStates.NotConnected);
                ShowErrorBox(ex.Message);
            }
            catch (Exception ex)
            {
                _device = null;
                UpdateUIElements(DeviceStates.NotConnected);
                ShowErrorBox(String.Format("Could not open device. {0}", ex.Message));
            }
        }
Exemple #6
0
    // Use this for initialization
    void Start()
    {
        currentSample = new float[ChannelCount];

        streamInfo = new liblsl.StreamInfo(StreamName, StreamType, ChannelCount, Time.fixedDeltaTime * 1000);
        outlet     = new liblsl.StreamOutlet(streamInfo);
    }
        private void LinkLabStreamingLayer()
        {
            if (lslOutlet == null)
            {
                sample = new string[lslChannelCount];

                lslStreamInfo = new liblsl.StreamInfo(lslStreamName + "-" + idTextBox.Text, lslStreamType, lslChannelCount, sampling_rate, lslChannelFormat, guid + "-" + idTextBox.Text);
                lslOutlet     = new liblsl.StreamOutlet(lslStreamInfo);

                infoTextBox.Text += "Linked to Lab Streaming Layer\nNow Streaming Frame Data\n";
            }

            // Once linked no need for the button functionality so disable it.
            lslLink.Content   = "Camera is Linked";
            lslLink.IsEnabled = false;

            // Disable the Experiment ID Text Functionality
            idTextBox.IsEnabled = false;

            checkDirectory();

            //applyRecordingConfig();

            startRecordingProcess();
        }
        void Start()
        {
            var channelDefinitions = SetupChannels();

            dataRate = LSLUtils.GetSamplingRateFor(sampling);

            channelCount = channelDefinitions.Count;

            // initialize the array once
            currentSample = new float[channelCount];

            streamInfo = new liblsl.StreamInfo(StreamName, StreamType, channelCount, dataRate, liblsl.channel_format_t.cf_float32, unique_source_id);

            // it's not possible to create a XMLElement before and append it.
            liblsl.XMLElement chns = streamInfo.desc().append_child("channels");
            // so this workaround has been introduced.
            foreach (var def in channelDefinitions)
            {
                chns.append_child("channel")
                .append_child_value("label", def.label)
                .append_child_value("unit", def.unit)
                .append_child_value("type", def.type);
            }

            outlet = new liblsl.StreamOutlet(streamInfo);
        }
        /// <summary>
        ///
        /// </summary>
        internal override void RunLSL()
        {
            // set the meta data of the stream
            liblsl.StreamInfo info = new liblsl.StreamInfo(
                this.streamName, this.type, channelCount, nominalState,
                liblsl.channel_format_t.cf_float32, this.sourceID);

            // make the LSL outlet object based on the stream info
            liblsl.StreamOutlet outlet = new liblsl.StreamOutlet(info);

            // this array will hold the data being sent each time
            float[] data = new float[arrayLength];

            // while
            while (this.keepThreadRunning)
            {
                // get the data
                data = dataGenerator.GetFloatArrayData();

                // send the data out into the stream
                outlet.push_sample(data);

                // wait until the next piece of info is needed
                System.Threading.Thread.Sleep(this.delayInMiliseconds);
            }
        }
Exemple #10
0
 /// <summary> Start is called before the first frame update. </summary>
 private void Start()
 {
     samples = new T[channelCount];
     info    = new liblsl.StreamInfo(streamName, GetType(), channelCount, liblsl.IRREGULAR_RATE, GetFormat());
     outlet  = new liblsl.StreamOutlet(info);
     Debug.Log($"Creating Stream : Name = {info.Name()}, Type = {info.Type()}, Channel Count = {info.ChannelCount()}, Format = {info.ChannelFormat()}");
 }
        static void Main(string[] args)
        {
            // create stream info and outlet
            liblsl.StreamInfo   info   = new liblsl.StreamInfo("Tobii", "Gaze", 3, 60, liblsl.channel_format_t.cf_double64, "eye_tracker");
            liblsl.StreamOutlet outlet = new liblsl.StreamOutlet(info);
            InitializeHost();
            ConsoleKeyInfo keyinfo;
            //Console.WriteLine(sample.ToString());
            Program p = new Program();

            do
            {
                keyinfo = Console.ReadKey();

                while (!Console.KeyAvailable)
                {
                    p.CreateAndVisualizeLightlyFilteredGazePointStream();
                    //Console.WriteLine(time_st + "  " + eye_x+ "  " + eye_y);
                    //Console.WriteLine(p.sample[0].ToString() + "  " + p.sample[1].ToString() + "  " + p.sample[2].ToString());
                    outlet.push_sample(p.sample);
                    System.Threading.Thread.Sleep(10);
                }
            }while (keyinfo.Key != ConsoleKey.Spacebar);
            DisableConnectionWithTobiiEngine();
        }
Exemple #12
0
    void Awake()
    {
        // Setup the types of data we are sending.
        switch (lslSampleType)
        {
        case TypesOfSamples.FLOAT_TYPE:
            floatSample = new float[lslChannelCount];
            break;

        case TypesOfSamples.INTEGER_TYE:
            integerSample = new int[lslChannelCount];
            break;

        case TypesOfSamples.STRING_TYPE:
            stringSample = new string[lslChannelCount];
            break;
        }

        // Setup the information of the stream
        lslStreamInfo = new liblsl.StreamInfo(
            lslStreamName,
            lslStreamType,
            lslChannelCount,
            nominal_srate,
            lslChannelFormat,
            unique_source_id);

        // This will be used to send data.
        lslOutlet = new liblsl.StreamOutlet(lslStreamInfo);
    }
Exemple #13
0
    //**************//


    /**
     * @brief AdditionalStart The Start function is use by the AFloatInlet
     * class so you should not overwrite it. So we initiate the different variable here
     */
    protected override void AdditionalStart()
    {
        //get all transform of the hand
        tfs = GetComponentsInChildren <Transform>();
        //store in a proper order the finger joints transform.
        //[j1_thumb, j2_thumb, j3_thumb,
        // j1_index, j2_index, j3_index,
        // j1_middle,j2_middle,j3_middle
        // j1_ring,  j2_ring,  j3_ring,
        // j1_pinky, j2_pinky, j3_pinky]
        foreach (string tag in fingersTags)
        {
            foreach (Transform ch in tfs)
            {
                if (ch.tag == tag)
                {
                    fingersTf.Add(ch);
                }
            }
        }

        //put some value and limits to the joint
        for (int i = 0; i < 3 * 5; i++)
        {
            fingersJoints[i]        = 0.0f;
            fingersJoints_target[i] = 0.0f;
            fingersJoints_Max[i]    = 60.0f + ((i % 3 == 0) ? 20.0f : 0.0f);
        }
        fingersJoints_Max[0] = 40;
        fingersJoints_Max[1] = 40;

        // Start LSL stream to publish the current position of the hand
        streamInfo = new liblsl.StreamInfo(StreamOutName, StreamOutType, ChannelCount, Time.fixedDeltaTime * 1000);
        outlet     = new liblsl.StreamOutlet(streamInfo);
    }
Exemple #14
0
    // Use this for initialization
    void Start()
    {
        dataRate = LSLUtils.GetSamplingRateFor(sampling);

        streamInfo = new liblsl.StreamInfo(StreamName, StreamType, ChannelCount, dataRate, liblsl.channel_format_t.cf_int32, unique_source_id);

        outlet = new liblsl.StreamOutlet(streamInfo);
    }
Exemple #15
0
        // Use this for initialization
        // Use this for initialization
        void Start()
        {
            currentSample = new float[ChannelCount];

            streamInfo = new liblsl.StreamInfo(StreamName, StreamType, ChannelCount);

            outlet = new liblsl.StreamOutlet(streamInfo);
        }
Exemple #16
0
        public liblsl.StreamOutlet StartStream()

        {
            // liblsl.StreamInfo inf = new liblsl.StreamInfo("eyeLink_trigger", "Markers", 1, 0, liblsl.channel_format_t.cf_int32, "stim_triggers");
            liblsl.StreamInfo   inf  = new liblsl.StreamInfo("hardwareTest_trigger", "Markers", 1, 1, liblsl.channel_format_t.cf_float32, "sddsfsdf");
            liblsl.StreamOutlet outl = new liblsl.StreamOutlet(inf);
            return(outl);
        }
    void Start()
    {
        // initialize the array once
        currentSample = new float[ChannelCount];

        streamInfo = new liblsl.StreamInfo(StreamName, StreamType, ChannelCount, Time.fixedDeltaTime, liblsl.channel_format_t.cf_float32, unique_source_id);

        outlet = new liblsl.StreamOutlet(streamInfo);
    }
        private void ConnectMat()
        {
            if (!isConnected)
            {
                try
                {
                    matSensor.Open("COM" + this.comPortText.Text);
                    matSensor.StartDevice();

                    if (matSensor.IsOpen())
                    {
                        // Succesfully Connected
                        isConnected = true;
                        comPortConnectButton.Content = "Disconnect";

                        // LSL KickStart
                        if (lslOutlet == null)
                        {
                            sampling_rate = 100;
                            // This is How I Link the Output Stream!
                            lslStreamInfo = new liblsl.StreamInfo(lslStreamName + "-" + idTextBox.Text, lslStreamType, lslChannelCount, sampling_rate, lslChannelFormat, guid + "-" + idTextBox.Text);
                            lslOutlet     = new liblsl.StreamOutlet(lslStreamInfo);
                        }
                    }

                    else
                    {
                        MessageBoxResult result = MessageBox.Show("ERROR: Not Able to Connect",
                                                                  "Connection Unsuccessful", MessageBoxButton.OK);
                    }
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                try
                {
                    matSensor.StopDevice();
                    if (matSensor.Stop())
                    {
                        isConnected = false;
                        // Successfully Disconnected
                        comPortConnectButton.Content = "Connect";
                    }
                    else
                    {
                        MessageBoxResult result = MessageBox.Show("ERROR: Not Able to Disconnect",
                                                                  "An Unknown Problem Occurred while Disconnecting", MessageBoxButton.OK);
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
        private liblsl.StreamOutlet lslOutlet = null;         // The Streaming Outlet

        public LSLStreamer(string lslStreamName, string lslStreamType, int lslChannelCount, double sampling_rate, liblsl.channel_format_t lslChannelFormat, string guid)
        {
            if (lslOutlet == null)
            {
                // This is How I Link the Output Stream!
                lslStreamInfo = new liblsl.StreamInfo(lslStreamName, lslStreamType, lslChannelCount, sampling_rate, lslChannelFormat, guid);
                lslOutlet     = new liblsl.StreamOutlet(lslStreamInfo);
            }
        }
Exemple #20
0
        /// <summary> Use this for initialization. </summary>
        private void Start()
        {
            watch = new Stopwatch();
            watch.Start();

            sample = new float[channelCount];
            info   = new liblsl.StreamInfo(streamName, streamType, channelCount, Time.fixedDeltaTime * 1000);
            outlet = new liblsl.StreamOutlet(info);
        }
    void Start()
    {
        // create stream info and outlet
        info = new liblsl.StreamInfo("BillboardMarker", "Marker", 1, 0, liblsl.channel_format_t.cf_float32, "MarkerID");
        // chns = info.desc().append_child("channels");

        outlet = new liblsl.StreamOutlet(info);

        marker[0] = 5.0f;
    }
 static Smooth()
 {
     mrms         = new float[2];
     output       = new float[2];
     count        = 0;
     mrms_go      = true;
     weight       = 1;
     forgetfactor = (float)0.9975;
     liblsl.StreamInfo info = new liblsl.StreamInfo("EVA System", "Smooth EMG", output.Length, EMG_Socket.frequency, liblsl.channel_format_t.cf_float32);
     m_LSLOutlet = new liblsl.StreamOutlet(info);
 }
        void Start()
        {
            // initialize the array once
            currentSample = new float[ChannelCount];

            dataRate = LSLUtils.GetSamplingRateFor(sampling);

            streamInfo = new liblsl.StreamInfo(StreamName, StreamType, ChannelCount, dataRate, liblsl.channel_format_t.cf_float32, unique_source_id);

            outlet = new liblsl.StreamOutlet(streamInfo);
        }
        private void LinkLabStreamingLayer()
        {
            if (lslOutlet == null)
            {
                sampling_rate = (int)SamplingRateListBox.SelectedItem;

                // This is How I Link the Output Stream!
                lslStreamInfo = new liblsl.StreamInfo(lslStreamName + "-" + idTextBox.Text, lslStreamType, lslChannelCount, sampling_rate, lslChannelFormat, guid + "-" + idTextBox.Text);
                lslOutlet     = new liblsl.StreamOutlet(lslStreamInfo);

                infoOutputBox.Text += "\nLinked to Lab Streaming Layer\nReady to Stream at " + sampling_rate + " Hz\n" + lslChannelCount + " Channels are Open";
            }
        }
Exemple #25
0
        // Use this for initialization
        void Start()
        {
            watch = new Stopwatch();

            watch.Start();

            currentSample = new float[ChannelCount];

            streamInfo = new liblsl.StreamInfo(StreamName, StreamType, ChannelCount, dataRate,
                                               liblsl.channel_format_t.cf_float32, unique_source_id);

            outlet = new liblsl.StreamOutlet(streamInfo);
        }
 static Validator()
 {
     ext_Max   = new float[2];
     flex_Max  = new float[2];
     rest_Avg  = new float[2];
     flex_MVIC = new float[2];
     ext_MVIC  = new float[2];
     max       = new float[2];
     data      = new float[8];
     valid     = new AutoResetEvent(false);
     liblsl.StreamInfo info = new liblsl.StreamInfo("EVA System", "Data", 8, 2000, liblsl.channel_format_t.cf_float32);
     m_LSLOutlet = new liblsl.StreamOutlet(info);
 }
Exemple #27
0
        // Start is called before the first frame update
        void Start()
        {
            id    = SystemInfo.deviceUniqueIdentifier;
            sinfo = new liblsl.StreamInfo("StreamEye", "eye_data", channels, 0,
                                          liblsl.channel_format_t.cf_float32, "eye_" + id);
            soutlet = new liblsl.StreamOutlet(sinfo);

            if (!SRanipal_Eye_Framework.Instance.EnableEye)
            {
                enabled = false;
                return;
            }
        }
        void Start()
        {
            sample = new string[lslChannelCount];

            lslStreamInfo = new liblsl.StreamInfo(
                lslStreamName,
                lslStreamType,
                lslChannelCount,
                nominal_srate,
                lslChannelFormat,
                unique_source_id);

            lslOutlet = new liblsl.StreamOutlet(lslStreamInfo);
        }
Exemple #29
0
        private void startLSLOutputStream()
        {
            if (lslOutlet == null)
            {
                // This is How I Link the Output Stream!
                sample = new string[lslChannelCount]; // Initialize Sample to the number of available Channels

                lslStreamInfo = new liblsl.StreamInfo(lslStreamName, lslStreamType, lslChannelCount, nominal_srate, lslChannelFormat, guid);
                lslOutlet     = new liblsl.StreamOutlet(lslStreamInfo);


                OutputButton.Content = "Output is Linked";
            }
        }
Exemple #30
0
        public void SendKinectStream(String limb, Int32 channels)
        {
            kinectLimb = limb;
            liblsl.StreamInfo KINECTinfo = new liblsl.StreamInfo("KINECT" + "_raw", "KINECTpos_raw", channels, 24, liblsl.channel_format_t.cf_float32, "Microsoft");
            KINECToutlet = new liblsl.StreamOutlet(KINECTinfo);
            streaming    = true;
            Thread thisThread = new Thread(ReadKinect)
            {
                IsBackground = true,
                Name         = "threadKinect"
            };

            thisThread.Start();
        }