UI upgrades
This commit is contained in:
parent
770e178513
commit
9ecee93b43
27 changed files with 1168 additions and 468 deletions
|
|
@ -20,7 +20,7 @@ Sam Neurohack
|
|||
|
||||
import math
|
||||
import redis
|
||||
from OSC import OSCServer, OSCClient, OSCMessage
|
||||
#from OSC import OSCServer, OSCClient, OSCMessage
|
||||
|
||||
redisIP = '127.0.0.1'
|
||||
r = redis.StrictRedis(host=redisIP, port=6379, db=0)
|
||||
|
|
@ -39,6 +39,7 @@ oscmsg = OSCMessage()
|
|||
osclientlj.connect((redisIP, 8002))
|
||||
'''
|
||||
|
||||
'''
|
||||
def Send(oscaddress,oscargs=''):
|
||||
|
||||
oscmsg = OSCMessage()
|
||||
|
|
@ -53,7 +54,7 @@ def Send(oscaddress,oscargs=''):
|
|||
print ('Connection to LJ refused : died ?')
|
||||
pass
|
||||
#time.sleep(0.001
|
||||
|
||||
'''
|
||||
|
||||
def WebStatus(message):
|
||||
Send("/status",message)
|
||||
|
|
@ -249,7 +250,7 @@ def rPolyLineOneColor(xy_list, c, PL , closed, xpos = 0, ypos =0, resize =0.7, r
|
|||
|
||||
|
||||
def LinesPL(PL):
|
||||
print "Stupido !! your code is to old : use DrawPL() instead of LinesPL()"
|
||||
print ("Stupido !! your code is to old : use DrawPL() instead of LinesPL()")
|
||||
DrawPL(PL)
|
||||
|
||||
def DrawPL(PL):
|
||||
|
|
@ -311,4 +312,4 @@ def Text(message,c, PL, xpos, ypos, resize, rotx, roty, rotz):
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
96
clients/planetarium/hipnames
Normal file
96
clients/planetarium/hipnames
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
Acamar, 13847
|
||||
Groombridge 1830, 57939
|
||||
Achernar, 7588
|
||||
Hadar, 68702
|
||||
Acrux, 60718
|
||||
Hamal, 9884
|
||||
Adhara, 33579
|
||||
Izar, 72105
|
||||
Agena, 68702
|
||||
Kapteyn's star, 24186
|
||||
Albireo, 95947
|
||||
Kaus Australis, 90185
|
||||
Alcor, 65477
|
||||
Kocab, 72607
|
||||
Alcyone, 17702
|
||||
Kruger,60, 110893
|
||||
Aldebaran, 21421
|
||||
Luyten's star, 36208
|
||||
Alderamin, 105199
|
||||
Markab, 113963
|
||||
Algenib, 1067
|
||||
Megrez, 59774
|
||||
Algieba, 50583
|
||||
Menkar, 14135
|
||||
Algol, 14576
|
||||
Merak, 53910
|
||||
Alhena, 31681
|
||||
Mintaka, 25930
|
||||
Alioth, 62956
|
||||
Mira, 10826
|
||||
Alkaid, 67301
|
||||
Mirach, 5447
|
||||
Almaak, 9640
|
||||
Mirphak, 15863
|
||||
Alnair, 109268
|
||||
Mizar, 65378
|
||||
Alnath, 25428
|
||||
Nihal, 25606
|
||||
Alnilam, 26311
|
||||
Nunki, 92855
|
||||
Alnitak, 26727
|
||||
Phad, 58001
|
||||
Alphard, 46390
|
||||
Pleione, 17851
|
||||
Alphekka, 76267
|
||||
Polaris, 11767
|
||||
Alpheratz, 677
|
||||
Pollux, 37826
|
||||
Alshain, 98036
|
||||
Procyon, 37279
|
||||
Altair, 97649
|
||||
Proxima, 70890
|
||||
Ankaa, 2081
|
||||
Rasalgethi, 84345
|
||||
Antares, 80763
|
||||
Rasalhague, 86032
|
||||
Arcturus, 69673
|
||||
Red,Rectangle, 30089
|
||||
Arneb, 25985,
|
||||
Regulus, 49669
|
||||
Babcock's star, 112247
|
||||
Rigel, 24436
|
||||
Barnard's,star, 87937
|
||||
Rigil Kent, 71683
|
||||
Bellatrix, 25336
|
||||
Sadalmelik, 109074
|
||||
Betelgeuse, 27989
|
||||
Saiph, 27366
|
||||
Campbell's star, 96295
|
||||
Scheat, 113881
|
||||
Canopus, 30438
|
||||
Shaula, 85927
|
||||
Capella, 24608
|
||||
Shedir, 3179
|
||||
Caph, 746
|
||||
Sheliak, 92420
|
||||
Castor, 36850
|
||||
Sirius, 32349
|
||||
Cor Caroli, 63125
|
||||
Spica, 65474
|
||||
Cyg X-1, 98298
|
||||
Tarazed, 97278
|
||||
Deneb, 102098
|
||||
Thuban, 68756
|
||||
Denebola, 57632
|
||||
Unukalhai, 77070
|
||||
Diphda, 3419
|
||||
Van,Maanen 2, 3829
|
||||
Dubhe, 54061
|
||||
Vega, 91262
|
||||
Enif, 107315
|
||||
Vindemiatrix, 63608
|
||||
Etamin, 87833
|
||||
Zaurak, 18543
|
||||
Fomalhaut, 113368
|
||||
3C 273, 60936
|
||||
|
|
@ -46,6 +46,7 @@ def OSCstart():
|
|||
#osc_udp_client(redisIP, 8002, "LJ 8002")
|
||||
|
||||
def OSCframe():
|
||||
#print("OSCprocess")
|
||||
osc_process()
|
||||
|
||||
# Properly close the system. Todo
|
||||
|
|
@ -55,14 +56,11 @@ def OSCstop():
|
|||
|
||||
def Send(oscaddress,oscargs=''):
|
||||
|
||||
oscmsg = OSCMessage()
|
||||
oscmsg.setAddress(oscaddress)
|
||||
oscmsg.append(oscargs)
|
||||
|
||||
#print ("sending to bhorosc : ",oscmsg)
|
||||
try:
|
||||
msg = oscbuildparse.OSCMessage(oscaddress, None, [oscargs])
|
||||
osc_send(msg, "LJ 8002")
|
||||
OSCframe()
|
||||
|
||||
except:
|
||||
print ('Connection to LJ refused : died ?')
|
||||
pass
|
||||
|
|
@ -82,11 +80,6 @@ osc_udp_server("0.0.0.0", 3724, "anotherserver")
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ASCII_GRAPHICS = [
|
||||
|
||||
# caracteres corrects
|
||||
|
|
@ -341,4 +334,4 @@ def Text(message,c, PL, xpos, ypos, resize, rotx, roty, rotz):
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/python3
|
||||
# coding=UTF-8
|
||||
|
||||
'''
|
||||
|
|
@ -5,7 +6,7 @@ Multi Laser planetarium in python3 for LJ.
|
|||
v0.01
|
||||
Sam Neurohack
|
||||
|
||||
Accuracy tested against apparent data and starchart at https://www.calsky.com/cs.cgi?cha=7&sec=3&sub=2
|
||||
Accuracy could be tested against apparent data and starchart at https://www.calsky.com/cs.cgi?cha=7&sec=3&sub=2
|
||||
Remember to set the same observer position and time.
|
||||
|
||||
See Readme for more information
|
||||
|
|
@ -13,8 +14,10 @@ See Readme for more information
|
|||
|
||||
Todo:
|
||||
|
||||
- use debug mode and check altaz calculated values against online sites.
|
||||
- Validate aa2radec() with online calculator. Rewrite it to remove need for Astropy.
|
||||
- Findout how to use OSC in python 3.
|
||||
-
|
||||
- Code WebUI page.
|
||||
- UpdateStars() in each laser sky. Get magnitude. See UpdateSolar for example.
|
||||
- All Draw operations should also check visibility in the given laser altitude range.
|
||||
|
|
@ -39,7 +42,11 @@ from skyfield.data import hipparcos
|
|||
|
||||
from osc4py3.as_eventloop import *
|
||||
from osc4py3 import oscbuildparse
|
||||
from osc4py3 import oscmethod as osm
|
||||
#from osc4py3 import oscmethod as osm
|
||||
from osc4py3.oscmethod import *
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import json
|
||||
|
|
@ -65,8 +72,8 @@ print ("Arguments parsing if needed...")
|
|||
argsparser = argparse.ArgumentParser(description="Planetarium for LJ")
|
||||
argsparser.add_argument("-r","--redisIP",help="IP of the Redis server used by LJ (127.0.0.1 by default) ",type=str)
|
||||
argsparser.add_argument("-c","--client",help="LJ client number (0 by default)",type=int)
|
||||
argsparser.add_argument("-l","--laser",help="Laser number to be displayed (0 by default)",type=int)
|
||||
argsparser.add_argument("-d","--debug",help="Verbosity level (0 by default)",type=int)
|
||||
argsparser.add_argument("-L","--Lasers",help="Number of lasers connected (1 by default).",type=int)
|
||||
argsparser.add_argument("-v","--verbose",help="Verbosity level (0 by default)",type=int)
|
||||
argsparser.add_argument("-i","--input",help="inputs OSC Port (8005 by default)",type=int)
|
||||
#argsparser.add_argument("-n","--name",help="City Name of the observer",type=str)
|
||||
#argsparser.add_argument("-r","--redisIP",help="Country code of the observer ",type=str)
|
||||
|
|
@ -79,13 +86,13 @@ if args.client:
|
|||
else:
|
||||
ljclient = 0
|
||||
|
||||
if args.laser:
|
||||
lasernumber = args.laser
|
||||
if args.Lasers:
|
||||
lasernumber = args.Lasers
|
||||
else:
|
||||
lasernumber = 0
|
||||
lasernumber = 1
|
||||
|
||||
if args.debug:
|
||||
debug = args.laser
|
||||
if args.verbose:
|
||||
debug = args.verbose
|
||||
else:
|
||||
debug = 0
|
||||
|
||||
|
|
@ -322,7 +329,7 @@ def DrawSolar(laser):
|
|||
# Stars
|
||||
#
|
||||
|
||||
StarsObjectShape = [(-50,30), (-30,-30), (30,-30), (10,30), (-50,30)]
|
||||
StarsObjectShape = [(-10,10), (-10,-10), (10,-10), (10,10), (-10,10)]
|
||||
|
||||
def LoadHipparcos(ts):
|
||||
global hipdata
|
||||
|
|
@ -543,6 +550,26 @@ def InitObserver(SkyCity, SkyCountryCode, time,ts):
|
|||
RadecSkies(LaserSkies, AstroSkyTime)
|
||||
|
||||
|
||||
# Change Observer position by adding deltas (Gpslong, gpslat, elevation in decimal degree/meters)
|
||||
def UpdateObserver(gpslatdelta, gpslongdelta, elevationdelta,time,ts):
|
||||
global LaserSkies, Skylat, Skylong, SkyfieldTime, AstrObserver, SkyObserver
|
||||
|
||||
Skylat += gpslatdelta
|
||||
Skylong += gpslongdelta
|
||||
Skyelevation += elevationdelta
|
||||
AstroSkyTime = time
|
||||
print ("AstroPy time", AstroSkyTime)
|
||||
SkyfieldTime = ts.from_astropy(AstroSkyTime)
|
||||
print("SkyfieldTime from AstropyUTC",SkyfieldTime.utc_iso())
|
||||
|
||||
AstrObserver = EarthLocation(lat = Skylat * u.deg, lon = Skylong * u.deg, height = Skyelevation * u.m,)
|
||||
SkyObserver = earth + Topos(Skylat, Skylong)
|
||||
RadecSkies(LaserSkies, AstroSkyTime)
|
||||
|
||||
UpdateSolar()
|
||||
UpdateStars()
|
||||
UpdateAnything()
|
||||
|
||||
def NewTime(timeshift):
|
||||
|
||||
SkyfieldTime += timeshift
|
||||
|
|
@ -555,60 +582,60 @@ def NewTime(timeshift):
|
|||
UpdateAnything()
|
||||
|
||||
|
||||
#def handlerfunction(s, x, y):
|
||||
# Will receive message data unpacked in s, x, y
|
||||
# pass
|
||||
|
||||
def OSChandler(address, s, x, y):
|
||||
def OSCstart(value):
|
||||
# Will receive message address, and message data flattened in s, x, y
|
||||
print("Planetarium OSC server got address", address,"s",s,"x",x,"y",y)
|
||||
pass
|
||||
|
||||
print("Planetarium OSC server got /planet/start with value", value)
|
||||
|
||||
|
||||
def OSCUI(value):
|
||||
# Will receive message address, and message data flattened in s, x, y
|
||||
print("Planetarium OSC server got /planet/planetUI with value", value)
|
||||
|
||||
def WebStatus(message):
|
||||
lj3.Send("/status",message)
|
||||
|
||||
|
||||
#
|
||||
# Main part
|
||||
#
|
||||
|
||||
try:
|
||||
|
||||
lj3.OSCstart()
|
||||
# Make server channels to receive packets.
|
||||
#osc_udp_server("127.0.0.1", 3721, "localhost")
|
||||
osc_udp_server("0.0.0.0", OSCinPort, "InPort")
|
||||
|
||||
# Associate Python functions with message address patterns, using default
|
||||
# argument scheme OSCARG_DATAUNPACK.
|
||||
#osc_method("/planet/*", handlerfunction)
|
||||
# Too, but request the message address pattern before in argscheme
|
||||
osc_method("/planet/*", OSChandler, argscheme=osm.OSCARG_ADDRESS + osm.OSCARG_DATAUNPACK)
|
||||
WebStatus("Planetarium")
|
||||
|
||||
# OSC Server callbacks
|
||||
print("Starting OSC at 127.0.0.1 port",OSCinPort,"...")
|
||||
osc_startup()
|
||||
osc_udp_server("127.0.0.1", OSCinPort, "InPort")
|
||||
osc_method("/planet/start*", OSCstart)
|
||||
osc_method("/planet/planetUI*", OSCUI)
|
||||
|
||||
WebStatus("Load Cities.")
|
||||
ts = load.timescale()
|
||||
LoadCities()
|
||||
|
||||
SkyCity = 'Paris'
|
||||
SkyCountryCode = 'FR'
|
||||
WebStatus(SkyCity)
|
||||
|
||||
WebStatus("Solar System..")
|
||||
LoadSolar()
|
||||
|
||||
WebStatus("Observer..")
|
||||
InitObserver(SkyCity, SkyCountryCode, Time.now(),ts)
|
||||
|
||||
|
||||
WebStatus("Load Stars..")
|
||||
LoadHipparcos(ts)
|
||||
|
||||
|
||||
StarSelect()
|
||||
|
||||
#print()
|
||||
#print ("Updating Sky Objects for current observer...")
|
||||
#print()
|
||||
WebStatus("Updating...")
|
||||
print("Updating solar system (de421) objects position for observer at", Skylat, Skylong, "time", SkyfieldTime.utc_iso())
|
||||
UpdateSolar()
|
||||
#print ("Done.")
|
||||
#print()
|
||||
|
||||
print("Updating stars for observer at", Skylat, Skylong, "time", SkyfieldTime.utc_iso())
|
||||
UpdateStars(ts)
|
||||
|
||||
WebStatus("Ready")
|
||||
lj3.Send("/planet/start",1)
|
||||
print ("Done.")
|
||||
|
||||
# UpdateStars() Todo
|
||||
|
|
@ -617,19 +644,28 @@ try:
|
|||
DisplaySolar = False
|
||||
DisplayOrientation = True
|
||||
DisplayAnything = False
|
||||
print("Start displaying on",lasernumber,"lasers")
|
||||
|
||||
while 1:
|
||||
|
||||
for laser in range(lasernumber):
|
||||
|
||||
#print ("Drawing laser",lasernumber)
|
||||
if DisplayOrientation:
|
||||
DrawOrientation(laser)
|
||||
lj3.OSCframe()
|
||||
|
||||
if DisplaySolar:
|
||||
DrawSolar(laser)
|
||||
lj3.OSCframe()
|
||||
|
||||
if DisplayStars:
|
||||
DrawStars(laser)
|
||||
lj3.OSCframe()
|
||||
|
||||
if DisplayAnything:
|
||||
DrawAnything()
|
||||
lj3.OSCframe()
|
||||
|
||||
lj3.DrawPL(laser)
|
||||
lj3.OSCframe()
|
||||
|
|
@ -644,6 +680,8 @@ except KeyboardInterrupt:
|
|||
|
||||
finally:
|
||||
|
||||
WebStatus("Planet Exit")
|
||||
print("Stopping OSC...")
|
||||
lj3.OSCstop()
|
||||
|
||||
print ("Fin du planetarium.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue