Skip to content
Sora2455 edited this page May 23, 2015 · 2 revisions

Modeler () [sp]

The initialisation function. In the final product this will be passed the calibration values, but for now it is simply called before the modeller is used. Eg. Modeler modeller = new Modeler ();

advanceIteration(double leftPitch, double leftRoll, double leftYaw, double rightPitch, double rightRoll, double rightYaw)

This is the function that feeds the modeller its information. Six numbers total (twelve if we can get enough sensors for the forearms) are fed to the function. These numbers represent the pitch, roll and yaw for the left and right upper arm. This function is designed to be called every time the sensor receives more data, which with the current set-up is four times every second.

hasUnreadSample()

Returns a boolean depending on if all stored arm positions have been retrieved with getNextSample()

getNextSample()

Returns the next BothArms object that has yet to be returned by this function, in order of first calculated to last calculated.

getMostRecentLeftArm()

This function, along with getMostRecentRightArm(), retrieves the most recently calculated left Arm object. It is identical to calling getPastLeftArm(0).

getPastLeftArm(int iterationsAgo)

This function, along with getPastRightArm(), retrieves an Arm object previously calculated. Passing Zero to this function gets the most recently calculated Arm; passing a number lower than zero or higher than the iterations calculated so far returns the first Arm object calculated.

Iterator()

This code comes with an iterator for the collection of BothArms objects.

BothArms

This object is a simple container for two Arm objects, one left and one right. Those objects can be retrieved with the getLeftArm() and getRightArm() functions.

Arm

This is effectively another container class, containing two PointInSpace objects for the elbow and wrist (the shoulder is assumed to not move). The PointInSpace objects are retrieved with elbowPos() and wristPos(). One other function, isLeftArm(), returns a Boolean that is true if the Arm represents a left arm, and false if it represents a right arm.

PointInSpace

A simple object that represents three spacial coordinates: X representing forwards (positive) or backwards (negative); Y representing above (positive) or below (negative); and Z represents to the right (positive) or left (negative). These coordinates