Calculate Dec and RA of a star from Euler angles and GPS data I have 9DOF sensor (accelerometer, gyroscope, and magnetometer) that gives orientation via Euler angles (yaw, pitch, roll). Along with GPS data (latitude, longitude, elevation, time) this is passed to a PC application that has to calculate Dec and RA of a target (e.g. star). Sensor and GPS receiver are mounted on a telescope, so it should give the celestial coordinates of a star. The problem is that I don't know how to get Dec and RA from those data. I would very much appreciate a detail explanation of how I could get this.
Obtain from the publisher Willmann-Bell the book ''Astronomical Algorithms'' by Jean Meeus. If obtaining elsewhere, be sure to obtain the 2nd ed. with corrections as of August 10, 2009. The equations you want are in Chapter 13, "Transformations of Coordinates".

Some variables must be defined:

$\alpha$ = right ascension, if obtained from formula it is in radians
$\delta$ = declination, positive north, negative south
$h$ = altitude, positive above the horizon, negative below horizon
$A$ = azimuth, measured westward from the South, other sources often measure from the North
$\psi$ = observer's latitude
$H$ = local hour angle
$\theta$ = local sidereal time

The first step is to transform horizon coordinates (azimuth and altitude) to equatorial coordinates (local hour angle and declination).

$$
\tan H  = \frac{\sin A}{\cos A \sin \psi + \tan h  \cos \psi}\\
\sin \delta  = \sin \psi  \sin h  - \cos \psi  \cos h  \cos A
$$

Then the local hour angle H is transformed to right ascension $\alpha$:

$$
\alpha = \theta - H
$$