forked from esd2-groupwork/world-server
34 lines
No EOL
838 B
Matlab
34 lines
No EOL
838 B
Matlab
%Tennis ball moving
|
|
|
|
clc;
|
|
clear all;
|
|
close all;
|
|
|
|
%Include source files in path
|
|
addpath(genpath('../src'))
|
|
|
|
%Initialization Parameters
|
|
server_ip = '127.0.0.1'; %IP address of the Unity Server
|
|
server_port = 55001; %Server Port of the Unity Sever
|
|
|
|
client = tcpclient(server_ip,server_port);
|
|
fprintf(1,"Connected to server\n");
|
|
|
|
%Rotation Code
|
|
yawRotation = [-10:10];
|
|
pose = [0,10,-6,90,1,170];%[0,12,0,90,90,0][12,3,0,180,90,180][0,10,3,90,90,0]%; %
|
|
for i = 1:length(yawRotation)
|
|
% x,y,z,yaw[z],pitch[y],roll[x]
|
|
pose(3) = yawRotation(i);
|
|
unityImage = unityLink(client,pose);
|
|
|
|
FigH = figure;
|
|
imshow(unityImage);
|
|
name = 'tennisBall'+string(i)+'.png';
|
|
saveas(FigH,append(name));
|
|
imshow(unityImage);
|
|
|
|
end
|
|
|
|
%Close Gracefully
|
|
fprintf(1,"Disconnected from server\n"); |