Author Topic: How can i put "gravity" to (Lat, Long to X, Y, Z) ?  (Read 1110 times)

0 Members and 1 Guest are viewing this topic.

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
How can i put "gravity" to (Lat, Long to X, Y, Z) ?
« on: April 18, 2019, 08:10:53 am »

Hello, EEVBlog users !
Always thank you for your kind help and time.

I want make acceleration data through convert (Lat, Long to X, Y, Z).

but, i can't figure out how i can put "gravity" to X, Y, Z equations
to make acceleration data.

if latitude and longitude is,

Lat = [-30:2:30];
Long = [-90:1:90];

i can make latitude and longitude as follows,

lat   = lat * pi/180;
long = long * pi/180;
phi = pi/2 - lat;
theta = long;

than, XYZ is

x = sin(phi) * cos(theta);
y = sin(phi) * sin(theta);
z = cos(phi);

Can I add g like this?

g = [ 0 0 9.8 ];

Acc_x = -g * sin(phi) * cos(theta);
Acc_y = g * sin(phi) * sin(theta);
Acc_z = -g * cos(phi);

I am so sorry, my question is so vague.
If you don't mind, could you give to me advise ?

Thanks you for reading, !
Please, let me know !
 

Offline agehall

  • Frequent Contributor
  • **
  • Posts: 390
  • Country: se
Re: How can i put "gravity" to (Lat, Long to X, Y, Z) ?
« Reply #1 on: April 18, 2019, 08:20:13 am »
If you just want a vector that represents the direction of g at every point of the sphere, that would essentially be the negative normal at each point.

So just use g=-9.81 (note: not a vector!) and then calculate the vector at each point by doing g * [x y z] where x, y and z are calculated as you suggested and you should end up with a vector that describes g as a directional vector at each point [x y z].
 
The following users thanked this post: ammjy

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: How can i put "gravity" to (Lat, Long to X, Y, Z) ?
« Reply #2 on: April 18, 2019, 08:27:22 am »
Thanks you so much, also Thanks you for your time, Ms. Agehall.

I understood your kind answer.

Have a good day !


Acc_x = -g * sin(phi) * cos(theta);
Acc_y = -g * sin(phi) * sin(theta);
Acc_z = -g * cos(phi);

 

Offline soldar

  • Super Contributor
  • ***
  • Posts: 3595
  • Country: es
Re: How can i put "gravity" to (Lat, Long to X, Y, Z) ?
« Reply #3 on: April 18, 2019, 10:33:38 am »
If you just want a vector that represents the direction of g at every point of the sphere, that would essentially be the negative normal at each point.

So just use g=-9.81 (note: not a vector!) and then calculate the vector at each point by doing g * [x y z] where x, y and z are calculated as you suggested and you should end up with a vector that describes g as a directional vector at each point [x y z].

That is a simplification that might be sufficient or not depending on what the objective is. It assumes the world is a sphere and with uniform acceleration of gravity. 

For more precise calculations search for "convert wgs84 to polar"

https://www.pgc.umn.edu/apps/convert/
All my posts are made with 100% recycled electrons and bare traces of grey matter.
 
The following users thanked this post: ammjy

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: How can i put "gravity" to (Lat, Long to X, Y, Z) ?
« Reply #4 on: April 18, 2019, 11:21:54 am »

Thanks you for your time, and your kind attention !

i understood very well your point :)

i totally agree.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf