function truePos = getTrueTrajectory(sideLength)

% PURPOSE : Generate simulated target trajectory using sideLength, with a 
%           default human speed of 0.5 m/s.
% INPUTS  : - sideLength = side length of a square layout. 
% OUTPUTS : - truePos = simulated target ground-truth trajectory.
% AUTHORS  : Xi Chen and Yunpeng Li
%            @ECE Department, McGill University
%            http://www.tsp.ece.mcgill.ca/Networks/index.html
% DATE     : Jun 29, 2011

    speed = 0.5;  
    dist2Side = ceil(sideLength / 7);
    nodePerSide = floor((sideLength-2*dist2Side)/speed);

    %Generate target positions of each side
    left = zeros(2, nodePerSide);
    left(1,:) = dist2Side;
    left(2,:) = dist2Side:speed:(sideLength-dist2Side-speed);

    upper = zeros(2, nodePerSide);
    upper(1,:) = dist2Side:speed:(sideLength-dist2Side-speed);
    upper(2,:) = sideLength - dist2Side;
    
    right = zeros(2, nodePerSide);
    right(1,:) = sideLength - dist2Side;
    right(2,:) = (sideLength-dist2Side):-speed:(dist2Side+speed);
    
    lower = zeros(2, nodePerSide);
    lower(1,:) = (sideLength-dist2Side):-speed:(dist2Side+speed);
    lower(2,:) = dist2Side;
    
    % Store all the positions to truePos
    truePos = zeros(2, nodePerSide * 4 + 1);
    truePos(:,1:nodePerSide) = left;
    truePos(:,(nodePerSide+1):(2*nodePerSide)) = upper;
    truePos(:,(2*nodePerSide+1):(3*nodePerSide)) = right;
    truePos(:,(3*nodePerSide+1):(4*nodePerSide)) = lower;
    truePos(:,end) = truePos(:,1);
    truePos = repmat(truePos,1,2);
end

