Pages: [1]   Go Down
Author Topic: Trigonometry for motion capture  (Read 1753 times)
0 Members and 1 Guest are viewing this topic.
Overijse, VL
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

For my first project (with my brand new Arduino Uno) I would like to capture the orientation of my head by attaching a mechanical connection from a torso vest to a helmet. This orientation will then be used to control a robot head (or your pointer on your computer screen...).
The mechanical connection consists of 5 joints. Each joint has its (linear continuous rotation) potentiometer for angle measurement. These 5 angle readings define a unique orientation. The robot head I would like to control has 3 axis (pitch, yaw and roll).
So I am trying to find a trigonometric relation between the 5 angles of your mechanical connection and the 3 axis of your mechanical head so that if you move your head the robot will follow your movement. It should give 3 equations that are a function of 5 different angles. You can already see that this requires some serious trigonometry skills. I have tried many things but my 3D thinking skills are overheating!
Does anyone know some software where I can define these 5 angles and click a button or something to know these equations? Or do you have those skills or know someone that can find them? smiley Though question but this would be a huge breakthrough for my project. Maybe I should ask our math professor...

It looks that the Canadarm2 uses the same technique to know the final orientation of the atronaut that is on the end of the arm (wikipedia).

For the moment I have built nothing cause I would like to find these equations first but it looks like I must start with something simpler (3 angles and 2 axis or something like that)...
Logged

Bristol, United Kingdom
Offline Offline
Newbie
*
Karma: 0
Posts: 23
ARGH dwee No!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had a really tough trigonometry problem for a big project of mine this year (Wolfram-Alpha said it was unsolvable - hah!). I don't think there's software out there that's going to help you easily or cheaply. Besides, there's nothing like sitting down with a pen and paper and crunching through some hard maths yourself  smiley-grin

To solve it properly we need to know more about the setup. Could you come up with a diagram showing what the mechanical setup is? If it's a connection from head to back then I don't know why you need a 5 DoF setup for your 3 DoF head...

So try and get a diagram up, or if that's not possible then a more detailed description of the setup. Then we can get to the business of trigonometry...

Cheers
Tom
Logged

Tom

Overijse, VL
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Good to know I'm not alone smiley.
I made a quick 3D model of the connection I want to build (in wood/metal). Below is a link to the picture of the model. Pot 1 to pot 5 represent the axis that is measured with a potentiometer.
Good question why I need 5 DoF's. I tried various concepts but I never came up with a 4 DoF design (or a 3 DoF) that gives you a 3 axis representation that is wearable. Also, it should give a proper direction when you move your head along a axis I don't want to copy/monitor (like moving forward or sideways while looking at the same point in the distance). The more compact it is the better of course.

Note that the design has a slider. Sliding should not affect the orientation of the helmet mount. The concept has a X joint on your back and one X joint behind your head. Both are connected with a slider that can rotate axially (this rotation is monitored with Pot 3 on a fixed but sliding piece). The pots are not represented on the model.
I use a horizontal plane as the reference plane located at the torso mount. I have the X and Y orientation of the slider bar in function of pot 1 and 2 (easy). Then I calculated the orientation (relative to the reference plane) of the pot 4 axis due to pot 3 axial rotation... but this is where I broke down. It is indeed very pleasant to sit down for hours and solve some maths but after my exams it is less pleasant  smiley.

http://users.skynet.be/fb040380/HeadTracker.png

Thanks for your quick response by the way.
« Last Edit: February 06, 2011, 06:40:18 am by Fons1302 » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 74
Posts: 7255
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Very complicated looking system! I don't mean to derail your project design but if you used accelerometer and magnetic field sensors, you can rid all the mechanical moving parts.
Logged


Overijse, VL
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You are correct, it looks over-complicated. I have thought about using accelerometers but in the future I would like to implement mechanical feedback. Also, it has to be pretty precise. Can you have a high precision with accelerometers or with magnetic sensing techniques? They use it to make animation movies so it should be pretty precise. But I really want to go further with the concept I have cause it has been in my head for years and if I can use it for tele-operated  robotics it would be a dream come true smiley. I also believe in its potential lol. Got to ask it to my professors/teachers.

It is something that is mathematical possible so it frustrates me that after many attemps I still can't find it. But now I have a week of vacation so time enough.

Maybe I should start with a 4-sensor and 2-axis setup and then add the 3rd DoF later on (roll is not important for moving your pointer but I would like to use it for robot control...). This would make the calculations easier.
« Last Edit: February 06, 2011, 02:05:14 pm by Fons1302 » Logged

East Coast, USA. (PA)
Offline Offline
Newbie
*
Karma: 7
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You do not need to know the values of pot1 and pot2. Those joints solely allow for movement and can be ignored in the measurement. They can and will have their positions determined by the other 3 Pots. Perhaps that was over defining your system before, and causing some of your math problems?
 
To be completely honest, I feel you will have much better success mounting a 3 axis accelerometer into the helmet (like previously mentioned). It will be likely be cheaper, lighter, and more reliable.

For your mechanical head position measurement system to work fluidly, it will require some fairly expensive pieces of hardware to reduce friction (like linear bearings)

Logged

If architects designed buildings like programmers wrote code, the first woodpecker to come along would be the end of civilization.

Overijse, VL
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't understand why pot 1 and 2 are unnecessary. Using the 3 pots on your head only will give you the direction of the of the slider bar relative to your head no?? I may be over defining the system or not understanding it. Or maybe I should work with distances, like assuming your neck is a perfect ball joint. Then 3 pots should be enough.

Mmmmm accelerometers. I don't know anything about these measuring devices. What kind of data do they produce? Maybe I should try to learn these devices and start with a simpel setup so I get to know them. Also, they will give a signal when you move your body too, if you stand/sit still it would properly.

