Hi!

I am trying to get perl to figure out where in the sky certain objects (Planets, spaceship, maybe stars) are, so i can point a servo-controlled laser pointer there.

I am completely ignorant of the finer things of astronomy, my problem might be that i simply didnt 'grok' some very basic issues.

Anyhow: I figure i need the Azimuth and Elevation of the object I want to point at, for my current location (San Jose, Costa Rica). There seems to be another more 'professional' coordinate system for these kind of things that gives me the position in Radians and Declination, which I dont quite understand, but AFAICT dont really need, because I want to point my laser using stuff like "point to 234 degrees North, and 45 degrees over the horizon".

My basic test code is the following:
use Astro::Coords; use Astro::Telescope; use Time::Piece; my $time = new Time::Piece; # adjust for time zone?? # $time += 6*3600; $c = new Astro::Coords( planet => 'mars' ); # 9.956318, -83.995503, 1480m $c->telescope( new Astro::Telescope( Name => 'MvS', Long => -83.995503 +, Lat => 9.956318, Alt => 1480 )); $c->datetime( $time ); $az = $c->az( format => 'd' ); $el = $c->el( format => 'd' ); $ra = $c->ra( format => 'd' ); $dec = $c->dec( format => 'd' ); print "az: $az\nel: $el\n\nra: $ra\ndec: $dec\n";
Which, at this very moment spits out:
C:\Users\schweini\Dropbox\hacks>perl laserTelescope.pl az: 64.4509897905136 el: 2.92864468337563 ra: 251.654925187611 dec: -23.3814670583575
Which, checking against Google Sky Map on my android phone, is completely off. (Mars seems to be quite high in the sky right now, here where I am located).

If I look it up using NASA's 'Horizon' webservice, I get:

