A robot arm used in an automated factory consists of N connected links: link1 which is connected to link2, ..., and linkN-1 which is connected to linkN. Each link is a straight rod of a specified length, len1, len2, ..., lenN. Between each pair of connected links is a servo, servo2 (between link1 and link2), ..., and servoN (between linkN-1 and linkN) that can be activated to adjust the angle between the connected links. Link1 is also connected by a servo, servo1, to the factory floor (at the point x=0, y=0, z=0 in a Cartesian coordinate system). At the free (unconnected) end of the last link (linkN) is a "hand" that can be used to grasp objects.
In the initial setting of the robot arm, each servo is set to no rotation (0 degrees), and the links in the robot arm coincide with the z-axis. The xy plane is horizontal (the factory floor), and the entire robot arm is initially pointing up, vertically. From this initial setting, each servo can effect a rotation of up to 90 degrees in either of two directions. Servo1 moves the entire robot arm in the xz plane by rotation about the y-axis. Servo2 moves the arm (except link1) in the (perhaps rotated) yz plane by rotation about the x-axis. In a similar manner, each odd-numbered servo can rotate the remaining part of the arm in the (perhaps rotated) xz plane, and each even-numbered servo can rotate the remaining part of the arm in the (perhaps rotated) yz plane. In effect, the servos rotate the links about the y and x-axes of coordinate systems fixed to the end of each link. Counterclockwise rotations about a coordinate axis are produced with positive rotation angles, if we are looking along the positive half of the axis toward the coordinate origin. The sample data has been carefully chosen to illustrate the effects of these rotations.
There are two restrictions on the final positioning of the robot's arm. No part of the arm can be below the factory floor, and the links in the robot's arm cannot intersect with each other (except where they are connected by the servos).
You should check only the final position of the arm.
Given the number of links in a robot's arm, their lengths, and the proposed settings of the servos, first determine if the proposed positioning of the arm is allowable. If the arm can be positioned as proposed, then determine the coordinates of the robot's hand, accurate to three fractional digits. Otherwise identify the first (smallest numbered) servo that has an inappropriate setting, and why that setting is inappropriate. Links are assumed to intersect if they come within 0.001 length units of each other.