A 'professional' setup will indeed be pricey. If I make it with wood it will not be as good (like you say, friction...) but it should act like a proof of concept.
Thanks for your advice, I will have to rethink and weight every possibility.
Logged

Overijse, VL
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@ TND,
What was your trigonometry problem you had? How did you solve it? Maybe it can give me some fresh insight.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 44
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You will get friction losses as has been said but they'll be small enough (in comparison) that you'll still give a clear indication of movements and be good enough to prove your idea.

Regarding your trig problem...

The first thing I thought of when I saw your diagram was the 'devils claw' (or 'robocoaster'). See picture here:
http://t0.gstatic.com/images?q=tbn:ANd9GcQDUl9_9wPWX9L4s7hZG4JaLXNLDAONKgEfvHaAT44uKX8oD6AXpw&t=1

I remember in my dynamics class last year we had to solve for the resultant acceleration on one of those things, and it involved some vector maths and a few acceleration component formulas. You basically had to solve acceleration for each degree of freedom and sum them up. But you have to work them out in order! I.e. acceleration on the chair was dependant on the acceleration on the linkage which was dependant on the acceleration on the pivot at the beginning.

Someone may correct me, but it seems as though you have a similar problem here. Taking the potentiometers in the order you've numbered them, I'd go down the route of assuming a coordinate system at 1 and 2 - and for talking's sake, limit their movements to say 90 degrees. You then have their displacement relative to the horizontal and vertical - and values. . .

I was going to say it may be possible to use these values in the following trig equations, solving the angular displacements of all the potentiometers in sequence .. but, looking at it, I think this was probably the reason vector mathematics came about in the first place :-P
Logged

Overijse, VL
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes I have the same problem that you had with knowing the final acceleration of the robocoaster's occupants (but a orientation vector as a result, no acceleration). And it is just that what I want: the base of the robot is attached to your back (placed on your spine between both scapula's thanks to a vest, a stable position) and the chairs of the robocoaster is attached to the back of your head (with a hat/helmet). I will try to use the robocoaster's joint setup and maybe it comes out better to calculate. It looks like it has 4 DoF.
So what you propose is to calculate the displacement relative to the vertical and horizontal at each joint and then sum them up? It seems simple and logic, will have to try it. But the axial rotation makes it difficult because the plane perpendicular on the axis is inclined in both directions. This means that the rotation of the axis results in vertical and horizontal displacement.
My calculations of the last days told me that I have to optimize the design of the linkage, making the problem simpler.
Thanks for the robocoaster example, yet another existing example that uses trigonometry to capture motion/orientation.
« Last Edit: February 07, 2011, 09:34:18 am by Fons1302 » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 44
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I meant you could sum them up so long as the they're in the same orientation.

The more i think about it, the more I think vector maths is the way to go with this one!

I'll try and get a hold of the slides for you to have a look at.
Logged

Overijse, VL
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I see,

I have a concept in mind that should only use 2 pots and would require minimal trigonometry. The linkage construction is a bit more complex (4 slide bars).
By moving the horizontal reference plane to the back of your head with a parallelogram construction with 2 slide bars and using 2 slide bars that slide back and forth on the new horizontal reference plane you can keep the vertical and horizontal reference plane at the back of your head. Then a Y and X axis mount will give you the Y and X angle relative to that moved plane.  When I'll have it figured out I will post a model of it. I hope it works smiley.
Those slides are the fragile part of the story. Thanks a lot for the input!

UPDATE:
Here my latest concept for the 'HeadTracker'. It uses 3 sliders and only 2 pots should define the pitch and yaw of your head. A 3rd would give you the roll too. Now I need less than 6 analog inputs ( 2 for tracking and 2 for action) to make this setup with one Arduino Uno. It looks very complex to make in wood  smiley. Should buy a miller to mill some metal.

http://users.skynet.be/fb040380/headtracker3.png
http://users.skynet.be/fb040380/headtracker3.1.png
« Last Edit: February 07, 2011, 12:29:50 pm by Fons1302 » Logged

Overijse, VL
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It is a different question but for the same project:
I'm trying to make a servo motor with a standard brushed DC motor and a Pololu motor controller. I attach a pot on the motor's axis and I use another pot (but same model) to control the axis' position (so the motor copies the position of the control pot). My question is how I should write the code for the best results?

I have tried the following code (I use the serial monitor to monitor the difference in position). It is not so precise and the motor overshoots the position before getting on the wanted position. The code is simple but maybe someone has an idea to improve accuracy and speed (no overshoot) of the servo. Sensorposition and motorposition are the two pots:

/*
  Motor Position Control
  Control a motor's position with two potentiometers.
  */
void setup()
{
  Serial.begin(9600);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
}
void loop()
{
  int sensorposition = analogRead(0);
  int motorposition = analogRead(1);
  int difference = sensorposition - motorposition;
  Serial.println(difference, DEC);
  if (difference > 0)
  {
    digitalWrite(8, HIGH);
    digitalWrite(9, LOW);
    if (difference > 255)
    { analogWrite(10, 255); }
    else { analogWrite(10, difference); }
  }
  if (difference < 0)  
  {
    digitalWrite(8, LOW);
    digitalWrite(9, HIGH);
    if (abs(difference) < 255)
    { analogWrite(10, abs(difference)); }
    else { analogWrite(10, 255); }
  }
  if (difference == 0)  
  {
    digitalWrite(8, HIGH);
    digitalWrite(9, HIGH);
    analogWrite(10, 0);
  }
}
« Last Edit: February 10, 2011, 11:21:00 am by Fons1302 » Logged

Pages: [1]   Go Up
Jump to: