added better direction calculation for the special cases that the x or y
values are already the same as the target position
fixed bug in PositionManager: sin and cos had to be swapped in
calculation of new pose