//**************// /** * @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); }
// 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); }
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() { 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!"); }
// 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)); } }
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(); }
// 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); }
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); } }
/// <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(); }
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); }
// 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); }
// 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); }
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); }
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); } }
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); }
protected bool isTheExpected(liblsl.StreamInfo stream) { // Checks for name, type and Unique ID? bool predicate = StreamName.Equals(stream.name()); predicate &= StreamType.Equals(stream.type()); predicate &= UniqueID.Equals(stream.source_id()); return(predicate); }
/// <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); }
/// <summary> /// Callback method for the Resolver gets called each time the resolver misses a stream within its cache /// </summary> /// <param name="stream"></param> public virtual void AStreamGotLost(liblsl.StreamInfo stream) { if (!isTheExpected(stream)) { return; } Debug.Log(string.Format("LSL Stream {0} Lost for {1}", stream.name(), name)); OnStreamLost(); }
/// <summary> /// Setup LSL outlet for the board /// </summary> void SetupLslOutletForBoard() { var numChannels = BrainhatBoardShim.GetNumberOfExgChannels(BoardId); var numAccelChannels = BrainhatBoardShim.GetNumberOfAccelChannels(BoardId); var numOtherChannels = BrainhatBoardShim.GetNumberOfOtherChannels(BoardId); var numAnalogChannels = BrainhatBoardShim.GetNumberOfAnalogChannels(BoardId); SampleSize = 2 + numChannels + numAccelChannels + numOtherChannels + numAnalogChannels; StreamInfo = new liblsl.StreamInfo(BoardId.GetSampleName(), "BFSample", SampleSize, SampleRate, liblsl.channel_format_t.cf_double64, BrainHatNetwork.NetworkUtilities.GetHostName()); StreamInfo.desc().append_child_value("manufacturer", "OpenBCI"); StreamInfo.desc().append_child_value("boardId", $"{BoardId}"); liblsl.XMLElement chns = StreamInfo.desc().append_child("channels"); chns.append_child("channel") .append_child_value("label", "SampleIndex") .append_child_value("unit", "0-255") .append_child_value("type", "index"); for (int k = 0; k < numChannels; k++) { chns.append_child("channel") .append_child_value("label", $"ExgCh{k}") .append_child_value("unit", "uV") .append_child_value("type", "EEG"); } for (int k = 0; k < numAccelChannels; k++) { chns.append_child("channel") .append_child_value("label", $"AcelCh{k}") .append_child_value("unit", "1.0") .append_child_value("type", "Accelerometer"); } for (int k = 0; k < numOtherChannels; k++) { chns.append_child("channel") .append_child_value("label", $"Other{k}"); } for (int k = 0; k < numAnalogChannels; k++) { chns.append_child("channel") .append_child_value("label", $"AngCh{k}"); } chns.append_child("channel") .append_child_value("label", "TimeStamp") .append_child_value("unit", "s"); }
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"; } }
// 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); }
public LSLStreamInfoWrapper(liblsl.StreamInfo item) { this.item = item; Name = item.name(); Type = item.type(); channelCount = item.channel_count(); streamUID = item.uid(); sessionId = item.session_id(); sourceID = item.source_id(); dataRate = item.nominal_srate(); hostName = item.hostname(); streamVersion = item.version(); }
// 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; } }