This chapter contains functions you can use for the communication from the control computer to the experimental computer. This comprises the transmission of commands or a whole experimental script. More detailed guidelines for the implementation of this communication you can find in chapter 2.2. Coding device interfaces.
This chapter contains functions you can use for the communication from the control computer to the experimental computer. This comprises the transmission of commands or a whole experimental script. More detailed guidelines for the implementation of this communication you can find in [chapter 2.2. Coding device interfaces](/How-tos#using-a-raspberry-pi-as-local).
[[_TOC_]]
## connect2Host
function: num = connect2Host(singleHosts)
function: num = [connect2Host(singleHosts)](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Network/ControlComputer/connect2Host.m)
**Description**
This is the main function that handles the communication to the experimental computer. Make sure that all IP addresses are entered correctly in myHardwareSetup.m.
This is the main function that handles the communication to the experimental computer. Make sure that all IP addresses are entered correctly in [myHardwareSetup.m](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/myHardwareSetup.m).
Expert mode: This function is able to connect to single hosts that are not mentioned in myHardwareSetup.m. The optional argument is a cell that contains the IP addresses e.g. {'192.168.0.50', '192.168.0.51'}.
Expert mode: This function is able to connect to single hosts that are not mentioned in [myHardwareSetup.m](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/myHardwareSetup.m). The optional argument is a cell that contains the IP addresses e.g. {'192.168.0.50', '192.168.0.51'}.
All experimental files have to be present in the directory "RemoteExperiment" on the remote experimental computer!
...
...
@@ -25,10 +25,10 @@ All experimental files have to be present in the directory "RemoteExperiment" on
This function copies a complete experiment to a remote host on the network! The remote host (e.g. a Raspberry Pi3) has to be accessible via a windows share that is named "OTBRToolboxShare". The experimental files are copied to a folder "Experiment" within the share. Please make sure the folder exists on the remote computer.
This function copies a complete experiment to a remote host on the network! The remote host (e.g. a [Raspberry Pi3](/How-tos#using-a-raspberry-pi-as-local-or-remote-computer)) has to be accessible via a windows share that is named "OTBRToolboxShare". The experimental files are copied to a folder "Experiment" within the share. Please make sure the folder exists on the remote computer.
Before the local files are copied to the remote host all files on the share on the remote host will be deleted! Folders however will be kept since they may contain result files. Make sure to delete folders manually if not needed.
...
...
@@ -50,15 +50,15 @@ Running experiments on a remote machine requires some essential files and folder
Use this function to assemble commands as strings. Output from this function can be used as command input in the sendCommand2Host function.
Use this function to assemble commands as strings. Output from this function can be used as command input in the [sendCommand2Host](/Network-control-computer#sendcommand2host) function.
**Inputs**
~~~
...
...
@@ -70,29 +70,29 @@ Use this function to assemble commands as strings. Output from this function can
This function sends commands to the remote computer that will be executed. Make sure that the paradigm files exist on the remote computer before calling the files. Use sendExperiment2Host for this.
This function sends commands to the remote computer that will be executed. Make sure that the paradigm files exist on the remote computer before calling the files. Use [sendExperiment2Host](/Network-control-computer#sendexperiment2host) for this.
By default the function does not wait for feedback from the host. Call wait4Feedback as third argument for this option.
This function enables you to execute any command you like on the remote host. Functions that not need to be called with sendCommand2Host are included in this chapter.
This function enables you to execute any command you like on the remote host. Functions that not need to be called with [sendCommand2Host](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Network/ControlComputer/sendCommand2Host.m) are included in this chapter.
**Inputs**
~~~
hostHandle ID for the remote computer, corresponds to the given number in
myHardwareSetup (e.g. send command to the second defined
raspberry: enter ‘2’), you can also use the output from connect2Host
raspberry: enter '2'), you can also use the output from connect2Host
command command you want to execute on the remote computer (can be
any command from matlab or the toolbox), needs to be written
...
...
@@ -108,36 +108,36 @@ This function enables you to execute any command you like on the remote host. Fu
## getKeyBufferResult
function: out = getKeyBufferResult(hostHandle, varName)
function: out = [getKeyBufferResult(hostHandle, varName)](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Network/ControlComputer/getKeyBufferResult.m)
**Description**
Use this function to get the results of a keyBuffer call on a remote system. This function expects the variable name of the keyBuffer results as argument. The variables have to exist on the remote computer!
Use this function to get the results of a [keyBuffer](/User-or-animal-response#keybuffer-animal) call on a remote system. This function expects the variable name of the [keyBuffer](/User-or-animal-response#keybuffer-animal) results as argument. The variables have to exist on the remote computer!
**Inputs**
~~~
hostHandle ID for the remote computer, corresponds to the given number in
myHardwareSetup (e.g. send command to the second defined
raspberry: enter ‘2’)
varName variable name of the keyBuffer results (e.g. ‘result’ or ‘out’)
raspberry: enter '2')
varName variable name of the keyBuffer results (e.g. 'result' or 'out')
~~~
## stopRemoteKeyBuffer
function: out = stopRemoteKeyBuffer(h)
function: out = [stopRemoteKeyBuffer(h)](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Network/ControlComputer/stopRemoteKeyBuffer.m)
**Description**
Use this function to stop the execution of keyBuffer on a remote computer. A valid network connection is required!
Use this function to stop the execution of [keyBuffer](/User-or-animal-response#keybuffer-animal) on a remote computer. A valid network connection is required!
**Inputs**
~~~
h ID for the remote computer, corresponds to the given number in
myHardwareSetup (e.g. send command to the second defined
raspberry: enter ‘2’)
raspberry: enter '2')
~~~
## wait4NetworkResponse
function: out = wait4NetworkResponse(time2wait)
function: out = [wait4NetworkResponse(time2wait)](https://gitlab.ruhr-uni-bochum.de/ikn/OTBR/-/blob/master/Network/ControlComputer/wait4NetworkResponse.m)
**Description**
This function needs one input argument and a valid network connection to at least one remote client.
...
...
@@ -158,7 +158,7 @@ This function needs one input argument and a valid network connection to at leas
This is a helper function that reboots the Raspberry without a valid connection in MATLAB or Octave. This function calls plink.exe an external program from the PuTTY MSI installer distribution.
See http://www.chiark.greenend.org.uk/~sgtatham/putty/ for more details!
...
...
@@ -199,5 +202,5 @@ In most cases you will use disconnect from host instead.
~~~
host ID for the remote computer, corresponds to the given number in
myHardwareSetup (e.g. send command to the second defined