- #1
jimesh
- 1
- 0
Homework Statement
I have a task to move a camera attached to a robot arm along the surface of a sphere. The requirments are,
* Z axis of the camera coordinate system should always point to the origin of the sphere.
* X-Y plane of the camera coordinate system shold be always in the curvilinear direction... (this is because the camera sholuld not rotate its XY plane since the robot will reach singlaritty position at some point..)
The final result should be the rotation angles of the new coordinate system with respect to a world coordinate system at the origin of the sphere.
Homework Equations
Spherical coordinates (r,theta,phi)
x = r * Cos(theta) * Sin(theta);
y = r * Sin(theta) * Sin(phi);
z = r * Math.Cos(phi));
Solving for spherical coordinate we get points P1(x,y,z), P2(x,y,z), P3(x,y,z) etc.. on the sphere. These are the points where the origin of camera coordinate system should be.
The Attempt at a Solution
1. A world coordinate system at the origin of sphere
2. Create another coordinate system at P1, P2 etc which are identical to world coordinate sysem.
3. Calculate the vector from the origin of P1 to origin of world cordinate system (sphere origin)
4. Calculate a vector along the Z axis of the coordinate system at the point P1, say (0,0,1)
5. Find a rotation quaternion by clculating the normal to this 2 vectors and angle between these 2 vectors.
As a result I got the coordinate system at P1 rotates in such a way that Z axis is pointing to the origin of world coordinate system.
But now the problem is
* The camera (X-Y Plane) will also rotate when I move to next point P2 and do the same calculation using quaternion.
* I want to rotate this plane to a coherent direction (say curvilinear direction) at all points.
I tried to find a reference vector for this to rotate.. but couldn't..
any body has any idea.. ?