User Tools

Site Tools


biac:experimentalcontrol:eyetrackpresentation

Controlling the Viewpoint eyetracker software from Presentation

To use the eyetracker with Presentation you must run Presentation on Mach (normally attached to the left monitor) and the Viewpoint program on Donders (normally attached to the right monitor). The two machines are connected to each other via a serial cable. This allows Presentation to be used to send commands to the Viewpoint computer.

To configure Presentation to be able to send codes, you will need to first configure the serial port to send port output.

:biac:experimentalcontrol:layout:goggles_3.gif

Click on the ‘Settings’ tab, and again on the ‘Port’ icon on the left. Under the box containing ‘Port Output’ add a serial port, and configure it with the settings shown (except for COM2 being changed to COM3 as of Summer '08) (COM3, 57600 kbs, none, 8, and 1). These settings are the default settings for the Viewpoint eye-tracking software. You will probably want to resave your experiment at this point so these settings are saved for the next subject you run.

From within Viewpoint, click on ‘Interface’ → ‘Serial Port’ → ‘Connect’. A window will pop up that will display the commands issued over the port as they are received.

Now that both Presentation and Viewpoint are configured to use the serial port, you will need to insert PCL code into your scenario. Some examples of PCL code are below that initialize the serial port and send commands and codes. The Viewpoint commands that are available are listed in the ‘CLP’ section of the manual and cover almost every aspect of the Viewpoint software.

Presentation code

# sends a CLP command to Viewpoint over the serial port
sub 
	int send_command(output_port sport, string command)
begin
	# put in characters V P and 11, indicating this to be a command
	# packet
	string VP_packet = "VP\x0B ";
	VP_packet.set_char(4, command.count()+1);
	VP_packet.append(command);
	sport.send_string(VP_packet);
	sport.send_code(0);
	return 0;
end;


# sends a string that will be timestamped and inserted into the 
# eye-tracking file to Viewpoint over the serial port
sub 
	int send_marker(output_port sport, string marker)
begin
# put in characters V P and 12, indicating this to be a 
# string_insert packet
	string VP_packet = "VP\x0C ";
	VP_packet.set_char(4, marker.count()+1);
	VP_packet.append(marker);
	sport.send_string(VP_packet);
	sport.send_code(0);
	return 0;
end;


# get a port-- this should be configured in the GUI to be a serial port.
if (output_port_manager.port_count() == 0) then
   term.print( "Forgot to add an output port!" )
end;
output_port sport = output_port_manager.get_port( 1 );

# samples of how to issue a command

# pause the eyetracker
send_command(sport, "dataFile_Pause");

# resume the eyetracker
send_command(sport, "dataFile_Resume");

# start the datafile collection (we couldn’t get this one to work)
send_command(sport, "dataFile_NewName \"N:\\FrStream.02\\test.txt\" ");

# reset the video
send_command(sport, "video_Reset");

# send a marker
send_marker(sport, “Trialtype 1”);

Go back to EyeTracker Page

biac/experimentalcontrol/eyetrackpresentation.txt · Last modified: 2023/02/23 18:43 (external edit)