********************************************************************** +********************************************************************* +******************************************************* Date__(UT)__HR:MN R.A._(J2000.0)_DEC. X_(sat-primary)_Y SatPANG +APmag S-brt Ob-lon Ob-lat delta deldot 1-way_LT + S-O-T /r S-T-O PsAng PsAMV N.Pole-RA N.Pole-DC ********************************************************************** +********************************************************************* +******************************************************* $$SOE 2012-Oct-25 00:00 Nm 251.06257 -23.30814 145863.8 -40206.8 111.721 + 1.24 4.23 170.57 5.54 2.03255620848271 6.3552294 16.904255 4 +0.8647 /T 26.9310 n.a. n.a. 317.66783 52.87870 2012-Oct-25 01:00 m 251.09522 -23.31220 145830.0 -40170.2 111.714 + 1.24 4.23 185.16 5.53 2.03270971936605 6.3981098 16.905531 4 +0.8533 /T 26.9252 n.a. n.a. 317.66783 52.87870 2012-Oct-25 02:00 m 251.12797 -23.31625 145795.9 -40133.5 111.706 + 1.24 4.23 199.75 5.51 2.03286393613495 6.4135372 16.906814 4 +0.8419 /T 26.9193 n.a. n.a. 317.66783 52.87870 2012-Oct-25 03:00 m 251.16081 -23.32029 145761.6 -40096.7 111.698 + 1.24 4.23 214.35 5.50 2.03301818013345 6.4003399 16.908097 4 +0.8304 /T 26.9134 n.a. n.a. 317.66783 52.87870 2012-Oct-25 04:00 m 251.19373 -23.32433 145727.3 -40059.8 111.691 + 1.24 4.23 228.94 5.49 2.03317176798120 6.3592992 16.909374 4 +0.8189 /T 26.9074 n.a. n.a. 317.66783 52.87870 2012-Oct-25 05:00 m 251.22674 -23.32838 145693.0 -40022.9 111.683 + 1.24 4.23 243.53 5.47 2.03332405819567 6.2930959 16.910641 4 +0.8074 /T 26.9013 n.a. n.a. 317.66783 52.87870 2012-Oct-25 06:00 m 251.25982 -23.33244 145658.8 -39985.9 111.675 + 1.24 4.22 258.12 5.46 2.03347449495092 6.2061269 16.911892 4 +0.7959 /T 26.8951 n.a. n.a. 317.66783 52.87870 2012-Oct-25 07:00 m 251.29295 -23.33653 145624.9 -39948.8 111.667 + 1.24 4.22 272.72 5.45 2.03362264598894 6.1042058 16.913124 4 +0.7845 /T 26.8889 n.a. n.a. 317.66783 52.87870 2012-Oct-25 08:00 m 251.32610 -23.34064 145591.3 -39911.8 111.660 + 1.24 4.22 287.31 5.43 2.03376823209864 5.9941654 16.914335 4 +0.7731 /T 26.8827 n.a. n.a. 317.66783 52.87870 2012-Oct-25 09:00 251.35927 -23.34478 145558.1 -39874.7 111.652 + 1.24 4.23 301.90 5.42 2.03391114615311 5.8833922 16.915523 4 +0.7619 /T 26.8764 n.a. n.a. 317.66783 52.87870 2012-Oct-25 10:00 251.39241 -23.34894 145525.2 -39837.7 111.644 + 1.24 4.23 316.49 5.40 2.03405146040802 5.7793223 16.916690 4 +0.7508 /T 26.8702 n.a. n.a. 317.66783 52.87870 2012-Oct-25 11:00 N 251.42552 -23.35312 145492.8 -39800.7 111.636 + 1.24 4.23 331.09 5.39 2.03418942156454 5.6889341 16.917838 4 +0.7397 /T 26.8640 n.a. n.a. 317.66783 52.87870 2012-Oct-25 12:00 * 251.45857 -23.35732 145460.8 -39763.8 111.628 + 1.24 4.23 345.68 5.38 2.03432543393411 5.6182727 16.918969 4 +0.7288 /T 26.8578 n.a. n.a. 317.66783 52.87870 2012-Oct-25 13:00 * 251.49155 -23.36153 145429.1 -39727.0 111.620 + 1.24 4.23 0.27 5.36 2.03446003185360 5.5720371 16.920088 4 +0.7180 /T 26.8517 n.a. n.a. 317.66783 52.87870 2012-Oct-25 14:00 * 251.52445 -23.36574 145397.6 -39690.3 111.612 + 1.24 4.23 14.86 5.35 2.03459384323222 5.5532601 16.921201 4 +0.7073 /T 26.8457 n.a. n.a. 317.66783 52.87870 2012-Oct-25 15:00 * 251.55727 -23.36994 145366.3 -39653.7 111.605 + 1.24 4.23 29.46 5.34 2.03472754671638 5.5631014 16.922313 4 +0.6966 /T 26.8397 n.a. n.a. 317.66783 52.87869 2012-Oct-25 16:00 * 251.59001 -23.37414 145335.1 -39617.1 111.597 + 1.24 4.23 44.05 5.32 2.03486182539373 5.6007684 16.923430 4 +0.6859 /T 26.8339 n.a. n.a. 317.66783 52.87869 2012-Oct-25 17:00 * 251.62267 -23.37831 145303.8 -39580.6 111.589 + 1.24 4.22 58.64 5.31 2.03499732019437 5.6635701 16.924557 4 +0.6752 /T 26.8281 n.a. n.a. 317.66783 52.87869 2012-Oct-25 18:00 * 251.65527 -23.38245 145272.4 -39544.2 111.581 + 1.24 4.22 73.23 5.30 2.03513458616844 5.7471012 16.925698 4 +0.6645 /T 26.8223 n.a. n.a. 317.66783 52.87869 2012-Oct-25 19:00 * 251.68784 -23.38655 145240.7 -39507.7 111.573 + 1.24 4.22 87.83 5.28 2.03527405462362 5.8455422 16.926858 4 +0.6537 /T 26.8166 n.a. n.a. 317.66783 52.87869

So, the results perl give me correspond to 18:00 UTC time (I am 6 timezones away from UTC), even though I am telling Astro::Coords where exactly I am located, so I figure that it should tell me where Mars is RIGHT NOW. (My locale seems to be set up correctly, too - so i would hope Time::Piece takes that into account?).

If i SUBTRACT(!??!) 6 hours (6*3600) of my Time::Piece, i get a location info for Mars that seems to roughly correspond to what Google Sky Map is telling me - but then Neptune is way off, so that crude correction-measure doesnt work. Adding 6 hours seems even worse.

Long story short: what am i doing wrong? How can i somehow look up the Azimuth and Elevation of celestial objects at my current position and time?

I was also thinking about hooking myself into that Horizons webservice and somehow (how??) convert those esoteric RaDec coordinates to simple earth-based AzEl coordinates, but i dont know how.

Thanks for any help,

M.

In reply to Locationg celestial objects (using Astro::Coords, if need be) by schweini

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.