Kinect Angles Calculation Script: Difference between revisions

From Control Systems Technology Group
Jump to navigation Jump to search
No edit summary
Line 8: Line 8:


As c++ does not provide a standard library for 3 dimensional vectors and vector manipulations, we made our own <code>Vector3</code> class that gives the user access to its coördinates and contains a function that returns the length of the vector. This code is not contained here but can be read in the full code that can be downloaded from [http://cstwiki.wtb.tue.nl/index.php?title=PRE2015_4_Groep1#scripts this wiki page].
As c++ does not provide a standard library for 3 dimensional vectors and vector manipulations, we made our own <code>Vector3</code> class that gives the user access to its coördinates and contains a function that returns the length of the vector. This code is not contained here but can be read in the full code that can be downloaded from [http://cstwiki.wtb.tue.nl/index.php?title=PRE2015_4_Groep1#scripts this wiki page].
Several manipulations on 3 dimensional vectors can be found in the same class that also converts the Kinect input into useable data. These are:
* A function that returns a <code>Vector3</code> that is a difference vector pointing from one <code>CameraSpacePoint</code> to another <code>CameraSpacePoint</code>.
* A function that returns the angle between two vectors, calculated using the vector dot product.
* A function that returns the dot product between two vectors.
* A function that returns the cross product between two vectors.
* A function that returns the projection of a vector onto a plane given by that plane's normal vector.
* A function that projects a vector onto another vector.
* A function that returns a vector with the same direction of the input vector, but with lenght one.
* A function that returns the converse of the input vector, the vector multiplied by -1.

Revision as of 19:16, 20 June 2016

This is a brief explanation of code used to convert Kinect input from the Joints structure into the degrees of freedom of the AMIGO's arms.

This code is part of a project to create a robot technique that allows users to hug someone when separated by a disctance like a phone call.

For a mathmatical explanation of how the degrees of freedom are determined, check this section of the project.

Vectors and Vector Manipulation

As c++ does not provide a standard library for 3 dimensional vectors and vector manipulations, we made our own Vector3 class that gives the user access to its coördinates and contains a function that returns the length of the vector. This code is not contained here but can be read in the full code that can be downloaded from this wiki page.

Several manipulations on 3 dimensional vectors can be found in the same class that also converts the Kinect input into useable data. These are:

  • A function that returns a Vector3 that is a difference vector pointing from one CameraSpacePoint to another CameraSpacePoint.
  • A function that returns the angle between two vectors, calculated using the vector dot product.
  • A function that returns the dot product between two vectors.
  • A function that returns the cross product between two vectors.
  • A function that returns the projection of a vector onto a plane given by that plane's normal vector.
  • A function that projects a vector onto another vector.
  • A function that returns a vector with the same direction of the input vector, but with lenght one.
  • A function that returns the converse of the input vector, the vector multiplied by -1.