newUI, python3,...
This commit is contained in:
parent
0bb0049f02
commit
e9d3009ffb
180
LJ.conf
180
LJ.conf
|
@ -1,103 +1,113 @@
|
|||
[General]
|
||||
lasernumber = 4
|
||||
lasernumber = -1
|
||||
debug = 0
|
||||
ljayserverip = 127.0.0.1
|
||||
ljayserverip = 0.0.0.0
|
||||
wwwip = 192.168.2.43
|
||||
nozoscip = 127.0.0.1
|
||||
bhoroscip = 127.0.0.1
|
||||
autostart = artnet
|
||||
|
||||
[laser0]
|
||||
color = -1
|
||||
ip = 192.168.1.4
|
||||
kpps = 25000
|
||||
centerx = -10485
|
||||
centery = -1985
|
||||
zoomx = 12.0
|
||||
zoomy = 7.0
|
||||
sizex = 31450
|
||||
sizey = 32000
|
||||
finangle = 0.0
|
||||
swapx = -1
|
||||
swapy = -1
|
||||
lsteps = [ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]
|
||||
warpdest = [[-1500., 1500.],
|
||||
[ 1500., 1500.],
|
||||
[ 1500.,-1500.],
|
||||
[-1500.,-1500.]]
|
||||
|
||||
[laser1]
|
||||
color = -1
|
||||
ip = 192.168.1.3
|
||||
kpps = 25000
|
||||
centerx = 1554
|
||||
centery = 3573
|
||||
zoomx = 42.0
|
||||
zoomy = 40.0
|
||||
sizex = 32000
|
||||
sizey = 32000
|
||||
finangle = 0.0
|
||||
swapx = -1
|
||||
swapy = -1
|
||||
lsteps = [ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]
|
||||
warpdest = [[-1500., 1500.],
|
||||
[ 1500., 1500.],
|
||||
[ 1500.,-1500.],
|
||||
[-1500.,-1500.]]
|
||||
|
||||
[laser2]
|
||||
color = -1
|
||||
ip = 192.168.1.5
|
||||
kpps = 25000
|
||||
centerx = -31084
|
||||
centery = -4837
|
||||
zoomx = 37.8
|
||||
zoomy = 13.3
|
||||
sizex = 30600
|
||||
sizey = 32000
|
||||
finangle = 0.0
|
||||
swapx = -1
|
||||
swapy = -1
|
||||
lsteps = [(1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]
|
||||
warpdest = [[-1500., 1500.],
|
||||
[ 1500., 1500.],
|
||||
[ 1500.,-1500.],
|
||||
[-1500.,-1500.]]
|
||||
|
||||
[laser3]
|
||||
color = -1
|
||||
ip = 192.168.1.6
|
||||
kpps = 25000
|
||||
centerx = -15930
|
||||
centery = -4434
|
||||
zoomx = 36.0
|
||||
zoomy = 54.0
|
||||
type = DS1000
|
||||
ip = 192.168.2.43
|
||||
kpps = 30156
|
||||
centerx = 46500
|
||||
centery = 0
|
||||
zoomx = 294.0
|
||||
zoomy = 50.0
|
||||
sizex = 32000
|
||||
sizey = 32000
|
||||
finangle = 0.0
|
||||
swapx = 1
|
||||
swapy = 1
|
||||
swapy = -1
|
||||
lsteps = [ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]
|
||||
warpdest = [[-1500., 1500.],
|
||||
[ 1500., 1500.],
|
||||
[ 1500.,-1500.],
|
||||
[-1500.,-1500.]]
|
||||
|
||||
[laser1]
|
||||
color = -1
|
||||
type = LOCAL
|
||||
ip = 192.168.2.5
|
||||
kpps = 0
|
||||
centerx = -5707
|
||||
centery = -838
|
||||
zoomx = 20.0
|
||||
zoomy = 20.0
|
||||
sizex = 32000
|
||||
sizey = 32000
|
||||
finangle = -30.0
|
||||
swapx = -1
|
||||
swapy = -1
|
||||
lsteps = [ (1.0, 2),(0.25, 1), (0.75, 1), (1.0, 5)]
|
||||
warpdest = [[-1500., 1500.],
|
||||
[ 1500., 1500.],
|
||||
[ 1500.,-1500.],
|
||||
[-1500.,-1500.]]
|
||||
|
||||
[laser2]
|
||||
color = -1
|
||||
type = LUKE400
|
||||
ip = 192.168.2.4
|
||||
kpps = 25000
|
||||
centerx = 0
|
||||
centery = 0
|
||||
zoomx = 37.8
|
||||
zoomy = 13.3
|
||||
sizex = 30600
|
||||
sizey = 32000
|
||||
finangle = -4.0
|
||||
swapx = -1
|
||||
swapy = -1
|
||||
lsteps = [(1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]
|
||||
warpdest = [[-1500., 1500.],
|
||||
[ 1500., 1500.],
|
||||
[ 1500.,-1500.],
|
||||
[-1500.,-1500.]]
|
||||
[ 1500., 1500.],
|
||||
[ 1500.,-1500.],
|
||||
[-1500.,-1500.]]
|
||||
|
||||
[laser3]
|
||||
color = -1
|
||||
type = LUKE400
|
||||
ip = 192.168.1.5
|
||||
kpps = 25000
|
||||
centerx = 0
|
||||
centery = 0
|
||||
zoomx = 57.0
|
||||
zoomy = 63.0
|
||||
sizex = 32000
|
||||
sizey = 32000
|
||||
finangle = 0.0
|
||||
swapx = -1
|
||||
swapy = -1
|
||||
lsteps = [(1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]
|
||||
warpdest = [[-1500., 1500.],
|
||||
[ 1500., 1500.],
|
||||
[ 1500.,-1500.],
|
||||
[-1500.,-1500.]]
|
||||
|
||||
[plugins]
|
||||
plugins = {
|
||||
"nozoid": {"OSC": 8003, "command": "python3 plugins/audio/nozoids3.py"},
|
||||
"glyph": {"OSC": 8004, "command": "python3 plugins/laserglyph.py"},
|
||||
"planet": {"OSC": 8005, "command": "python3 plugins/planetarium/main.py"},
|
||||
"words": {"OSC": 8006, "command": "python3 plugins/livewords3.py"},
|
||||
"cycl": {"OSC": 8007, "command": "python3 plugins/textcycl.py"},
|
||||
"simu": {"OSC": 8008, "command": "python plugins/pysimu.py"},
|
||||
"artnet": {"OSC": 8009, "command": "python3 libs/artnet.py"},
|
||||
"bank0": {"OSC": 8010, "command": "python3 plugins/VJing/bank0.py"},
|
||||
"pose": {"OSC": 8011, "command": "python plugins/VJing/idiotia.py"},
|
||||
"maxw": {"OSC": 8012, "command": "python3 plugins/maxwell.py"},
|
||||
"square": {"OSC": 8013, "command": "python3 plugins/square.py"},
|
||||
"ljpong": {"OSC": 8020, "command": "python plugins/games/ljpong/main.py"},
|
||||
"ljwars": {"OSC": 8021, "command": "python plugins/games/ljsw/main.py"},
|
||||
"audiogen": {"OSC": 8030, "command": "python3 plugins/audio/audiogen.py"},
|
||||
"midigen": {"OSC": 8031, "command": "python3 plugins/audio/midigen.py"},
|
||||
"viewgen": {"OSC": 8032, "command": "python3 plugins/audio/viewgen.py"}
|
||||
"trckr": {"OSC": 8017, "command": "python3 plugins/VJing/trckr.py", "display": True},
|
||||
"aurora": {"OSC": 8090, "command": "python3 plugins/aurora/aurora.py", "display": True},
|
||||
"maxw": {"OSC": 8012, "command": "python3 plugins/maxwell.py", "display": True},
|
||||
"square": {"OSC": 8013, "command": "python3 plugins/square.py", "display": True},
|
||||
"custom1": {"OSC": 8014, "command": "python3 plugins/custom1.py", "display": True},
|
||||
"mitraille": {"OSC": 8015, "command": "python3 plugins/audio/mitraille.py", "display": True},
|
||||
"livecode": {"OSC": 8016, "command": "python3 plugins/livecoding.py", "display": True},
|
||||
"nozoid": {"OSC": 8003, "command": "python3 plugins/audio/nozoids3.py", "display": True},
|
||||
"glyph": {"OSC": 8004, "command": "python3 plugins/laserglyph.py", "display": True},
|
||||
"planet": {"OSC": 8005, "command": "python3 plugins/planetarium/main.py", "display": True},
|
||||
"words": {"OSC": 8006, "command": "python3 plugins/livewords3.py", "display": True},
|
||||
"cycl": {"OSC": 8007, "command": "python3 plugins/textcycl.py", "display": True},
|
||||
"simu": {"OSC": 8008, "command": "python plugins/pysimu.py", "display": False},
|
||||
"artnet": {"OSC": 8009, "command": "python3 libs3/artnet.py", "display": False},
|
||||
"livecode": {"OSC": 8016, "command": "python3 plugins/livecoding.py", "display": True},
|
||||
"ljpong": {"OSC": 8020, "command": "python plugins/games/ljpong/main.py", "display": True},
|
||||
"ljwars": {"OSC": 8021, "command": "python plugins/games/ljsw/main.py", "display": True},
|
||||
"audiogen": {"OSC": 8030, "command": "python3 plugins/audio/audiogen.py", "display": False},
|
||||
"midigen": {"OSC": 8031, "command": "python3 plugins/audio/midigen.py", "display": False},
|
||||
"viewgen": {"OSC": 8032, "command": "python3 plugins/audio/viewgen.py", "display": True}
|
||||
}
|
||||
|
||||
|
|
191
README.md
191
README.md
|
@ -1,13 +1,13 @@
|
|||
LJ v0.8.1
|
||||
LJ v0.8.2
|
||||
|
||||
By Sam Neurohack, Loloster, Cocoa
|
||||
|
||||
LICENCE : CC BY
|
||||
|
||||
|
||||
![LJ](http://www.teamlaser.fr/thsf/images/fulls/THSF9-33.jpg)
|
||||
![LJ](http://www.teamlaser.tk/lj/images/calig.png)
|
||||
|
||||
A software laser server with GUI for up to 4 lasers live actions. Think creative like Laser "battles", planetarium, sharing available lasers in demoparties for competition, ...
|
||||
A software laser framework with GUI, for up to 4 lasers live actions with ethedreams DACs. Think creative like Laser "battles", planetarium, sharing available lasers in demoparties for competition, ...
|
||||
|
||||
|
||||
|
||||
|
@ -16,13 +16,15 @@ LJ has 5 main components :
|
|||
- "Plugins" are points generators (to one or more lasers). Lot examples comes with LJ : planetarium, 3D anaglyph animations,... See plugins directory.
|
||||
- A "tracer" per etherdream/laser that take its given point list, correct geometry, recompute in laser controller coordinates, send it to its controller and report its status to the "manager".
|
||||
- A "manager" that talk to all tracers (which client number point lists to draw, new geometry correction,...), handle IOs (webui functions, OSC commands,...) and plugins.
|
||||
- A web GUI in html, css, and vanilla js. No html server or js framework here : it's complex enough. This GUI has a (currently slow) simulator, but one can used a builtin python simulator (pysimu) or an etherdream/laser emulator (from nannou) to work without physical lasers !!
|
||||
- A network available database (redis). "Plugins" send directly their pointlists to redis and each "tracer" is instructed to get one of the avalaible pointlist in redis. See details right below...
|
||||
- A web GUI in html, css, and vanilla js. No html server or js framework here : it's complex enough. This GUI has a (currently slow) simulator, but one can used an etherdream/laser emulator (from nannou) to work without physical lasers !!
|
||||
- A network available database (redis). "Plugins" can send directly their pointlists to redis and each "tracer" is instructed to get one of the avalaible pointlist in redis.
|
||||
|
||||
|
||||
More details :
|
||||
|
||||
LJ server accept up to 4 groups = virtual "scenes" of 4 "pointlists" so up to 16 pointlists can be sent to redis at anytime from anywhere in the network. You select in WebUI (Simu/plugins matrix) wich "scene" should be used by tracers/lasers. The all point is to easily share actual lasers. Imagine in demo party :
|
||||
![Scenes](http://www.teamlaser.tk/lj/images/scenes.png)
|
||||
|
||||
LJ accept up to 4 groups = virtual "scenes" of 4 "pointlists" each, so up to 16 pointlists can be sent to redis at anytime from anywhere in the network. You select in WebUI (Simu/plugins matrix) wich "scene" should be used by tracers/lasers. The all point is to easily share actual lasers. Imagine in demo party :
|
||||
|
||||
Erica needs 4 lasers, that's the 4 pointlists of a "scene".
|
||||
Paula and Jennifer use only 2 lasers each, so they can share a "scene".
|
||||
|
@ -34,7 +36,7 @@ It's obviously overkill for one laser in a garage, but for several laserS games
|
|||
|
||||
Registering the plugin in LJ.conf is absolutely not mandatory.
|
||||
|
||||
Needs at least : an etherdream DAC connected to an ILDA laser, RJ 45 IP network (gigabits only !! wifi and wired 100 mpbs doesn't work well with several lasers). Seriously : if you experience frame drops you need to upgrade your network.
|
||||
Needs at least : an etherdream DAC connected to an ILDA laser, RJ 45 IP network (gigabits only !! wifi and wired 100 mpbs doesn't work well with several lasers). Seriously : if you experience frame drops you need to upgrade your network and use a dedicated computer to run seperately main program from plugins, youtube,...
|
||||
|
||||
LJ is tested with Firefox, supports Linux and OS X. Windows is unkown but welcome, if someone want to jump in.
|
||||
|
||||
|
@ -48,30 +50,39 @@ LJ is in dev : versions in this repository will always be core functionnal : acc
|
|||
|
||||
(Doc in progress)
|
||||
|
||||
- Laser alignment like in videomapping.
|
||||
- Intensity and kpps live modification.
|
||||
- Some Lasermapping ('alignment') like in videomapping.
|
||||
- OSC and websocket commands. Very cool : LJ can script or be scripted.
|
||||
- Web ui : In your browser open webui/index.html. Javascript is needed. By default it connect to localhost. If you want to control a remote server, you need to change the uri line in LJ.js.
|
||||
- Python3
|
||||
- Web User Interface in your browser : open www/index.html. Javascript is needed. By default it connect to localhost. If you want to control remotely, you need to change the uri line in LJ.js.
|
||||
- Live WebUI extras : change debug level, restart plugin, rescan DACs,...
|
||||
- Status update every 0.5 seconds : every etherdream DAC state, number of buffer points sent,...
|
||||
- "Optimisation" points automatically added, can be changed live for glitch art. Search "resampler" commands.
|
||||
- A compiled version for os x and linux of nannou.org etherdream+laser emulator is included. For more informations, like license see https://github.com/nannou-org/ether-dream
|
||||
- Some fancy examples are available : 3D anaglyph, Laser Pong,...
|
||||
- Midi and audio reactive, look midigen.py and fft3.py
|
||||
- Openpose skeletons animations laser player.
|
||||
- Webcam live face display (trckr). Openpose skeletons animations laser player.
|
||||
- Resolume OSC client.
|
||||
- Another project (bhorpad) has been merged in LJ : so if you a led matrix, like Launchpad mini or bhoreal, plug it you may define, launch macros as pushing on one led or use them to display informations.
|
||||
- Artnet plugin.
|
||||
- Maxwell laser synth emulation plugin.
|
||||
|
||||
- Another project (bhorpad) has been merged in LJ : so if you have a led matrix, like Launchpad mini or bhoreal, plug it and you may define, launch macros as pushing on leds or use them to display informations.
|
||||
- Artnet receiver plugin, another possibity to script LJ.
|
||||
- Ableton link time synchro support.
|
||||
- Maxwell laser synth emulation plugin. Work in progress
|
||||
- Plugins list auto start, see line in LJ.conf : autostart = artnet
|
||||
- user.py plugin code example
|
||||
|
||||
|
||||
#
|
||||
# Install
|
||||
#
|
||||
|
||||
With Linux, type in a terminal window :
|
||||
With Linux, in LJ directory, type in a terminal window :
|
||||
|
||||
cd server
|
||||
./install.sh
|
||||
|
||||
Server directory also contains config files for optionnal nginx, supervisorctl and syncthing.
|
||||
|
||||
|
||||
For OS X, you need brew already installed, then :
|
||||
|
||||
brew update
|
||||
|
@ -83,7 +94,7 @@ For Linux and OS X :
|
|||
|
||||
You probably want redis bound to all network interfaces : comment the bind line in /etc/redis/redis.conf and restart it.
|
||||
|
||||
In webui/index.html change the websocket (ws) ip adress to the server IP if needed.
|
||||
In www/index.html change the websocket (ws) ip adress to the server IP if needed.
|
||||
|
||||
Using the same idea check all ip address in LJ.conf.
|
||||
|
||||
|
@ -98,22 +109,25 @@ There is a nice websocket debug tool : websocat.
|
|||
Correct launch order is :
|
||||
|
||||
- Switch on Dac/Laser (emulator or IRL)
|
||||
- Redis server once : i.e redis-server &
|
||||
- This server. see below.
|
||||
- Load/reload webUI page from disk in a browser (webui/index.html). Javascript must be enabled.
|
||||
- Redis server, usually automatically start at boot if redis is a service or you launched manually : redis-server &
|
||||
- This program. see below.
|
||||
- Load/reload webUI page from disk in a browser (www/index.html). Javascript must be enabled.
|
||||
- Run a builtin plugin or your generator, to send pointlists in redis. See in clients/plugins folder for examples.
|
||||
|
||||
|
||||
A typical LJ server start is python main.py -L numberoflasers.
|
||||
A typical LJ start is :
|
||||
|
||||
python3 main.py -L numberoflasers.
|
||||
|
||||
Use also -h to display all possible arguments, like -v for debug informations.
|
||||
|
||||
|
||||
CASE 1 : the laser server computer is the same that the computer running a generator/plugin :
|
||||
CASE 1 : the laser server computer, where LJ runs, is the same that the computer running a generator/plugin :
|
||||
|
||||
|
||||
1/ Run LJ
|
||||
|
||||
python main.py -L 1
|
||||
python3 main.py -L 1
|
||||
|
||||
2/ Check in your client code if the laser server IP is the good one
|
||||
|
||||
|
@ -121,18 +135,19 @@ Run your client
|
|||
|
||||
3/ to monitor redis server, there is an app for that (redis-manager/medis/...) or :
|
||||
redis-cli monitor
|
||||
|
||||
redis-cli --stat
|
||||
redis-cli then ask for the key you want like : get /pl/0/0
|
||||
|
||||
|
||||
CASE 2 : Server and Client computers are different :
|
||||
|
||||
|
||||
1/ Say the laser server computer (running LJ) IP is 192.138.1.13, the client computer is 192.168.1.52, First remember to check on the server computer if the redis server is listening to the right IP :
|
||||
1/ Say the laser server computer (running LJ) IP is 192.138.1.13, the client computer is 192.168.1.52, First remember to check on the server computer, if the redis server is listening to the right IP :
|
||||
|
||||
edit /etc/redis/redis.conf
|
||||
|
||||
2/ Launch LJ with -r argument :
|
||||
python main.py -r 192.168.1.13 -L 1
|
||||
python3 main.py -r 192.168.1.13 -L 1
|
||||
|
||||
3/ If the webUI is launched on "client" computer, update uri line in LJ.js
|
||||
|
||||
|
@ -154,38 +169,34 @@ A "plugin" is a software that send any number of pointlist(s). LJ comes with dif
|
|||
- LiveWords : Fill the input form and it's displayed. One word / laser.
|
||||
- Textcycl : Cycle some words with adjustable length on one laser.
|
||||
- Anaglyph : A green/red rotating cube. Try it with green/red 3D glasses !
|
||||
- Planetarium : A 4 lasers planetarium.
|
||||
- pySimu : A full speed laser simulator (pygame, python 2.7)
|
||||
- LaserPong : Our laser Pong is back ! (python 2.7)
|
||||
- Pose : Display json openpose skeleton animations ans starfields
|
||||
- fft3 : Example how to make LJ audio reactive
|
||||
- maxwell : A laser synth inspired by bluefang great work.
|
||||
- square : The basic plugin.
|
||||
- custom1 : A copy of square.py for your experiments. Start here.
|
||||
|
||||
#
|
||||
# Client Side : Program your own "plugin"
|
||||
#
|
||||
|
||||
|
||||
The server approach is based on redis, so you write and run your laser client software in any redis capable programming langage (50+ : https://redis.io/clients). An external program that just send pointlists is a "client". If you want some interactions from the webUI, like text status area support, crash detection, launch,... it's a "plugin" and some default code is needed see square.py as example and :
|
||||
The server approach is based on redis, so you can write and run your laser client software in any redis capable programming langage (50+ : https://redis.io/clients). An external program that just send pointlists is a "client". If you want some interactions from the webUI, like text status area support, crash detection, launch,... it's a "plugin" and some default code is needed. See custom1.py, a basic plugin you can modiffy. LJ and plugins signaling is mainly over OSC.
|
||||
|
||||
- Read all this readme ;-)
|
||||
- There is a client and plugin folders with examples in different languages. If you want to do game, especially with pygame, see ljpong in plugins/games directory.
|
||||
- Generate at least one point list array (say a square) with *enough points*, one point is likely to fail for buffering reason.
|
||||
- Feed your point list array in string format to redis server. i.e use "/pl/0/1" redis key to feed scene 0, pointlist 1.
|
||||
- Generate at least one pointlist array (say a square) with *enough points*, one point is likely to fail for buffering reason. See command reference below for more.
|
||||
- Feed your point list array in string format to redis server. i.e use "/pl/0/1" redis key to feed scene 0, laser 1.
|
||||
- Tell LJ.conf your plugin configuration : OSC port and command line to start it.
|
||||
|
||||
Currently the WebUI (webui/index.html) is static so it has to be modified 'manually' and build : run python build.py in webui directory.
|
||||
|
||||
Currently the WebUI (www/index.html) is static.
|
||||
|
||||
#
|
||||
# Client side dope mode : How to use lj23
|
||||
# Client side dope mode : How to use lj23 (python3)
|
||||
#
|
||||
|
||||
lj23 have many very useful functions to not reinvent the wheel for advanced point generation "client" side : layers, built in rotations,..
|
||||
lj23 have many very useful functions to not reinvent the wheel for advanced points generation "client" side : layers, sprites, built in rotations,..
|
||||
|
||||
|
||||
4 Great TRICKS with lj23.
|
||||
First open square.py and learn how to declare different objects. square.py is a 2D shape example in 3D rotation (red/green anaglyph rendering) that use 2 layers : one left eye and one for right eye.
|
||||
4 Great TRICKS with lj23 :
|
||||
|
||||
First open square.py and learn how to declare different objects. square.py is a 2D shape example in 3D rotation (red/green anaglyph rendering) that use 2 layers : one for left eye and one for right eye.
|
||||
|
||||
|
||||
1/ How to have another laser drawing the same thing ?
|
||||
|
@ -195,6 +206,7 @@ That's a destination problem : just add another destination !
|
|||
Dest1 = lj.DestObject('1', 1, True, 0 , 1, 1) # Dest1 will also send layer 0 points to scene 1, laser 1
|
||||
|
||||
|
||||
![Layers](http://www.teamlaser.tk/lj/images/layer.png)
|
||||
|
||||
2/ Different layers to different lasers ?
|
||||
|
||||
|
@ -222,14 +234,18 @@ Dest1 = lj.DestObject('1', 1, True, 1 , 0, 0) # Dest1 will also send layer 1 poi
|
|||
|
||||
4/ I want to animate/modify anything on the fly : I'm doing a game and suddenly my hero change color.
|
||||
|
||||
It's a declared object problem : say Hero is a Fixed Object, you can directly change value of
|
||||
It's a drawn object problem : there is two kind of drawn ojects :
|
||||
|
||||
- "Fixed" objects : you generate points in 2D from 0,0 top left and 500,500 is bottom right. Say Hero is a Fixed Object, you can directly change value of
|
||||
|
||||
Hero.name, Hero.active, Hero.intensity, Hero.xy, Hero.color, Hero.red, Hero.green, Hero.blue, Hero.layer, Hero.closed
|
||||
|
||||
For a character vanishing in one point use a relativeObject so you can decrease resize parameter,...
|
||||
- "Relative" Object : is a kind of laser sprite : your points in 'objectname.xy' has to be around 0,0,0. The other properties let you describe the actual position (xpos, ypos), resize,..
|
||||
|
||||
i.e for a character "PNC" vanishing in one point declared as a "Relative" Object, you can decrease resize parameter : PNC.resize
|
||||
|
||||
PNC.name, PNC.active, PNC.intensity, PNC.xy, PNC.color, PNC.red, PNC.green, PNC.blue, PNC.layer, PNC.closed, PNC.xpos, PNC.ypos, PNC.resize, PNC.rotx, PNC.roty, PNC.rotz
|
||||
|
||||
Remember RelativeObject points 'objectname.xy' has to be around 0,0,0. The other properties let you change the actual position (xpos, ypos), resize,..
|
||||
|
||||
|
||||
Same for Dest0 if it's a destObject, properties are :
|
||||
|
@ -252,10 +268,9 @@ DrawDests() will take care of all your declared drawn elements/"objects" and Des
|
|||
|
||||
(Doc in Progress)
|
||||
|
||||
- kpps live modification for glitch art.
|
||||
- A grid style warp correction process in webUI.
|
||||
- IP change should not need a LJ relaunch
|
||||
- Way faster WebUI simulator. Use pysimu plugin for full speed.
|
||||
- Way faster WebUI simulator.
|
||||
|
||||
|
||||
#
|
||||
|
@ -269,7 +284,7 @@ Our "always working solution", as we regularly move our gear for different venue
|
|||
|
||||
- We use static network configuration. Our Etherdreams controllers have static IPs defined in their SDcard from 192.168.1.1 to 192.168.1.9.
|
||||
|
||||
- Because wifi will always finally sucks for many reasons, our computers (laser server and clients) are *gigabits wired* with 192.168.1.10 and after. Don't trust end user gear marketing on wifi. We have a big gigabits switch for the *laser only lan*. We provide Internet through wifi on a different network like 192.168.2.x if really needed.
|
||||
- Because wifi will always finally sucks for many reasons, our computers (LJ server and plugins) are *gigabits wired* with IP 192.168.1.10 and after. Don't trust end user gear marketing on wifi. We have a big gigabits switch for the *laser only lan*. We provide Internet through wifi on a different network like 192.168.2.x if really needed.
|
||||
|
||||
- Again, even if etherdreams are 100 Mbits, we use *gigabits* gear.
|
||||
|
||||
|
@ -277,12 +292,12 @@ Our "always working solution", as we regularly move our gear for different venue
|
|||
By default LJ uses on 127.0.0.1 (localhost) :
|
||||
|
||||
- A websocket on port 9001 for WebUI interaction.
|
||||
- The redis server on port 6379 ('ljayserverip')
|
||||
- The redis server on port 6379 ('ljayserverip').
|
||||
- An OSC server on port 8002 for remote control via OSC and plugins.
|
||||
- Some OSC clients defined in LJ.conf to forward commands to defined plugins
|
||||
- Some OSC clients defined in LJ.conf to forward commands to defined plugins.
|
||||
|
||||
|
||||
You need to update LJ.conf to your network/etherdreams IPs and be sure to check command arguments : python main.py --help
|
||||
You need to update LJ.conf to your network/etherdreams IPs and be sure to check command arguments : python3 main.py --help
|
||||
|
||||
The need for a dedicated computer to act as "laser server" usually depends on how many lasers you want to control and your main computer load. If you seen flickering with small point lists, try the dedicated computer idea and/or stop process interfering like redis monitoring,...
|
||||
|
||||
|
@ -307,3 +322,81 @@ This program suppose that the ether dream is configured in a certain way especia
|
|||
/ilda/fps 25
|
||||
|
||||
About hardware setup, especially if you have several lasers : ILDA cables are insanely expensive. You may consider the Power Over Ethernet 'POE' option. Buy a very small ILDA cable, a POE splitter and connect everything to the ether dream fixed near your laser. You can have then a simple and very long network cable and use a Power Over Ethernet injector or switch close to the driving computer. Beware some vendors use 24V POE Injector : POE injectors and splitters must match.
|
||||
|
||||
|
||||
#
|
||||
# LJ commands reference
|
||||
#
|
||||
|
||||
8002 OSC incoming
|
||||
9001 Websocket
|
||||
|
||||
redis key
|
||||
/pl/scenenumber/lasernumber value : value is the pointlist to draw as string type :
|
||||
"[(150.0, 230.0, 65280), (170.0, 170.0, 65280), (230.0, 170.0, 65280), (210.0, 230.0, 65280), (150.0, 230.0, 65280)]"
|
||||
|
||||
|
||||
/scale/X/lasernumber value
|
||||
|
||||
/scale/Y/lasernumber value
|
||||
|
||||
/swap/X/lasernumber value (0 or 1)
|
||||
|
||||
/swap/Y/lasernumber value (0 or 1)
|
||||
|
||||
/angle/lasernumber value : increase/decrease angle correction for given laser by value
|
||||
|
||||
/loffset/X/lasernumber value : change X offset of given laser by value
|
||||
|
||||
/loffset/Y/lasernumber value : change Y offset of given laser by value
|
||||
|
||||
|
||||
/kpps/lasernumber value : Live change of kpps is not implemented in newdac.py. Change will effect next startup.
|
||||
/intens/lasernumber value : increase/decrease intensity for given laser by value
|
||||
|
||||
|
||||
/client or note on < 8 : change client displayed for Current Laser
|
||||
23 < /noteon < 32 : PL number displayed on webUI simulator
|
||||
|
||||
/grid/lasernumber value (0 or 1) : switch given laser with grid display on or off
|
||||
|
||||
/black/lasernumber value (0 or 1) : set given laser to black on or off
|
||||
|
||||
/ip/lasernumber value : change given laser IP i.e '192.168.1.1'
|
||||
|
||||
/resampler/lasernumber lsteps : change resampling strategy (glitch art) for given laser
|
||||
lsteps is a string like "[ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]"
|
||||
|
||||
|
||||
/planet will be forwarded to planetarium client.
|
||||
/nozoid will be forwarded to nozoid client.
|
||||
|
||||
/scene/scenenumber/start 0 or 1
|
||||
|
||||
/regen : regen webui index html page.
|
||||
|
||||
/scim
|
||||
|
||||
/forwardui "uicommand arg" : display *one* word on webui. There is 2 lines, first line (/status or /redstatus)
|
||||
and second line (/line1 or /redline1). Examples of "uicommand arg" :
|
||||
|
||||
/status hello
|
||||
/redline1 Error
|
||||
/laser 0
|
||||
|
||||
![LJ Display](https://www.teamlaser.tk/images/display.png)
|
||||
|
||||
Leds colors for each DACs
|
||||
|
||||
DAC state "stt" :
|
||||
Laser not requested -> led is not lit
|
||||
IDLE -> blue
|
||||
PREPARE -> cyan
|
||||
PLAYING -> green
|
||||
|
||||
DAC answers (ack) :
|
||||
replied ACK -> green
|
||||
replied FULL -> orange
|
||||
replied INVALID -> yellow
|
||||
|
||||
no connection to dac -> leds are red (6)
|
||||
|
|
|
@ -1,182 +0,0 @@
|
|||
# coding=UTF-8
|
||||
|
||||
'''
|
||||
Anaglyphed cube
|
||||
|
||||
LICENCE : CC
|
||||
'''
|
||||
|
||||
import redis
|
||||
import lj
|
||||
import math
|
||||
import time
|
||||
import numpy as np
|
||||
|
||||
# IP defined in /etd/redis/redis.conf
|
||||
redisIP = '127.0.0.1'
|
||||
r = redis.StrictRedis(host=redisIP, port=6379, db=0)
|
||||
|
||||
|
||||
width = 800
|
||||
height = 600
|
||||
centerX = width / 2
|
||||
centerY = height / 2
|
||||
|
||||
fov = 256
|
||||
viewer_distance = 2.2
|
||||
|
||||
eye_spacing = 100
|
||||
nadir = 0.5
|
||||
observer_altitude = 30000
|
||||
# elevation = z coordinate
|
||||
|
||||
# 0.0 or -2000 pop out)
|
||||
map_plane_altitude = 0.0
|
||||
|
||||
samparray = [0] * 100
|
||||
|
||||
|
||||
def LeftShift(elevation):
|
||||
|
||||
diff = elevation - map_plane_altitude
|
||||
return nadir * eye_spacing * diff / (observer_altitude - elevation)
|
||||
|
||||
def RightShift(elevation):
|
||||
|
||||
diff = map_plane_altitude - elevation
|
||||
return (1 - nadir) * eye_spacing * diff / (observer_altitude - elevation)
|
||||
|
||||
# If you want to use rgb for color :
|
||||
def rgb2int(r,g,b):
|
||||
return int('0x%02x%02x%02x' % (r,g,b),0)
|
||||
|
||||
|
||||
def ssawtooth(samples,freq,phase):
|
||||
|
||||
t = np.linspace(0+phase, 1+phase, samples)
|
||||
for ww in range(samples):
|
||||
samparray[ww] = signal.sawtooth(2 * np.pi * freq * t[ww])
|
||||
return samparray
|
||||
|
||||
def ssquare(samples,freq,phase):
|
||||
|
||||
t = np.linspace(0+phase, 1+phase, samples)
|
||||
for ww in range(samples):
|
||||
samparray[ww] = signal.square(2 * np.pi * freq * t[ww])
|
||||
return samparray
|
||||
|
||||
def ssine(samples,freq,phase):
|
||||
|
||||
t = np.linspace(0+phase, 1+phase, samples)
|
||||
for ww in range(samples):
|
||||
samparray[ww] = np.sin(2 * np.pi * freq * t[ww])
|
||||
return samparray
|
||||
|
||||
|
||||
|
||||
def shader2scrX(s):
|
||||
a1, a2 = -1,1
|
||||
b1, b2 = -width/2, width/2
|
||||
return b1 + ((s - a1) * (b2 - b1) / (a2 - a1))
|
||||
|
||||
def shader2scrY(s):
|
||||
a1, a2 = -1,1
|
||||
b1, b2 = -heigth/2, heigth/2
|
||||
return b1 + ((s - a1) * (b2 - b1) / (a2 - a1))
|
||||
|
||||
|
||||
def Proj(x,y,z,angleX,angleY,angleZ):
|
||||
|
||||
rad = angleX * math.pi / 180
|
||||
cosa = math.cos(rad)
|
||||
sina = math.sin(rad)
|
||||
y2 = y
|
||||
y = y2 * cosa - z * sina
|
||||
z = y2 * sina + z * cosa
|
||||
|
||||
rad = angleY * math.pi / 180
|
||||
cosa = math.cos(rad)
|
||||
sina = math.sin(rad)
|
||||
z2 = z
|
||||
z = z2 * cosa - x * sina
|
||||
x = z2 * sina + x * cosa
|
||||
|
||||
rad = angleZ * math.pi / 180
|
||||
cosa = math.cos(rad)
|
||||
sina = math.sin(rad)
|
||||
x2 = x
|
||||
x = x2 * cosa - y * sina
|
||||
y = x2 * sina + y * cosa
|
||||
|
||||
|
||||
""" Transforms this 3D point to 2D using a perspective projection. """
|
||||
factor = fov / (viewer_distance + z)
|
||||
x = x * factor + centerX
|
||||
y = - y * factor + centerY
|
||||
return (x,y)
|
||||
|
||||
|
||||
|
||||
def DrawPL():
|
||||
|
||||
Shape = []
|
||||
Left = []
|
||||
Right = []
|
||||
counter =0
|
||||
|
||||
while 1:
|
||||
|
||||
yfactor = 10
|
||||
Left = []
|
||||
Right = []
|
||||
x = -1
|
||||
z = -0.1
|
||||
for step in y0:
|
||||
|
||||
Left.append( Proj(x+LeftShift(z*25),step/yfactor,z,0,0,0))
|
||||
Right.append(Proj(x+RightShift(z*25),step/yfactor,z,0,0,0))
|
||||
x += 0.02
|
||||
|
||||
lj.rPolyLineOneColor(Left, c = red, PL = 0, closed = False, xpos = 0, ypos = 10, resize = 1.5, rotx =0, roty =0 , rotz=0)
|
||||
lj.rPolyLineOneColor(Right, c = green, PL = 0, closed = False, xpos = 0, ypos = 10, resize = 1.5, rotx =0, roty =0 , rotz=0)
|
||||
|
||||
Left = []
|
||||
Right = []
|
||||
x = -1
|
||||
z = 0
|
||||
for step in y1:
|
||||
|
||||
Left.append( Proj(x+LeftShift(z*25),step/yfactor,z,0,0,0))
|
||||
Right.append(Proj(x+RightShift(z*25),step/yfactor,z,0,0,0))
|
||||
x += 0.02
|
||||
|
||||
lj.rPolyLineOneColor(Left, c = red, PL = 0, closed = False, xpos = 0, ypos = 25, resize = 1.5, rotx =0, roty =0 , rotz=0)
|
||||
lj.rPolyLineOneColor(Right, c = green, PL = 0, closed = False, xpos = 0, ypos = 25, resize = 1.5, rotx =0, roty =0 , rotz=0)
|
||||
|
||||
Left = []
|
||||
Right = []
|
||||
x = -1
|
||||
z = 0.1
|
||||
for step in y2:
|
||||
|
||||
Left.append( Proj(x+LeftShift(z*25),step/yfactor,z,0,0,0))
|
||||
Right.append(Proj(x+RightShift(z*25),step/yfactor,z,0,0,0))
|
||||
x += 0.02
|
||||
|
||||
lj.rPolyLineOneColor(Left, c = red, PL = 0, closed = False, xpos = 0, ypos = 50, resize = 1.5, rotx =0, roty =0 , rotz=0)
|
||||
lj.rPolyLineOneColor(Right, c = green, PL = 0, closed = False, xpos = 0, ypos = 50, resize = 1.5, rotx =0, roty =0 , rotz=0)
|
||||
|
||||
|
||||
lj.DrawPL(0)
|
||||
time.sleep(0.005)
|
||||
|
||||
white = rgb2int(255,255,255)
|
||||
red = rgb2int(255,0,0)
|
||||
blue = rgb2int(0,0,255)
|
||||
green = rgb2int(0,255,0)
|
||||
|
||||
y0 = ssine(100,5,-0.5)
|
||||
y1 = ssine(100,5,0)
|
||||
y2 = ssine(100,5,0.5)
|
||||
|
||||
DrawPL()
|
352
clients/lj.py
352
clients/lj.py
|
@ -1,352 +0,0 @@
|
|||
# coding=UTF-8
|
||||
|
||||
'''
|
||||
LJ v0.8.2
|
||||
Some LJ functions useful for python 2.7 clients (was framy.py)
|
||||
Functions and documentation here is low priority as python 2 support will stop soon.
|
||||
Better code your plugin with python 3 and lj3.py.
|
||||
|
||||
|
||||
Config
|
||||
PolyLineOneColor
|
||||
rPolyLineOneColor
|
||||
Text
|
||||
SendLJ : remote control
|
||||
LjClient :
|
||||
LjPl :
|
||||
DrawPL
|
||||
WebStatus
|
||||
|
||||
LICENCE : CC
|
||||
Sam Neurohack
|
||||
|
||||
'''
|
||||
|
||||
import math
|
||||
import redis
|
||||
from OSC import OSCServer, OSCClient, OSCMessage
|
||||
|
||||
print "Importing lj..."
|
||||
#redisIP = '127.0.0.1'
|
||||
#r = redis.StrictRedis(host=redisIP, port=6379, db=0)
|
||||
|
||||
ClientNumber = 0
|
||||
|
||||
point_list = []
|
||||
pl = [[],[],[],[]]
|
||||
|
||||
|
||||
|
||||
def SendLJ(oscaddress,oscargs=''):
|
||||
|
||||
oscmsg = OSCMessage()
|
||||
oscmsg.setAddress(oscaddress)
|
||||
oscmsg.append(oscargs)
|
||||
|
||||
print ("sending OSC message : ",oscmsg)
|
||||
try:
|
||||
osclientlj.sendto(oscmsg, (redisIP, 8002))
|
||||
oscmsg.clearData()
|
||||
except:
|
||||
print ('Connection to LJ refused : died ?')
|
||||
pass
|
||||
#time.sleep(0.001
|
||||
|
||||
def WebStatus(message):
|
||||
SendLJ("/status", message)
|
||||
|
||||
|
||||
ASCII_GRAPHICS = [
|
||||
|
||||
#implementé
|
||||
|
||||
[(-50,30), (-30,-30), (30,-30), (10,30), (-50,30)], #0
|
||||
[(-20,30), (0,-30), (-20,30)], #1
|
||||
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], #2
|
||||
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #3
|
||||
[(30,10), (-30,10), (0,-30), (0,30)], #4
|
||||
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], #5
|
||||
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], #6
|
||||
[(-30,-30), (30,-30), (-30,30)], #7
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30), (-30,0), (30,0)], #8
|
||||
[(30,0), (-30,0), (-30,-10), (0,-30), (30,-30), (30,10), (0,30), (-30,30)], #9
|
||||
|
||||
# A implementer
|
||||
[(-30,10), (30,-10), (30,10), (0,30), (-30,10), (-30,-10), (0,-30), (30,-10)], #:
|
||||
[(-30,-10), (0,-30), (0,30)], [(-30,30), (30,30)], #;
|
||||
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], #<
|
||||
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #=
|
||||
[(30,10), (-30,10), (0,-30), (0,30)], #>
|
||||
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], #?
|
||||
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], #@
|
||||
|
||||
# Implementé
|
||||
|
||||
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], #A
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], #A
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30), (-30,0), (30,0)], #B
|
||||
[(30,30), (-30,30), (-30,-30), (30,-30)], #C
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30)], #D
|
||||
[(30,30), (-30,30), (-30,-0), (30,0), (-30,0), (-30,-30), (30,-30)], #E
|
||||
[(-30,30), (-30,-0), (30,0), (-30,0), (-30,-30), (30,-30)], #F
|
||||
[(0,0), (30,0), (30,30), (-30,30), (-30,-30),(30,-30)], #G
|
||||
[(-30,-30), (-30,30), (-30,0), (30,0), (30,30), (30,-30)], #H
|
||||
[(0,30), (0,-30)], #I
|
||||
[(-30,30), (0,-30), (0,-30), (-30,-30), (30,-30)], #J
|
||||
[(-30,-30), (-30,30), (-30,0), (30,-30), (-30,0), (30,30)], #K
|
||||
[(30,30), (-30,30), (-30,-30)], #L
|
||||
[(-30,30), (-30,-30), (0,0), (30,-30), (30,30)], #M
|
||||
[(-30,30), (-30,-30), (30,30), (30,-30)], #N
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30)], #O
|
||||
[(-30,0), (30,0), (30,-30), (-30,-30), (-30,30)], #P
|
||||
[(30,30), (30,-30), (-30,-30), (-30,30), (30,30),(35,35)], #Q
|
||||
[(-30,30), (-30,-30), (30,-30), (30,0), (-30,0), (30,30)], #R
|
||||
[(30,-30), (-30,-30), (-30,0), (30,0), (30,30), (-30,30)], #S
|
||||
[(0,30), (0,-30), (-30,-30), (30,-30)], #T
|
||||
[(-30,-30), (-30,30), (30,30), (30,-30)], #U
|
||||
[(-30,-30), (0,30), (30,-30)], #V
|
||||
[(-30,-30), (-30,30), (0,0), (30,30), (30,-30)], #W
|
||||
[(-30,30), (30,-30)], [(-30,-30), (30,30)], #X
|
||||
[(0,30), (0,0), (30,-30), (0,0), (-30,-30)], #Y
|
||||
[(30,30), (-30,30), (30,-30), (-30,-30)], #Z
|
||||
|
||||
# A implementer
|
||||
|
||||
[(-30,-10), (0,-30), (0,30)], [(-30,30), (30,30)], #[
|
||||
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], #\
|
||||
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #]
|
||||
[(30,10), (-30,10), (0,-30), (0,30)], #^
|
||||
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], #_
|
||||
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], #`
|
||||
|
||||
# Implementé
|
||||
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], #a
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20), (-20,0), (20,0)], #b
|
||||
[(20,20), (-20,20), (-20,-20), (20,-20)], #c
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], #d
|
||||
[(20,20), (-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], #e
|
||||
[(-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], #f
|
||||
[(0,0), (20,0), (20,20), (-20,20), (-20,-20),(20,-20)], #g
|
||||
[(-20,-20), (-20,20), (-20,0), (20,0), (20,20), (20,-20)], #H
|
||||
[(0,20), (0,-20)], #I
|
||||
[(-20,20), (0,-20), (0,-20), (-20,-20), (20,-20)], #J
|
||||
[(-20,-20), (-20,20), (-20,0), (20,-20), (-20,0), (20,20)], #K
|
||||
[(20,20), (-20,20), (-20,-20)], #L
|
||||
[(-20,20), (-20,-20), (0,0), (20,-20), (20,20)], #M
|
||||
[(-20,20), (-20,-20), (20,20), (20,-20)], #N
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], #O
|
||||
[(-20,0), (20,0), (20,-20), (-20,-20), (-20,20)], #P
|
||||
[(20,20), (20,-20), (-20,-20), (-20,20), (20,20),(25,25)], #Q
|
||||
[(-20,20), (-20,-20), (20,-20), (20,0), (-20,0), (20,20)], #R
|
||||
[(20,-20), (-20,-20), (-20,0), (20,0), (20,20), (-20,20)], #S
|
||||
[(0,20), (0,-20), (-20,-20), (20,-20)], #T
|
||||
[(-20,-20), (-20,20), (20,20), (20,-20)], #U
|
||||
[(-20,-20), (0,20), (20,-20)], #V
|
||||
[(-20,-20), (-20,20), (0,0), (20,20), (20,-20)], #W
|
||||
[(-20,20), (20,-20)], [(-20,-20), (20,20)], #X
|
||||
[(0,20), (0,0), (20,-20), (0,0), (-20,-20)], #Y
|
||||
[(20,20), (-20,20), (20,-20), (-20,-20)], #Z
|
||||
|
||||
[(-2,15), (2,15)] # Point a la place de {
|
||||
]
|
||||
|
||||
def Config(redisIP,client):
|
||||
global ClientNumber
|
||||
|
||||
r = redis.StrictRedis(host=redisIP, port=6379, db=0)
|
||||
ClientNumber = client
|
||||
#print "client configured",ClientNumber
|
||||
|
||||
|
||||
def LjClient(client):
|
||||
global ClientNumber
|
||||
|
||||
ClientNumber = client
|
||||
|
||||
def LjPl(pl):
|
||||
global PL
|
||||
|
||||
PL = pl
|
||||
|
||||
# Properly close the system. Todo
|
||||
def OSCstop():
|
||||
osc_terminate()
|
||||
|
||||
|
||||
# Answer to LJ pings with /pong value
|
||||
def OSCping(name):
|
||||
SendLJ("/pong",name)
|
||||
|
||||
|
||||
|
||||
# Closing plugin messages to LJ
|
||||
def ClosePlugin(name):
|
||||
WebStatus(name+" Exit")
|
||||
SendLJ("/"+name+"/start",0)
|
||||
|
||||
|
||||
|
||||
|
||||
# /quit
|
||||
def OSCquit(name):
|
||||
|
||||
WebStatus(name + " quit.")
|
||||
print("Stopping OSC...")
|
||||
|
||||
OSCstop()
|
||||
sys.exit()
|
||||
|
||||
|
||||
|
||||
def LineTo(xy, c, PL):
|
||||
|
||||
pl[PL].append((xy + (c,)))
|
||||
|
||||
def Line(xy1, xy2, c, PL):
|
||||
LineTo(xy1, 0, PL)
|
||||
LineTo(xy2, c , PL)
|
||||
|
||||
|
||||
def PolyLineOneColor(xy_list, c, PL , closed ):
|
||||
#print "--"
|
||||
#print "c",c
|
||||
#print "xy_list",xy_list
|
||||
#print "--"
|
||||
xy0 = None
|
||||
for xy in xy_list:
|
||||
if xy0 is None:
|
||||
xy0 = xy
|
||||
#print "xy0:",xy0
|
||||
LineTo(xy0,0, PL)
|
||||
LineTo(xy0,c, PL)
|
||||
else:
|
||||
#print "xy:",xy
|
||||
LineTo(xy,c, PL)
|
||||
if closed:
|
||||
LineTo(xy0,c, PL)
|
||||
|
||||
|
||||
# Computing points coordinates for rPolyline function from 3D and around 0,0 to pygame coordinates
|
||||
def Pointransf(xy, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
x = xy[0] * resize
|
||||
y = xy[1] * resize
|
||||
z = 0
|
||||
|
||||
rad = math.radians(rotx)
|
||||
cosaX = math.cos(rad)
|
||||
sinaX = math.sin(rad)
|
||||
|
||||
y2 = y
|
||||
y = y2 * cosaX - z * sinaX
|
||||
z = y2 * sinaX + z * cosaX
|
||||
|
||||
rad = math.radians(roty)
|
||||
cosaY = math.cos(rad)
|
||||
sinaY = math.sin(rad)
|
||||
|
||||
z2 = z
|
||||
z = z2 * cosaY - x * sinaY
|
||||
x = z2 * sinaY + x * cosaY
|
||||
|
||||
rad = math.radians(rotz)
|
||||
cosZ = math.cos(rad)
|
||||
sinZ = math.sin(rad)
|
||||
|
||||
x2 = x
|
||||
x = x2 * cosZ - y * sinZ
|
||||
y = x2 * sinZ + y * cosZ
|
||||
|
||||
#print xy, (x + xpos,y+ ypos)
|
||||
return (x + xpos,y+ ypos)
|
||||
'''
|
||||
to understand why it get negative Y
|
||||
|
||||
# 3D to 2D projection
|
||||
factor = 4 * gstt.cc[22] / ((gstt.cc[21] * 8) + z)
|
||||
print xy, (x * factor + xpos, - y * factor + ypos )
|
||||
return (x * factor + xpos, - y * factor + ypos )
|
||||
'''
|
||||
|
||||
# Send 2D point list around 0,0 with 3D rotation resizing and reposition around xpos ypos
|
||||
#def rPolyLineOneColor(self, xy_list, c, PL , closed, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
||||
def rPolyLineOneColor(xy_list, c, PL , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
xy0 = None
|
||||
for xy in xy_list:
|
||||
if xy0 is None:
|
||||
xy0 = xy
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),0, PL)
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),c, PL)
|
||||
else:
|
||||
LineTo(Pointransf(xy, xpos, ypos, resize, rotx, roty, rotz),c, PL)
|
||||
if closed:
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),c, PL)
|
||||
|
||||
|
||||
def LinesPL(PL):
|
||||
print "Stupido !! your code is to old : use DrawPL() instead of LinesPL()"
|
||||
DrawPL(PL)
|
||||
|
||||
|
||||
def DrawPL(PL):
|
||||
#print '/pl/0/'+str(PL), str(pl[PL])
|
||||
if r.set('/pl/'+str(ClientNumber)+'/'+str(PL), str(pl[PL])) == True:
|
||||
#print '/pl/'+str(ClientNumber)+'/'+str(PL), str(pl[PL])
|
||||
pl[PL] = []
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def ResetPL(self, PL):
|
||||
pl[PL] = []
|
||||
|
||||
|
||||
|
||||
def DigitsDots(number,color):
|
||||
dots =[]
|
||||
for dot in ASCII_GRAPHICS[number]:
|
||||
#print dot
|
||||
dots.append((gstt.xy_center[0]+dot[0],gstt.xy_center[1]+dot[1],color))
|
||||
#self.point_list.append((xy + (c,)))
|
||||
return dots
|
||||
|
||||
def CharDots(char,color):
|
||||
|
||||
dots =[]
|
||||
for dot in ASCII_GRAPHICS[ord(char)-46]:
|
||||
dots.append((dot[0],dot[1],color))
|
||||
return dots
|
||||
|
||||
def Text(message,c, PL, xpos, ypos, resize, rotx, roty, rotz):
|
||||
|
||||
dots =[]
|
||||
|
||||
l = len(message)
|
||||
i= 0
|
||||
#print message
|
||||
|
||||
for ch in message:
|
||||
|
||||
#print ""
|
||||
# texte centre en x automatiquement selon le nombre de lettres l
|
||||
x_offset = 26 * (- (0.9*l) + 3*i)
|
||||
# Digits
|
||||
if ord(ch)<58:
|
||||
char_pl_list = ASCII_GRAPHICS[ord(ch) - 48]
|
||||
else:
|
||||
char_pl_list = ASCII_GRAPHICS[ord(ch) - 46]
|
||||
char_draw = []
|
||||
#dots.append((char_pl_list[0][0] + x_offset,char_pl_list[0][1],0))
|
||||
|
||||
for xy in char_pl_list:
|
||||
char_draw.append((xy[0] + x_offset,xy[1],c))
|
||||
i +=1
|
||||
#print ch,char_pl_list,char_draw
|
||||
rPolyLineOneColor(char_draw, c, PL , False, xpos, ypos, resize, rotx, roty, rotz)
|
||||
#dots.append(char_draw)
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
// Send points lists to redis server
|
||||
// In compatible LJay string format (pythonic lists)
|
||||
|
||||
var redis = require("redis"),
|
||||
client = redis.createClient(6379,'127.0.0.1');
|
||||
|
||||
|
||||
|
||||
function rgb2int(r,g,b) {
|
||||
// Generate color from r g b components
|
||||
var color = hex(r) + hex(g) + hex(b);
|
||||
return parseInt(color, 16)
|
||||
}
|
||||
|
||||
function hex(v) {
|
||||
// Get hexadecimal numbers.
|
||||
var hex = v.toString(16);
|
||||
if (v < 16) {
|
||||
hex = "0" + hex;
|
||||
}
|
||||
return hex;
|
||||
}
|
||||
|
||||
// add one dot to Laser 0 point list
|
||||
function adddot0(dotdata){
|
||||
var dotstring = "(" + dotdata + "),";
|
||||
pl0 += dotstring;
|
||||
}
|
||||
|
||||
// add one dot to Laser 1 point list
|
||||
function adddot1(dotdata){
|
||||
var dotstring = "(" + dotdata + "),";
|
||||
pl1 += dotstring;
|
||||
}
|
||||
|
||||
// Generate same square to laser 0 and laser 1
|
||||
function GenPoints()
|
||||
{
|
||||
var pt = {};
|
||||
|
||||
// direct colors, i.e white
|
||||
pt.r = 255;
|
||||
pt.g = 255;
|
||||
pt.b = 255;
|
||||
|
||||
// named colors
|
||||
var white = rgb2int(255, 255, 255);
|
||||
|
||||
pt.x = 100;
|
||||
pt.y = 200;
|
||||
adddot0([pt.x, pt.y, rgb2int(pt.r, pt.g, pt.b)]);
|
||||
adddot1([pt.x, pt.y, rgb2int(pt.r, pt.g, pt.b)]);
|
||||
|
||||
pt.x = 100;
|
||||
pt.y = 300;
|
||||
adddot0([pt.x, pt.y, white]);
|
||||
adddot1([pt.x, pt.y, white]);
|
||||
|
||||
pt.x = 200;
|
||||
pt.y = 300;
|
||||
adddot0([pt.x, pt.y, white]);
|
||||
adddot1([pt.x, pt.y, white]);
|
||||
|
||||
pt.x = 200;
|
||||
pt.y = 200;
|
||||
adddot0([pt.x, pt.y, white]);
|
||||
adddot1([pt.x, pt.y, white]);
|
||||
|
||||
pt.x = 100;
|
||||
pt.y = 200;
|
||||
adddot0([pt.x, pt.y, white]);
|
||||
adddot1([pt.x, pt.y, white]);
|
||||
}
|
||||
|
||||
// Point lists strings
|
||||
var pl0 = "[";
|
||||
var pl1 = "[";
|
||||
GenPoints();
|
||||
pl0 = pl0.slice(0,-1) + "]"
|
||||
pl1 = pl1.slice(0,-1) + "]"
|
||||
|
||||
console.log(pl0);
|
||||
console.log(pl1);
|
||||
|
||||
// Send points lists to redis server
|
||||
// /pl/clientnumber/lasernumber pointlist
|
||||
// you're client 0 and want to send points to laser 0 and 1
|
||||
|
||||
client.set("/pl/0/0",pl0);
|
||||
client.set("/pl/0/1",pl1);
|
||||
|
||||
// Quit
|
||||
client.quit()
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
# coding=UTF-8
|
||||
|
||||
'''
|
||||
Multi Laser client example with direct send of point lists to redis server.
|
||||
|
||||
Remember : LJ will automatically warp geometry according to alignement data. See webUI.
|
||||
|
||||
LICENCE : CC
|
||||
'''
|
||||
|
||||
import redis
|
||||
|
||||
# IP defined in /etd/redis/redis.conf
|
||||
redisIP = '127.0.0.1'
|
||||
|
||||
r = redis.StrictRedis(host=redisIP, port=6379, db=0)
|
||||
|
||||
# (x,y,color in integer) 65280 is color #00FF00
|
||||
# Green rectangular shape :
|
||||
pl0 = [(100,300,65280),(200,300,65280),(200,200,65280),(100,200,65280),(100,300,65280)]
|
||||
|
||||
|
||||
# If you want to use rgb for color :
|
||||
def rgb2int(r,g,b):
|
||||
return int('0x%02x%02x%02x' % (r,g,b),0)
|
||||
|
||||
# White rectangular shape
|
||||
pl1 = [(100,300,rgb2int(255,255,255)),(200,300,rgb2int(255,255,255)),(200,200,rgb2int(255,255,255)),(100,200,rgb2int(255,255,255)),(100,300,rgb2int(255,255,255))]
|
||||
|
||||
|
||||
# /pl/clientnumber/lasernumber pointlist
|
||||
|
||||
# Consider you're client 0
|
||||
# Send to laser 0 (see LJ.conf)
|
||||
r.set('/pl/0/0', str(pl0))
|
||||
|
||||
# Send to laser 1 (see LJ.conf)
|
||||
r.set('/pl/0/1', str(pl1))
|
||||
# Send to laser 2 (see LJ.conf)
|
||||
r.set('/pl/0/2', str(pl1))
|
||||
|
11
install.sh
11
install.sh
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
sudo apt install python-pip
|
||||
sudo apt install git
|
||||
sudo apt install redis
|
||||
pip install numpy
|
||||
pip install scipy
|
||||
git clone https://github.com/ptone/pyosc --depth 1 /tmp/pyosc && cd /tmp/pyosc && sudo ./setup.py install
|
||||
pip install redis
|
||||
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
BIN
libs/bhoreal.pyc
BIN
libs/bhoreal.pyc
Binary file not shown.
BIN
libs/cli.pyc
BIN
libs/cli.pyc
Binary file not shown.
Binary file not shown.
BIN
libs/font1.pyc
BIN
libs/font1.pyc
Binary file not shown.
BIN
libs/gstt.pyc
BIN
libs/gstt.pyc
Binary file not shown.
Binary file not shown.
|
@ -1,883 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Launchpad
|
||||
v0.7.0
|
||||
|
||||
Maunchpad mini Handler.
|
||||
Start a dedicated thread to handle incoming events from launchpad.
|
||||
|
||||
Cls()
|
||||
AllColorPad(color)
|
||||
StartLaunchPad(port) : Start animation
|
||||
|
||||
Led Matrix can be access with X and Y coordinates and as midi note (0-63)
|
||||
|
||||
PadNoteOn(note,color)
|
||||
PadNoteOff(note)
|
||||
PadNoteOnXY(x,y,color):
|
||||
PadNoteOffXY(x,y):
|
||||
PadNoteXY(x,y):
|
||||
|
||||
PadLeds[], PadTops[] and PadRights arrays stores matrix current state
|
||||
|
||||
|
||||
Top raw and right column leds are numbered humanly 1-8. So -1 is for pythonic arrays position 0-7
|
||||
|
||||
PadTopOn(number,color)
|
||||
PadTopOff(number)
|
||||
PadRightOn(number)
|
||||
PadRightOff(number):
|
||||
|
||||
by Sam Neurohack
|
||||
from /team/laser
|
||||
|
||||
for python 2 & 3
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import time
|
||||
import rtmidi
|
||||
from rtmidi.midiutil import open_midiinput
|
||||
from threading import Thread
|
||||
from rtmidi.midiconstants import (CHANNEL_PRESSURE, CONTROLLER_CHANGE, NOTE_ON, NOTE_OFF,
|
||||
PITCH_BEND, POLY_PRESSURE, PROGRAM_CHANGE)
|
||||
|
||||
from mido import MidiFile
|
||||
import mido
|
||||
import sys
|
||||
import midi3
|
||||
#import midimacros, maxwellmacros
|
||||
import traceback
|
||||
|
||||
from queue import Queue
|
||||
import scrolldisp
|
||||
#from libs import macros
|
||||
import json, subprocess
|
||||
from OSC3 import OSCServer, OSCClient, OSCMessage
|
||||
import socket
|
||||
|
||||
|
||||
print('Launchpad Startup..')
|
||||
myHostName = socket.gethostname()
|
||||
print("Name of the localhost is {}".format(myHostName))
|
||||
myIP = socket.gethostbyname(myHostName)
|
||||
print("IP address of the localhost is {}".format(myIP))
|
||||
|
||||
myIP = "127.0.0.1"
|
||||
|
||||
print('Used IP', myIP)
|
||||
OSCinPort = 8080
|
||||
monomePort = 8000
|
||||
maxwellatorPort = 8090
|
||||
|
||||
launchqueue = Queue()
|
||||
|
||||
mode = "maxwell"
|
||||
|
||||
mididest = 'Session 1'
|
||||
midichannel = 1
|
||||
CChannel = 0
|
||||
CCvalue = 0
|
||||
|
||||
PadLeds = [0] * 64
|
||||
PadTops= [0] * 8
|
||||
PadRights= [0] * 8
|
||||
|
||||
Here = -1
|
||||
|
||||
ModeCallback = ''
|
||||
# midi notes
|
||||
LaunchLedMatrix = [(0,1,2,3,4,5,6,7),(16,17,18,19,20,21,22,23),(32,33,34,35,36,37,38,39),(48,49,50,51,52,53,54,55),(64,65,66,67,68,69,70,71),(80,81,82,83,84,85,86,87),(96,97,98,99,100,101,102,103),(112,113,114,115,116,117,118,119)]
|
||||
# Notes
|
||||
LaunchRight = (8,24,40,56,72,88,104,120)
|
||||
# CC
|
||||
LaunchTop = (104,105,106,107,108,109,110,111)
|
||||
PadTop = [0,0,0,0,0,0,0,0]
|
||||
PadRight = [0,0,0,0,0,0,0,0]
|
||||
PadMatrix = [0] * 64
|
||||
TopSelection = [0] *8
|
||||
computerIP = ['127.0.0.1','192.168.2.95','192.168.2.52','127.0.0.1',
|
||||
'127.0.0.1','127.0.0.1','127.0.0.1','127.0.0.1']
|
||||
computer = 0
|
||||
|
||||
|
||||
|
||||
# /cc cc number value
|
||||
def cc(ccnumber, value, dest=mididest):
|
||||
|
||||
midi3.MidiMsg([CONTROLLER_CHANGE+midichannel-1,ccnumber,value], dest)
|
||||
|
||||
|
||||
|
||||
def Disp(text,device = 'Launchpad Mini'):
|
||||
|
||||
print(device,midi3.FindInDevice(device))
|
||||
|
||||
if (device == "Launchpad Mini" or device =='launchpad') and midi3.FindInDevice(device) != -1:
|
||||
scrolldisp.Display(text, color=(255,255,255), delay=0.2, mididest = 'launchpad')
|
||||
|
||||
if device == 'bhoreal' and midi3.FindInDevice('Bhoreal'):
|
||||
scrolldisp.Display(text, color=(255,255,255), delay=0.2, mididest = device)
|
||||
|
||||
|
||||
def PadNoteOn(note,color):
|
||||
(x,y) = BhorIndex(note)
|
||||
#print(note,x,y)
|
||||
PadNoteOnXY(x,y,color)
|
||||
|
||||
|
||||
def PadNoteOff(note):
|
||||
(x,y) = BhorIndex(note)
|
||||
PadNoteOffXY(x,y)
|
||||
|
||||
def PadNoteOnXY(x,y,color):
|
||||
msg= [NOTE_ON, PadNoteXY(x,y), color]
|
||||
#print msg
|
||||
midi3.send(msg,"Launchpad")
|
||||
PadLeds[BhorNoteXY(x,y)]=color
|
||||
|
||||
|
||||
def PadNoteOffXY(x,y):
|
||||
msg= [NOTE_OFF, PadNoteXY(x,y), 0]
|
||||
midi3.send(msg,"Launchpad")
|
||||
PadLeds[BhorNoteXY(x,y)]=0
|
||||
|
||||
def PadNoteXY(x,y):
|
||||
note = LaunchLedMatrix[int(y-1)][int(x-1)]
|
||||
return note
|
||||
|
||||
def PadIndex(note):
|
||||
y=note/16
|
||||
x=note%16
|
||||
return int(x+1),int(y+1)
|
||||
|
||||
def BhorIndex(note):
|
||||
y=note/8
|
||||
x=note%8
|
||||
#print "Note : ",note
|
||||
#print "BhorIndex : ", x+1,y+1
|
||||
return int(x+1),int(y+1)
|
||||
|
||||
def BhorNoteXY(x,y):
|
||||
note = (x -1)+ (y-1) * 8
|
||||
return note
|
||||
|
||||
# top raw and right column leds are numbered humanly 1-8. So -1 is for pythonic arrays position 0-7
|
||||
def PadTopOn(number,color):
|
||||
msg= [CONTROLLER_CHANGE, LaunchTop[number-1], color]
|
||||
midi3.send(msg,"Launchpad")
|
||||
PadTops[number-1]=color
|
||||
|
||||
def PadTopOff(number):
|
||||
msg= [CONTROLLER_CHANGE, LaunchTop[number-1], 0]
|
||||
midi3.send(msg,"Launchpad")
|
||||
PadTops[number-1]=0
|
||||
|
||||
def PadRightOn(number,color):
|
||||
msg= [NOTE_ON, LaunchRight[number-1], color]
|
||||
midi3.send(msg,"Launchpad")
|
||||
PadRights[number-1]=color
|
||||
|
||||
def PadRightOff(number):
|
||||
msg= [NOTE_OFF, LaunchRight[number-1], 0]
|
||||
midi3.send(msg,"Launchpad")
|
||||
PadRights[number-1]=0
|
||||
|
||||
def TopUpdate(button,color):
|
||||
#print(PadTop)
|
||||
PadTop = [0,0,0,0,0,0,0,0]
|
||||
PadTop[button] = color
|
||||
for pad in range(7):
|
||||
PadTopOn(pad+1,PadTop[pad])
|
||||
|
||||
def RightUpdate():
|
||||
for pad in range(9):
|
||||
PadRightOn(pad,PadRight[pad])
|
||||
|
||||
def MatrixUpdate():
|
||||
for pad in range(64):
|
||||
PadNoteOn(pad,PadMatrix[pad])
|
||||
|
||||
def MatrixSelect():
|
||||
MatrixUpdate()
|
||||
return
|
||||
|
||||
def ComputerUpdate(comput):
|
||||
global computer
|
||||
|
||||
computer = comput
|
||||
PadRightOn(computer+1,127)
|
||||
|
||||
|
||||
|
||||
# Client to export buttons actions from Launchpad or bhoreal
|
||||
|
||||
def SendOSC(ip,port,oscaddress,oscargs=''):
|
||||
|
||||
oscmsg = OSCMessage()
|
||||
oscmsg.setAddress(oscaddress)
|
||||
oscmsg.append(oscargs)
|
||||
|
||||
osclient = OSCClient()
|
||||
osclient.connect((ip, port))
|
||||
|
||||
print("sending OSC message : ", oscmsg, "to", ip, ":", port)
|
||||
|
||||
try:
|
||||
osclient.sendto(oscmsg, (ip, port))
|
||||
oscmsg.clearData()
|
||||
return True
|
||||
except:
|
||||
print ('Connection to', ip, 'refused : died ?')
|
||||
return False
|
||||
|
||||
|
||||
#
|
||||
# LaunchPad start anim
|
||||
#
|
||||
|
||||
# AllColor for bhoreal on given port
|
||||
def AllColorPad(color):
|
||||
|
||||
for led in range(0,64,1):
|
||||
PadNoteOn(led,color)
|
||||
'''
|
||||
for line in LaunchLedMatrix:
|
||||
for led in line:
|
||||
midiport[port].send_message([NOTE_ON, led, color])
|
||||
'''
|
||||
for rightled in range(8):
|
||||
PadRightOn(rightled+1,color)
|
||||
for topled in range(8):
|
||||
PadTopOn(topled+1,color)
|
||||
#midiport[port].send_message([CONTROLLER_CHANGE, topled, color])
|
||||
|
||||
def ClsMatrix():
|
||||
for led in range(0,64,1):
|
||||
PadNoteOff(led)
|
||||
|
||||
def ClsTop():
|
||||
for topled in range(8):
|
||||
PadTopOff(topled+1)
|
||||
|
||||
def ClsRight():
|
||||
|
||||
for rightled in range(8):
|
||||
PadRightOff(rightled+1)
|
||||
|
||||
def Cls():
|
||||
|
||||
ClsMatrix()
|
||||
ClsTop()
|
||||
ClsRight()
|
||||
ComputerUpdate(computer)
|
||||
|
||||
'''
|
||||
for line in LaunchLedMatrix:
|
||||
for led in line:
|
||||
midiport[port].send_message([NOTE_OFF, led, 0])
|
||||
'''
|
||||
|
||||
def StartLaunchPad(port):
|
||||
|
||||
#ClsPad(port)
|
||||
#time.sleep(0.3)
|
||||
AllColorPad(20)
|
||||
time.sleep(0.6)
|
||||
Cls()
|
||||
time.sleep(0.3)
|
||||
|
||||
#
|
||||
# Events from Launchpad Handling
|
||||
#
|
||||
|
||||
# Process events coming from Launchpad in a separate thread.
|
||||
def MidinProcess(launchqueue):
|
||||
global computer
|
||||
|
||||
while True:
|
||||
launchqueue_get = launchqueue.get
|
||||
msg = launchqueue_get()
|
||||
#print (msg)
|
||||
|
||||
if msg[0]==NOTE_ON:
|
||||
|
||||
(x,y) = PadIndex(msg[1])
|
||||
|
||||
# MATRIX = macros, notes, channels,...
|
||||
if x < 9:
|
||||
msg[1]= BhorNoteXY(x,y)
|
||||
macroname = "m"+str(y)+str(x)
|
||||
# Run Macro with matrix location and velocity
|
||||
Run(macroname, macroargs = int(msg[2]))
|
||||
|
||||
# RIGHT = computer, this host or other computer
|
||||
if x == 9:
|
||||
print("Right Button : ", y)
|
||||
macroname = "r"+str(y)
|
||||
print(macroname)
|
||||
ClsRight()
|
||||
PadRightOn(y,127)
|
||||
print("Destination computer",y)
|
||||
computer = y
|
||||
#time.sleep(0.1)
|
||||
#PadRightOff(y)
|
||||
|
||||
# TOP = Mode Note, CC, Os, Monome,..
|
||||
if msg[0]==CONTROLLER_CHANGE:
|
||||
print("Pad Top Button : ", str(msg[1]-103), "value",msg[2])
|
||||
TopUpdate(msg[1]-104,20)
|
||||
macroname = "t"+str(msg[1]-103)
|
||||
#print(macroname)
|
||||
Run(macroname, macroargs = (msg[1]-103,msg[2]))
|
||||
|
||||
|
||||
launchqueue = Queue()
|
||||
ModeCallback = "ModeNo"
|
||||
|
||||
|
||||
|
||||
# LaunchPad Mini call back : new msg forwarded to Launchpad queue
|
||||
class LaunchAddQueue(object):
|
||||
def __init__(self, port):
|
||||
self.port = port
|
||||
#print("LaunchAddQueue", self.port)
|
||||
self._wallclock = time.time()
|
||||
|
||||
def __call__(self, event, data=None):
|
||||
message, deltatime = event
|
||||
self._wallclock += deltatime
|
||||
print()
|
||||
print("[%s] @%0.6f %r" % (self.port, self._wallclock, message))
|
||||
launchqueue.put(message)
|
||||
|
||||
#
|
||||
# Modes : Top lines functions
|
||||
#
|
||||
|
||||
# Load Matrix only macros (for the moment) in macros.json
|
||||
def LoadMacros():
|
||||
global macros
|
||||
|
||||
print()
|
||||
print("Loading Launchpad Macros...")
|
||||
f=open("macros.json","r")
|
||||
s = f.read()
|
||||
macros = json.loads(s)
|
||||
print(len(macros['OS']),"Macros")
|
||||
print("Loaded.")
|
||||
|
||||
|
||||
# return macroname number for given type 'OS', 'Maxwell'
|
||||
def findMacros(macroname,macrotype):
|
||||
|
||||
#print("searching", macroname,'...')
|
||||
position = -1
|
||||
for counter in range(len(macros[macrotype])):
|
||||
#print (counter,macros[macrotype][counter]['name'],macros[macrotype][counter]['code'])
|
||||
if macroname == macros[macrotype][counter]['name']:
|
||||
#print(macroname, "is ", counter)
|
||||
position = counter
|
||||
return position
|
||||
|
||||
|
||||
# Default top buttons : maxwell macros
|
||||
def TopMacro(arg):
|
||||
|
||||
topbutton, value = arg
|
||||
print ("topmacro", topbutton, "value", value)
|
||||
if value == 127:
|
||||
TopUpdate(topbutton-1,20)
|
||||
Disp("Ma")
|
||||
Disp('cr', 'bhoreal')
|
||||
ModeCallback = TopCallback
|
||||
|
||||
def TopCallback(arg):
|
||||
|
||||
ClsMatrix()
|
||||
x,y,velocity = arg
|
||||
PadNoteOnXY(x,y,20)
|
||||
#print ('Macros OS', BhorNoteXY(x,y), "velocity", velocity )
|
||||
macroname = 'm'+str(y)+str(x)
|
||||
macronumber = findMacros(macroname,'Maxwell')
|
||||
if macronumber != -1:
|
||||
#print("code : ",macros['OS'][macronumber]["code"])
|
||||
eval(macros['Maxwell'][macronumber]["code"])
|
||||
else:
|
||||
print("no Code yet")
|
||||
|
||||
#
|
||||
# Notes Macros
|
||||
#
|
||||
|
||||
def ModeNote(arg):
|
||||
global ModeCallback
|
||||
|
||||
|
||||
topbutton, value = arg
|
||||
if value == 127:
|
||||
TopUpdate(topbutton-1,20)
|
||||
Disp("No")
|
||||
Disp('te', 'bhoreal')
|
||||
print("ModeNote")
|
||||
|
||||
else:
|
||||
ClsMatrix()
|
||||
|
||||
ModeCallback = "NoteCallback"
|
||||
|
||||
|
||||
def NoteCallback(arg):
|
||||
|
||||
#ClsMatrix()
|
||||
x,y,velocity = arg
|
||||
notename = midi3.midi2note(BhorNoteXY(x,y))
|
||||
|
||||
print('computer',computer)
|
||||
|
||||
# todo : decide whether its 0 or 1 !!!
|
||||
if computer == 0 or computer == 1:
|
||||
midi3.NoteOn(BhorNoteXY(x,y),velocity,'AutoTonic MIDI In')
|
||||
else:
|
||||
SendOSC(computerIP[computer-1],maxwellatorPort,'/note',[BhorNoteXY(x,y),velocity])
|
||||
|
||||
if velocity == 127:
|
||||
PadNoteOnXY(x,y,20)
|
||||
#print ('NoteON', BhorNoteXY(x,y),notename , "velocity", velocity )
|
||||
#Disp(notename)
|
||||
else:
|
||||
PadNoteOnXY(x,y,0)
|
||||
#print ('NoteOFF', BhorNoteXY(x,y),notename , "velocity", velocity )
|
||||
|
||||
#
|
||||
# CC Macros
|
||||
#
|
||||
|
||||
def ModeCC(arg):
|
||||
global ModeCallback
|
||||
|
||||
topbutton, value = arg
|
||||
if value == 127:
|
||||
TopUpdate(topbutton-1,20)
|
||||
Disp('CC')
|
||||
Disp(' ', 'bhoreal')
|
||||
print("Mode CC")
|
||||
ModeCallback = "CCSelect"
|
||||
print("Please enter CC Channel")
|
||||
#ClsMatrix()
|
||||
Disp('Ch')
|
||||
|
||||
def CCSelect(arg):
|
||||
global ModeCallback, CChannel
|
||||
|
||||
x,y, velocity = arg
|
||||
PadNoteOnXY(x,y,20)
|
||||
#print ('in CC channel callback x',x,'y',y)
|
||||
if velocity == 127:
|
||||
|
||||
CChannel = BhorNoteXY(x,y)
|
||||
print("CC Channel", CChannel)
|
||||
print("Please enter CC Value")
|
||||
ModeCallback = "CCValue"
|
||||
Disp('Va')
|
||||
|
||||
def CCValue(arg):
|
||||
#ClsMatrix()
|
||||
x,y, velocity = arg
|
||||
PadNoteOnXY(x,y,20)
|
||||
#print ('in CC value callback x',x,'y',y)
|
||||
|
||||
if velocity == 127:
|
||||
CCvalue = BhorNoteXY(x,y) * 2
|
||||
print("CC Channel", CChannel,"CC Value", CCvalue)
|
||||
|
||||
|
||||
#
|
||||
# OS Macros
|
||||
#
|
||||
|
||||
def ModeOS(arg):
|
||||
global ModeCallback
|
||||
|
||||
topbutton, value = arg
|
||||
if value == 127:
|
||||
Disp('Os')
|
||||
Disp('Ma', 'bhoreal')
|
||||
TopUpdate(topbutton-1,20)
|
||||
ModeCallback = "OSCallback"
|
||||
else:
|
||||
ClsMatrix()
|
||||
|
||||
def OSCallback(arg):
|
||||
|
||||
ClsMatrix()
|
||||
x,y,velocity = arg
|
||||
PadNoteOnXY(x,y,20)
|
||||
#print ('Macros OS', BhorNoteXY(x,y), "velocity", velocity )
|
||||
macroname = 'm'+str(y)+str(x)
|
||||
macronumber = findMacros(macroname,'OS')
|
||||
if macronumber != -1:
|
||||
#print("code : ",macros['OS'][macronumber]["code"])
|
||||
eval(macros['OS'][macronumber]["code"])
|
||||
else:
|
||||
print("no Code yet")
|
||||
|
||||
|
||||
#
|
||||
# Monome emulation
|
||||
#
|
||||
|
||||
prefix = '/box'
|
||||
|
||||
def ModeMonome(arg):
|
||||
global ModeCallback
|
||||
|
||||
topbutton, value = arg
|
||||
if value == 127:
|
||||
TopUpdate(topbutton-1,20)
|
||||
Disp('Mo')
|
||||
Disp('me', 'bhoreal')
|
||||
ModeCallback = "MonomeCallback"
|
||||
|
||||
else:
|
||||
ClsMatrix()
|
||||
|
||||
|
||||
def MonomeCallback(arg):
|
||||
|
||||
ClsMatrix()
|
||||
x,y,velocity = arg
|
||||
#PadNoteOnXY(x,y,20)
|
||||
|
||||
SendOSC('127.0.0.1', monomePort, prefix+'/press', (x,y,1))
|
||||
SendOSC('127.0.0.1', monomePort, prefix+'/grid/key', (x,y,1))
|
||||
|
||||
|
||||
#
|
||||
# StartMode
|
||||
#
|
||||
|
||||
def ModeNo(arg):
|
||||
x,y,velocity = arg
|
||||
PadNoteOnXY(x,y,20)
|
||||
print ('Mode No x',x,'y',y,"note", PadNoteXY(x,y))
|
||||
|
||||
'''
|
||||
def Mode(mode):
|
||||
global macros
|
||||
|
||||
|
||||
if mode == "maxwell":
|
||||
print("Launchpad in Maxwell mode")
|
||||
macros = maxwellmacros.buttons
|
||||
|
||||
if mode == "generic":
|
||||
print("Launchpad in generic mode")
|
||||
macros = generic
|
||||
'''
|
||||
|
||||
|
||||
#
|
||||
# Right column functions
|
||||
#
|
||||
|
||||
def RightMacro(number):
|
||||
|
||||
print ("rightmacro",number)
|
||||
|
||||
#
|
||||
# Default Pad macros
|
||||
#
|
||||
|
||||
|
||||
launchmacros = {
|
||||
|
||||
"t": {"command": TopMacro, "default": -1},
|
||||
"t1": {"command": ModeNote, "default": ''},
|
||||
"t2": {"command": ModeCC, "default": ''},
|
||||
"t3": {"command": ModeOS, "default": ''},
|
||||
"t4": {"command": ModeMonome, "default": ''},
|
||||
"t5": {"command": TopMacro, "default": 5},
|
||||
"t6": {"command": TopMacro, "default": 6},
|
||||
"t7": {"command": TopMacro, "default": 7},
|
||||
"t8": {"command": TopMacro, "default": 8},
|
||||
|
||||
"r1": {"command": RightMacro, "default": 1},
|
||||
"r2": {"command": RightMacro, "default": 2},
|
||||
"r3": {"command": RightMacro, "default": 3},
|
||||
"r4": {"command": RightMacro, "default": 4},
|
||||
"r5": {"command": RightMacro, "default": 5},
|
||||
"r6": {"command": RightMacro, "default": 6},
|
||||
"r7": {"command": RightMacro, "default": 7},
|
||||
"r8": {"command": RightMacro, "default": 8}
|
||||
}
|
||||
|
||||
#Mode("generic")
|
||||
|
||||
|
||||
def Run(macroname, macroargs=''):
|
||||
|
||||
#print ("macroargs", macroargs)
|
||||
|
||||
# Matrix button -> parameters sent to current Function in ModeCallback
|
||||
if macroname.find("m") == 0:
|
||||
doit = eval(ModeCallback)
|
||||
doit((int(macroname[2]),int(macroname[1]), macroargs))
|
||||
#eval(ModeCallback)((int(macroname[2]),int(macroname[1]), macroargs),)
|
||||
|
||||
|
||||
# Otherwise do the macro
|
||||
else:
|
||||
|
||||
doit = launchmacros[macroname]["command"]
|
||||
if macroargs=='':
|
||||
macroargs = launchmacros[macroname]["default"]
|
||||
#print("Running", doit, "with args", macroargs )
|
||||
doit(macroargs)
|
||||
|
||||
#ComputerUpdate(computer)
|
||||
LoadMacros()
|
||||
|
||||
|
||||
'''
|
||||
|
||||
Docs Community About
|
||||
monome
|
||||
osc : opensound control / serialosc protocol
|
||||
|
||||
what is serialosc? how does it work?
|
||||
discovering and connecting to serialosc devices
|
||||
|
||||
serialosc server listens on port 12002.
|
||||
|
||||
when devices are connected, serialosc spawns new ports for each device. querying the server allows you to discover the port number for each device. (this supersedes the zeroconf method, which is still in place for legacy compatibility).
|
||||
messages sent to serialosc server
|
||||
|
||||
/serialosc/list si <host> <port>
|
||||
|
||||
request a list of the currently connected devices, sent to host:port
|
||||
|
||||
/serialosc/notify si <host> <port>
|
||||
|
||||
request that next device change (connect/disconnect) is sent to host:port. to keep receiving the notifications, send another message to /serialosc/notify from the notify handler.
|
||||
messages received from serialosc server
|
||||
|
||||
/serialosc/device ssi <id> <type> <port>
|
||||
|
||||
currently connected device id and type, at this port
|
||||
|
||||
/serialosc/add s <id>
|
||||
|
||||
device added
|
||||
|
||||
/serialosc/remove s <id>
|
||||
|
||||
device removed
|
||||
to serialosc device
|
||||
sys
|
||||
|
||||
these messages can be sent to a serialosc device to change settings.
|
||||
|
||||
/sys/port i <port>
|
||||
|
||||
change computer port
|
||||
|
||||
/sys/host s <host>
|
||||
|
||||
change computer host
|
||||
|
||||
/sys/prefix s <prefix>
|
||||
|
||||
change message prefix (filtering)
|
||||
|
||||
/sys/rotation i <degrees>
|
||||
|
||||
rotate the monome by degrees, where degrees is one of 0, 90, 180, 270. this replaces /cable
|
||||
|
||||
/sys/info si <host> <port>
|
||||
|
||||
/sys/info i <port>
|
||||
|
||||
/sys/info
|
||||
|
||||
info
|
||||
|
||||
request information (settings) about this device
|
||||
|
||||
/info can take the following arguments:
|
||||
|
||||
/info si <host> <port> (send /sys/info messages to host:port)
|
||||
|
||||
/info i <port> (send to localhost:port)
|
||||
|
||||
/info (send to current computer application's host:port)
|
||||
|
||||
example:
|
||||
|
||||
to serialosc:
|
||||
/sys/info localhost 9999
|
||||
from serialosc to localhost:9999:
|
||||
/sys/id m0000045
|
||||
/sys/size 8 16
|
||||
/sys/host localhost
|
||||
/sys/port 23849
|
||||
/sys/prefix /nubs
|
||||
/sys/rotation 270
|
||||
|
||||
from serialosc
|
||||
|
||||
these messages are sent from serialosc to the computer port.
|
||||
|
||||
the messages below are sent after a /sys/info request is received.
|
||||
sys
|
||||
|
||||
/sys/port i report computer port
|
||||
|
||||
/sys/host s report computer host
|
||||
|
||||
/sys/id s report device id
|
||||
|
||||
/sys/prefix s report prefix
|
||||
|
||||
/sys/rotation i report grid device rotation
|
||||
|
||||
/sys/size ii report grid device size
|
||||
|
||||
to device
|
||||
grid
|
||||
|
||||
/grid/led/set x y s
|
||||
|
||||
set led at (x,y) to state s (0 or 1).
|
||||
|
||||
/grid/led/all s
|
||||
|
||||
set all leds to state s (0 or 1).
|
||||
|
||||
/grid/led/map x_offset y_offset s[8]
|
||||
|
||||
Set a quad (8×8, 64 buttons) in a single message.
|
||||
|
||||
Each number in the list is a bitmask of the buttons in a row, one number in the list for each row. The message will fail if the list doesn’t have 8 entries plus offsets.
|
||||
|
||||
taken apart:
|
||||
|
||||
(/grid/led/map) <- the message/route
|
||||
(8 8) <- the offsets
|
||||
(1 2 4 8 16 32 64 128) <- the bitmasks for each row
|
||||
|
||||
examples
|
||||
|
||||
/grid/led/map 0 0 4 4 4 4 8 8 8 8
|
||||
/grid/led/map 0 0 254 253 125 247 239 36 191 4
|
||||
|
||||
Offsets must be mutliples of 8.
|
||||
|
||||
/grid/led/row x_offset y s[..]
|
||||
|
||||
Set a row in a quad in a single message.
|
||||
|
||||
Each number in the list is a bitmask of the buttons in a row, one number in the list for each row being updated.
|
||||
|
||||
examples (for 256)
|
||||
|
||||
/grid/led/row 0 0 255 255
|
||||
/grid/led/row 8 5 255
|
||||
|
||||
examples (for 64)
|
||||
|
||||
/grid/led/row 0 0 232
|
||||
/grid/led/row 0 3 129
|
||||
|
||||
Offsets must be mutliples of 8. Offsets for monome64 should always be zero.
|
||||
|
||||
/grid/led/col x y_offset s[..]
|
||||
|
||||
Set a column in a quad in a single message.
|
||||
|
||||
Each number in the list is a bitmask of the buttons in a column, one number in the list for each row being updated.
|
||||
|
||||
examples (for 256)
|
||||
|
||||
/grid/led/col 0 0 255 255 (updates quads 1 and 3)
|
||||
/grid/led/col 13 8 255 (updates quad 4 due to offset.)
|
||||
|
||||
examples (for 64)
|
||||
|
||||
/grid/led/col 0 0 232
|
||||
/grid/led/col 6 0 155
|
||||
|
||||
Offsets must be mutliples of 8. Offsets for monome64 should always be zero.
|
||||
|
||||
/grid/led/intensity i
|
||||
|
||||
variable brightness:
|
||||
|
||||
Valid values for ‘l’ below are in the range [0, 15].
|
||||
|
||||
January 2011 devices only support four intensity levels (off + 3 brightness levels). The value passed in /level/ messages will be “rounded down” to the lowest available intensity as below:
|
||||
|
||||
[0, 3] - off
|
||||
[4, 7] - low intensity
|
||||
[8, 11] - medium intensity
|
||||
[12, 15] - high intensity
|
||||
|
||||
June 2012 devices allow the full 16 intensity levels.
|
||||
|
||||
/grid/led/level/set x y l
|
||||
/grid/led/level/all l
|
||||
/grid/led/level/map x_off y_off l[64]
|
||||
/grid/led/level/row x_off y l[..]
|
||||
/grid/led/level/col x y_off l[..]
|
||||
|
||||
tilt
|
||||
|
||||
/tilt/set n s
|
||||
|
||||
set active state of tilt sensor n to s (0 or 1, 1 = active, 0 = inactive).
|
||||
arc
|
||||
|
||||
led 0 is north. clockwise increases led number. These can be viewed and tested in the browser at http://nomeist.com/osc/arc/
|
||||
|
||||
/ring/set n x l
|
||||
|
||||
set led x (0-63) on encoder n (0-1 or 0-3) to level l (0-15)
|
||||
|
||||
/ring/all n l
|
||||
|
||||
set all leds on encoder n (0-1 or 0-3) to level l (0-15)
|
||||
|
||||
/ring/map n l[64]
|
||||
|
||||
set all leds on encoder n (0-1 or 0-3) to 64 member array l[64]
|
||||
|
||||
/ring/range n x1 x2 l
|
||||
|
||||
set leds on encoder n (0-1 or 0-3) between (inclusive) x1 and x3 to level l (0-15). direction of set is always clockwise, with wrapping.
|
||||
from device
|
||||
grid
|
||||
|
||||
/grid/key x y s
|
||||
|
||||
key state change at (x,y) to s (0 or 1, 1 = key down, 0 = key up).
|
||||
tilt
|
||||
|
||||
/tilt n x y z
|
||||
|
||||
position change on tilt sensor n, integer (8-bit) values (x, y, z)
|
||||
arc
|
||||
|
||||
/enc/delta n d
|
||||
|
||||
position change on encoder n by value d (signed). clockwise is positive.
|
||||
|
||||
/enc/key n s
|
||||
|
||||
key state change on encoder n to s (0 or 1, 1 = key down, 0 = key up)
|
||||
|
||||
Info@monome.org
|
||||
|
||||
'''
|
Binary file not shown.
359
libs/lj.py
359
libs/lj.py
|
@ -1,359 +0,0 @@
|
|||
# coding=UTF-8
|
||||
|
||||
'''
|
||||
|
||||
lj v0.7.5 for LJ v0.8+
|
||||
|
||||
Some LJ functions useful for python 2.7 clients
|
||||
Functions and documentation here is low priority as python 2 support will stop soon.
|
||||
Better code your plugin with python 3 and lj3.py.
|
||||
|
||||
|
||||
Config
|
||||
PolyLineOneColor
|
||||
rPolyLineOneColor
|
||||
Text
|
||||
SendLJ : remote control
|
||||
LjClient :
|
||||
LjPl :
|
||||
DrawPL
|
||||
WebStatus
|
||||
|
||||
LICENCE : CC
|
||||
Sam Neurohack
|
||||
|
||||
'''
|
||||
|
||||
import math
|
||||
import redis
|
||||
from OSC import OSCServer, OSCClient, OSCMessage
|
||||
|
||||
print "Importing lj from libs..."
|
||||
#redisIP = '127.0.0.1'
|
||||
#r = redis.StrictRedis(host=redisIP, port=6379, db=0)
|
||||
|
||||
ClientNumber = 0
|
||||
name = "noname"
|
||||
oscrun = True
|
||||
point_list = []
|
||||
pl = [[],[],[],[]]
|
||||
|
||||
|
||||
|
||||
def SendLJ(oscaddress,oscargs=''):
|
||||
|
||||
oscmsg = OSCMessage()
|
||||
oscmsg.setAddress(oscaddress)
|
||||
oscmsg.append(oscargs)
|
||||
|
||||
osclientlj = OSCClient()
|
||||
osclientlj.connect((redisIP, 8002))
|
||||
|
||||
print "lj is sending OSC message : ",oscmsg, "to",redisIP,":8002"
|
||||
try:
|
||||
osclientlj.sendto(oscmsg, (redisIP, 8002))
|
||||
oscmsg.clearData()
|
||||
except:
|
||||
print ('Connection to LJ refused : died ?')
|
||||
pass
|
||||
#time.sleep(0.001
|
||||
|
||||
def WebStatus(message):
|
||||
SendLJ("/status", message)
|
||||
|
||||
|
||||
ASCII_GRAPHICS = [
|
||||
|
||||
#implementé
|
||||
|
||||
[(-50,30), (-30,-30), (30,-30), (10,30), (-50,30)], #0
|
||||
[(-20,30), (0,-30), (-20,30)], #1
|
||||
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], #2
|
||||
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #3
|
||||
[(30,10), (-30,10), (0,-30), (0,30)], #4
|
||||
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], #5
|
||||
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], #6
|
||||
[(-30,-30), (30,-30), (-30,30)], #7
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30), (-30,0), (30,0)], #8
|
||||
[(30,0), (-30,0), (-30,-10), (0,-30), (30,-30), (30,10), (0,30), (-30,30)], #9
|
||||
|
||||
# A implementer
|
||||
[(-30,10), (30,-10), (30,10), (0,30), (-30,10), (-30,-10), (0,-30), (30,-10)], #:
|
||||
[(-30,-10), (0,-30), (0,30)], [(-30,30), (30,30)], #;
|
||||
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], #<
|
||||
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #=
|
||||
[(30,10), (-30,10), (0,-30), (0,30)], #>
|
||||
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], #?
|
||||
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], #@
|
||||
|
||||
# Implementé
|
||||
|
||||
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], #A
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], #A
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30), (-30,0), (30,0)], #B
|
||||
[(30,30), (-30,30), (-30,-30), (30,-30)], #C
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30)], #D
|
||||
[(30,30), (-30,30), (-30,-0), (30,0), (-30,0), (-30,-30), (30,-30)], #E
|
||||
[(-30,30), (-30,-0), (30,0), (-30,0), (-30,-30), (30,-30)], #F
|
||||
[(0,0), (30,0), (30,30), (-30,30), (-30,-30),(30,-30)], #G
|
||||
[(-30,-30), (-30,30), (-30,0), (30,0), (30,30), (30,-30)], #H
|
||||
[(0,30), (0,-30)], #I
|
||||
[(-30,30), (0,-30), (0,-30), (-30,-30), (30,-30)], #J
|
||||
[(-30,-30), (-30,30), (-30,0), (30,-30), (-30,0), (30,30)], #K
|
||||
[(30,30), (-30,30), (-30,-30)], #L
|
||||
[(-30,30), (-30,-30), (0,0), (30,-30), (30,30)], #M
|
||||
[(-30,30), (-30,-30), (30,30), (30,-30)], #N
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (-30,30)], #O
|
||||
[(-30,0), (30,0), (30,-30), (-30,-30), (-30,30)], #P
|
||||
[(30,30), (30,-30), (-30,-30), (-30,30), (30,30),(35,35)], #Q
|
||||
[(-30,30), (-30,-30), (30,-30), (30,0), (-30,0), (30,30)], #R
|
||||
[(30,-30), (-30,-30), (-30,0), (30,0), (30,30), (-30,30)], #S
|
||||
[(0,30), (0,-30), (-30,-30), (30,-30)], #T
|
||||
[(-30,-30), (-30,30), (30,30), (30,-30)], #U
|
||||
[(-30,-30), (0,30), (30,-30)], #V
|
||||
[(-30,-30), (-30,30), (0,0), (30,30), (30,-30)], #W
|
||||
[(-30,30), (30,-30)], [(-30,-30), (30,30)], #X
|
||||
[(0,30), (0,0), (30,-30), (0,0), (-30,-30)], #Y
|
||||
[(30,30), (-30,30), (30,-30), (-30,-30)], #Z
|
||||
|
||||
# A implementer
|
||||
|
||||
[(-30,-10), (0,-30), (0,30)], [(-30,30), (30,30)], #[
|
||||
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], #\
|
||||
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #]
|
||||
[(30,10), (-30,10), (0,-30), (0,30)], #^
|
||||
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], #_
|
||||
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], #`
|
||||
|
||||
# Implementé
|
||||
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], #a
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20), (-20,0), (20,0)], #b
|
||||
[(20,20), (-20,20), (-20,-20), (20,-20)], #c
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], #d
|
||||
[(20,20), (-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], #e
|
||||
[(-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], #f
|
||||
[(0,0), (20,0), (20,20), (-20,20), (-20,-20),(20,-20)], #g
|
||||
[(-20,-20), (-20,20), (-20,0), (20,0), (20,20), (20,-20)], #H
|
||||
[(0,20), (0,-20)], #I
|
||||
[(-20,20), (0,-20), (0,-20), (-20,-20), (20,-20)], #J
|
||||
[(-20,-20), (-20,20), (-20,0), (20,-20), (-20,0), (20,20)], #K
|
||||
[(20,20), (-20,20), (-20,-20)], #L
|
||||
[(-20,20), (-20,-20), (0,0), (20,-20), (20,20)], #M
|
||||
[(-20,20), (-20,-20), (20,20), (20,-20)], #N
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], #O
|
||||
[(-20,0), (20,0), (20,-20), (-20,-20), (-20,20)], #P
|
||||
[(20,20), (20,-20), (-20,-20), (-20,20), (20,20),(25,25)], #Q
|
||||
[(-20,20), (-20,-20), (20,-20), (20,0), (-20,0), (20,20)], #R
|
||||
[(20,-20), (-20,-20), (-20,0), (20,0), (20,20), (-20,20)], #S
|
||||
[(0,20), (0,-20), (-20,-20), (20,-20)], #T
|
||||
[(-20,-20), (-20,20), (20,20), (20,-20)], #U
|
||||
[(-20,-20), (0,20), (20,-20)], #V
|
||||
[(-20,-20), (-20,20), (0,0), (20,20), (20,-20)], #W
|
||||
[(-20,20), (20,-20)], [(-20,-20), (20,20)], #X
|
||||
[(0,20), (0,0), (20,-20), (0,0), (-20,-20)], #Y
|
||||
[(20,20), (-20,20), (20,-20), (-20,-20)], #Z
|
||||
|
||||
[(-2,15), (2,15)] # Point a la place de {
|
||||
]
|
||||
|
||||
def Config(redIP,client,myname):
|
||||
global ClientNumber, name, redisIP
|
||||
|
||||
redisIP = redIP
|
||||
r = redis.StrictRedis(host=redisIP, port=6379, db=0)
|
||||
ClientNumber = client
|
||||
#print "client configured",ClientNumber
|
||||
name = myname
|
||||
print "Plugin declare its name",name
|
||||
|
||||
|
||||
def LjClient(client):
|
||||
global ClientNumber
|
||||
|
||||
ClientNumber = client
|
||||
|
||||
def LjPl(pl):
|
||||
global PL
|
||||
|
||||
PL = pl
|
||||
|
||||
|
||||
|
||||
# Answer to LJ pings with /pong value
|
||||
def OSCping(path, tags, args, source):
|
||||
print name,"got /ping from LJ -> reply /pong", name
|
||||
SendLJ("/pong",name)
|
||||
|
||||
|
||||
|
||||
# Closing plugin messages to LJ
|
||||
def ClosePlugin():
|
||||
WebStatus(name+" Exiting")
|
||||
SendLJ("/"+name+"/start",0)
|
||||
|
||||
|
||||
# /quit
|
||||
def OSCquit(path, tags, args, source):
|
||||
global oscrun
|
||||
|
||||
oscrun = False
|
||||
print('lj got /quit for',name)
|
||||
#WebStatus(name + " quit.")
|
||||
#SendLJ("/"+name+"/start",0)
|
||||
#print("Stopping OSC...")
|
||||
#OSCstop()
|
||||
#sys.exit()
|
||||
|
||||
|
||||
def LineTo(xy, c, PL):
|
||||
|
||||
pl[PL].append((xy + (c,)))
|
||||
|
||||
def Line(xy1, xy2, c, PL):
|
||||
LineTo(xy1, 0, PL)
|
||||
LineTo(xy2, c , PL)
|
||||
|
||||
|
||||
def PolyLineOneColor(xy_list, c, PL , closed ):
|
||||
#print "--"
|
||||
#print "c",c
|
||||
#print "xy_list",xy_list
|
||||
#print "--"
|
||||
xy0 = None
|
||||
for xy in xy_list:
|
||||
if xy0 is None:
|
||||
xy0 = xy
|
||||
#print "xy0:",xy0
|
||||
LineTo(xy0,0, PL)
|
||||
LineTo(xy0,c, PL)
|
||||
else:
|
||||
#print "xy:",xy
|
||||
LineTo(xy,c, PL)
|
||||
if closed:
|
||||
LineTo(xy0,c, PL)
|
||||
|
||||
|
||||
# Computing points coordinates for rPolyline function from 3D and around 0,0 to pygame coordinates
|
||||
def Pointransf(xy, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
x = xy[0] * resize
|
||||
y = xy[1] * resize
|
||||
z = 0
|
||||
|
||||
rad = math.radians(rotx)
|
||||
cosaX = math.cos(rad)
|
||||
sinaX = math.sin(rad)
|
||||
|
||||
y2 = y
|
||||
y = y2 * cosaX - z * sinaX
|
||||
z = y2 * sinaX + z * cosaX
|
||||
|
||||
rad = math.radians(roty)
|
||||
cosaY = math.cos(rad)
|
||||
sinaY = math.sin(rad)
|
||||
|
||||
z2 = z
|
||||
z = z2 * cosaY - x * sinaY
|
||||
x = z2 * sinaY + x * cosaY
|
||||
|
||||
rad = math.radians(rotz)
|
||||
cosZ = math.cos(rad)
|
||||
sinZ = math.sin(rad)
|
||||
|
||||
x2 = x
|
||||
x = x2 * cosZ - y * sinZ
|
||||
y = x2 * sinZ + y * cosZ
|
||||
|
||||
#print xy, (x + xpos,y+ ypos)
|
||||
return (x + xpos,y+ ypos)
|
||||
'''
|
||||
to understand why it get negative Y
|
||||
|
||||
# 3D to 2D projection
|
||||
factor = 4 * gstt.cc[22] / ((gstt.cc[21] * 8) + z)
|
||||
print xy, (x * factor + xpos, - y * factor + ypos )
|
||||
return (x * factor + xpos, - y * factor + ypos )
|
||||
'''
|
||||
|
||||
# Send 2D point list around 0,0 with 3D rotation resizing and reposition around xpos ypos
|
||||
#def rPolyLineOneColor(self, xy_list, c, PL , closed, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
||||
def rPolyLineOneColor(xy_list, c, PL , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
xy0 = None
|
||||
for xy in xy_list:
|
||||
if xy0 is None:
|
||||
xy0 = xy
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),0, PL)
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),c, PL)
|
||||
else:
|
||||
LineTo(Pointransf(xy, xpos, ypos, resize, rotx, roty, rotz),c, PL)
|
||||
if closed:
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),c, PL)
|
||||
|
||||
|
||||
def LinesPL(PL):
|
||||
print "Stupido !! your code is to old : use DrawPL() instead of LinesPL()"
|
||||
DrawPL(PL)
|
||||
|
||||
|
||||
def DrawPL(PL):
|
||||
#print '/pl/0/'+str(PL), str(pl[PL])
|
||||
if r.set('/pl/'+str(ClientNumber)+'/'+str(PL), str(pl[PL])) == True:
|
||||
#print '/pl/'+str(ClientNumber)+'/'+str(PL), str(pl[PL])
|
||||
pl[PL] = []
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def ResetPL(self, PL):
|
||||
pl[PL] = []
|
||||
|
||||
|
||||
|
||||
def DigitsDots(number,color):
|
||||
dots =[]
|
||||
for dot in ASCII_GRAPHICS[number]:
|
||||
#print dot
|
||||
dots.append((gstt.xy_center[0]+dot[0],gstt.xy_center[1]+dot[1],color))
|
||||
#self.point_list.append((xy + (c,)))
|
||||
return dots
|
||||
|
||||
def CharDots(char,color):
|
||||
|
||||
dots =[]
|
||||
for dot in ASCII_GRAPHICS[ord(char)-46]:
|
||||
dots.append((dot[0],dot[1],color))
|
||||
return dots
|
||||
|
||||
def Text(message,c, PL, xpos, ypos, resize, rotx, roty, rotz):
|
||||
|
||||
dots =[]
|
||||
|
||||
l = len(message)
|
||||
i= 0
|
||||
#print message
|
||||
|
||||
for ch in message:
|
||||
|
||||
#print ""
|
||||
# texte centre en x automatiquement selon le nombre de lettres l
|
||||
x_offset = 26 * (- (0.9*l) + 3*i)
|
||||
# Digits
|
||||
if ord(ch)<58:
|
||||
char_pl_list = ASCII_GRAPHICS[ord(ch) - 48]
|
||||
else:
|
||||
char_pl_list = ASCII_GRAPHICS[ord(ch) - 46]
|
||||
char_draw = []
|
||||
#dots.append((char_pl_list[0][0] + x_offset,char_pl_list[0][1],0))
|
||||
|
||||
for xy in char_pl_list:
|
||||
char_draw.append((xy[0] + x_offset,xy[1],c))
|
||||
i +=1
|
||||
#print ch,char_pl_list,char_draw
|
||||
rPolyLineOneColor(char_draw, c, PL , False, xpos, ypos, resize, rotx, roty, rotz)
|
||||
#dots.append(char_draw)
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,669 +0,0 @@
|
|||
{
|
||||
"ccs": [
|
||||
{
|
||||
"_comment": "Oscillator LEFT X Functions",
|
||||
"Function": "/osc/left/X/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/X/freq",
|
||||
"init": "1"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/X/freqlimit",
|
||||
"init": "127"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/X/amp",
|
||||
"init": "100"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/X/amplimit",
|
||||
"init": "constant"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/X/phasemod",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/X/phasemodlimit",
|
||||
"init": "linear"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/X/phaseoffset",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/X/phaseoffsetlimit",
|
||||
"init": "manual"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/X/ampoffset",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/X/ampoffsetlimit",
|
||||
"init": "manual"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/osc/left/X/inversion",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Oscillator LEFT Y Functions",
|
||||
"Function": "/osc/left/Y/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Y/freq",
|
||||
"init": "1"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Y/freqlimit",
|
||||
"init": "127"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Y/amp",
|
||||
"init": "100"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Y/amplimit",
|
||||
"init": "constant"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Y/phasemod",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Y/phasemodlimit",
|
||||
"init": "linear"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Y/phaseoffset",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Y/phaseoffsetlimit",
|
||||
"init": "manual"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Y/ampoffset",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Y/ampoffsetlimit",
|
||||
"init": "manual"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/osc/left/Y/inversion",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Oscillator LEFT Z Functions",
|
||||
"Function": "/osc/left/Z/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Z/freq",
|
||||
"init": "1"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Z/freqlimit",
|
||||
"init": "127"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Z/amp",
|
||||
"init": "100"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Z/amplimit",
|
||||
"init": "constant"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Z/phasemod",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Z/phasemodlimit",
|
||||
"init": "linear"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Z/phaseoffset",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Z/phaseoffsetlimit",
|
||||
"init": "manual"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Z/ampoffset",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/left/Z/ampoffsetlimit",
|
||||
"init": "manual"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/osc/left/Z/inversion",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Oscillator RIGHT X Functions",
|
||||
"Function": "/osc/right/X/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/X/freq",
|
||||
"init": "1"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/X/freqlimit",
|
||||
"init": "127"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/X/amp",
|
||||
"init": "100"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/X/amplimit",
|
||||
"init": "constant"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/X/phasemod",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/X/phasemodlimit",
|
||||
"init": "linear"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/X/phaseoffset",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/X/phaseoffsetlimit",
|
||||
"init": "manual"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/X/ampoffset",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/X/ampoffsetlimit",
|
||||
"init": "manual"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/osc/right/X/inversion",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Oscillator RIGHT Y Functions",
|
||||
"Function": "/osc/right/Y/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Y/freq",
|
||||
"init": "1"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Y/freqlimit",
|
||||
"init": "127"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Y/amp",
|
||||
"init": "100"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Y/amplimit",
|
||||
"init": "constant"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Y/phasemod",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Y/phasemodlimit",
|
||||
"init": "linear"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Y/phaseoffset",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Y/phaseoffsetlimit",
|
||||
"init": "manual"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Y/ampoffset",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Y/ampoffsetlimit",
|
||||
"init": "manual"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/osc/right/Y/inversion",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Oscillator RIGHT Z Functions",
|
||||
"Function": "/osc/right/Z/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Z/freq",
|
||||
"init": "1"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Z/freqlimit",
|
||||
"init": "127"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Z/amp",
|
||||
"init": "100"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Z/amplimit",
|
||||
"init": "constant"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Z/phasemod",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Z/phasemodlimit",
|
||||
"init": "linear"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Z/phaseoffset",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Z/phaseoffsetlimit",
|
||||
"init": "manual"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Z/ampoffset",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/osc/right/Z/ampoffsetlimit",
|
||||
"init": "manual"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/osc/right/Z/inversion",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "LFO 1 Functions",
|
||||
"Function": "/lfo/1/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/lfo/1/freq",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/lfo/1/freqlimit",
|
||||
"init": "127"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/lfo/1/phase",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/lfo/1/inversion",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "LFO 2 Functions",
|
||||
"Function": "/lfo/2/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/lfo/2/freq",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/lfo/2/freqlimit",
|
||||
"init": "127"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/lfo/2/phase",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/lfo/2/inversion",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "LFO 3 Functions",
|
||||
"Function": "/lfo/3/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/lfo/3/freq",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/lfo/3/freqlimit",
|
||||
"init": "127"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/lfo/3/phase",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/lfo/3/inversion",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Duplicator Functions",
|
||||
"Function": "/duplicator/num",
|
||||
"init": "0"
|
||||
},
|
||||
{
|
||||
"Function": "/duplicator/offset",
|
||||
"init": "0"
|
||||
},
|
||||
|
||||
{
|
||||
"_comment": "Mixer Functions",
|
||||
"Function": "/mixer/operation",
|
||||
"init": "+"
|
||||
},
|
||||
{
|
||||
"Function": "/mixer/value",
|
||||
"init": "0"
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Intensity Functions",
|
||||
"Function": "/intensity/mod",
|
||||
"init": "0"
|
||||
},
|
||||
{
|
||||
"Function": "/intensity/freq",
|
||||
"init": "0"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Scaler Functions",
|
||||
"Function": "/scaler/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/scaler/speed",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/scaler/switch",
|
||||
"init": "off"
|
||||
},
|
||||
{
|
||||
"Function": "/scaler/width",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/scaler/amt",
|
||||
"init": "64"
|
||||
},
|
||||
{
|
||||
"Function": "/scaler/scale",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Rotator X Functions",
|
||||
"Function": "/rotator/X/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/rotator/X/speed",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/rotator/X/lfo/switch",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/rotator/X/direct",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Rotator Y Functions",
|
||||
"Function": "/rotator/Y/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/rotator/Y/speed",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/rotator/Y/lfo/switch",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/rotator/Y/direct",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Rotator Z Functions",
|
||||
"Function": "/rotator/Z/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/rotator/Z/speed",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/rotator/Z/lfo/switch",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/rotator/Z/direct",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Translator X Functions",
|
||||
"Function": "/translator/X/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/translator/X/speed",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/translator/X/lfo/switch",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/translator/X/amt",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Translator Y Functions",
|
||||
"Function": "/translator/Y/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/translator/Y/speed",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/translator/Y/lfo/switch",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/translator/Y/amt",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Translator Z Functions",
|
||||
"Function": "/translator/Z/curvetype",
|
||||
"init": "sin"
|
||||
},
|
||||
{
|
||||
"Function": "/translator/Z/speed",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/translator/Z/lfo/switch",
|
||||
"init": "off"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/translator/Z/amt",
|
||||
"init": "64"
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_comment": "Colors Functions",
|
||||
"Function": "/color/colortype",
|
||||
"init": "solid"
|
||||
},
|
||||
{
|
||||
"Function": "/color/huewidth",
|
||||
"init": "0"
|
||||
},
|
||||
{
|
||||
"Function": "/color/hueoff",
|
||||
"init": "0"
|
||||
},
|
||||
{
|
||||
"Function": "/color/huemod",
|
||||
"init": "0"
|
||||
},
|
||||
{
|
||||
"Function": "/color/huerot",
|
||||
"init": "0"
|
||||
},
|
||||
{
|
||||
"Function": "/color/intwidth",
|
||||
"init": "0"
|
||||
},
|
||||
{
|
||||
"Function": "/color/intoff",
|
||||
"init": "0"
|
||||
},
|
||||
{
|
||||
"Function": "/color/intmod",
|
||||
"init": "0"
|
||||
},
|
||||
{
|
||||
"Function": "/color/intfreq",
|
||||
"init": "0"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/color/satwidth",
|
||||
"init": "0"
|
||||
},
|
||||
|
||||
{
|
||||
"Function": "/color/satmod",
|
||||
"init": "0"
|
||||
},
|
||||
{
|
||||
"Function": "/color/saturation",
|
||||
"init": "127"
|
||||
},
|
||||
{
|
||||
"Function": "/color/modtype",
|
||||
"init": "sin"
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
}
|
BIN
libs/midi.pyc
BIN
libs/midi.pyc
Binary file not shown.
BIN
libs/plugins.pyc
BIN
libs/plugins.pyc
Binary file not shown.
Binary file not shown.
BIN
libs/tracer.pyc
BIN
libs/tracer.pyc
Binary file not shown.
|
@ -36,25 +36,30 @@ from rtmidi.midiconstants import (CHANNEL_PRESSURE, CONTROLLER_CHANGE, NOTE_ON,
|
|||
from mido import MidiFile
|
||||
import mido
|
||||
import sys
|
||||
import midi3, launchpad
|
||||
import os
|
||||
ljpath = r'%s' % os.getcwd().replace('\\','/')
|
||||
|
||||
from . import midi3, launchpad
|
||||
#import midimacros, maxwellmacros
|
||||
import traceback
|
||||
|
||||
from queue import Queue
|
||||
#from libs import macros
|
||||
import json, subprocess
|
||||
from OSC3 import OSCServer, OSCClient, OSCMessage
|
||||
from .OSC3 import OSCServer, OSCClient, OSCMessage
|
||||
import socket
|
||||
|
||||
print('LPD8 startup...')
|
||||
myHostName = socket.gethostname()
|
||||
print("Name of the localhost is {}".format(myHostName))
|
||||
myIP = socket.gethostbyname(myHostName)
|
||||
print("IP address of the localhost is {}".format(myIP))
|
||||
|
||||
myIP = "127.0.0.1"
|
||||
|
||||
print('Used IP', myIP)
|
||||
print('LPD8 startup...')
|
||||
myHostName = socket.gethostname()
|
||||
print(("Name of the localhost is {}".format(myHostName)))
|
||||
#myIP = socket.gethostbyname(myHostName)
|
||||
print(("IP address of the localhost is {}".format(myIP)))
|
||||
|
||||
|
||||
print(('Used IP', myIP))
|
||||
OSCinPort = 8080
|
||||
maxwellatorPort = 8090
|
||||
|
||||
|
@ -104,14 +109,14 @@ def SendOSC(ip,port,oscaddress,oscargs=''):
|
|||
osclient = OSCClient()
|
||||
osclient.connect((ip, port))
|
||||
|
||||
print("sending OSC message : ", oscmsg, "to", ip, ":", port)
|
||||
print(("sending OSC message : ", oscmsg, "to", ip, ":", port))
|
||||
|
||||
try:
|
||||
osclient.sendto(oscmsg, (ip, port))
|
||||
oscmsg.clearData()
|
||||
return True
|
||||
except:
|
||||
print ('Connection to', ip, 'refused : died ?')
|
||||
print(('Connection to', ip, 'refused : died ?'))
|
||||
return False
|
||||
|
||||
|
||||
|
@ -146,16 +151,16 @@ def MidinProcess(LPD8queue):
|
|||
# Program Change button selected : change destination computer
|
||||
if msg[0]==PROGRAM_CHANGE:
|
||||
|
||||
print("Program change : ", str(msg[1]))
|
||||
print(("Program change : ", str(msg[1])))
|
||||
# Change destination computer mode
|
||||
print("Destination computer",int(msg[1]))
|
||||
print(("Destination computer",int(msg[1])))
|
||||
computer = int(msg[1])
|
||||
|
||||
|
||||
# CC rotary -> midi CC.
|
||||
if msg[0] == CONTROLLER_CHANGE:
|
||||
|
||||
print("CC :", msg[1], msg[2])
|
||||
print(("CC :", msg[1], msg[2]))
|
||||
|
||||
if computer == 0 or computer == 1:
|
||||
cc(int(msg[1]), int(msg[2]))
|
||||
|
@ -170,7 +175,7 @@ def MidinProcess(LPD8queue):
|
|||
def ModeNote(note, velocity, mididest):
|
||||
|
||||
|
||||
print('computer',computer)
|
||||
print(('computer',computer))
|
||||
|
||||
# todo : decide whether its 0 or 1 !!!
|
||||
if computer == 0 or computer == 1:
|
||||
|
@ -218,7 +223,7 @@ class LPD8AddQueue(object):
|
|||
message, deltatime = event
|
||||
self._wallclock += deltatime
|
||||
print()
|
||||
print("[%s] @%0.6f %r" % (self.port, self._wallclock, message))
|
||||
print(("[%s] @%0.6f %r" % (self.port, self._wallclock, message)))
|
||||
LPD8queue.put(message)
|
||||
|
||||
#
|
||||
|
@ -231,10 +236,18 @@ def LoadMacros():
|
|||
|
||||
print()
|
||||
print("Loading LPD8 Macros...")
|
||||
f=open("macros.json","r")
|
||||
|
||||
if os.path.exists('libs/matrix.json'):
|
||||
#print('File libs/matrix.json exits')
|
||||
f=open("libs/matrix.json","r")
|
||||
|
||||
elif os.path.exists(ljpath+'/../../libs/matrix.json'):
|
||||
#print('File '+ljpath+'/../../libs/matrix.json exits')
|
||||
f=open(ljpath+"/../../libs/matrix.json","r")
|
||||
|
||||
s = f.read()
|
||||
macros = json.loads(s)
|
||||
print(len(macros['OS']),"Macros")
|
||||
print((len(macros['OS']),"Macros"))
|
||||
print("Loaded.")
|
||||
|
||||
|
||||
|
@ -255,7 +268,7 @@ def findMacros(macroname,macrotype):
|
|||
# Not assigned buttons
|
||||
def DefaultMacro(arg):
|
||||
|
||||
print ("DefaultMacro", arg)
|
||||
print(("DefaultMacro", arg))
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,212 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
|
||||
'''
|
||||
OSCcom for jamidi v0.1b
|
||||
|
||||
OSCom.Start(serverIP, OSCPORT)
|
||||
default handler : handler(path, tags, args, source)
|
||||
register particular OSC command in Start(): i.e oscserver.addMsgHandler( "/n", Note)
|
||||
|
||||
Launch
|
||||
|
||||
print("Launching OSC Server", serverIP,':', OSCPORT)
|
||||
OSCom.Start(serverIP, OSCPORT)
|
||||
|
||||
'''
|
||||
|
||||
from . import midi3
|
||||
|
||||
#import socket
|
||||
import types, json
|
||||
from .OSC3 import OSCServer, OSCClient, OSCMessage
|
||||
import _thread, time
|
||||
from . import gstt
|
||||
import WScom, UDPcom
|
||||
from . import midi3
|
||||
|
||||
#base36 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
|
||||
|
||||
|
||||
def GetTime():
|
||||
return time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())
|
||||
|
||||
# this method of reporting timeouts only works by convention
|
||||
# that before calling handle_request() field .timed_out is
|
||||
# set to False
|
||||
def handle_timeout(self):
|
||||
self.timed_out = True
|
||||
|
||||
|
||||
def Start(serverIP, OSCPORT):
|
||||
global oscserver
|
||||
|
||||
#print(GetTime(),gstt.oscname, gstt.Confs[gstt.oscname][0]["midichan"])
|
||||
#print(gstt.Confs)
|
||||
#print(gstt.Confs[gstt.oscname])
|
||||
for i in range(len(gstt.Confs[gstt.oscname])):
|
||||
print((GetTime(),gstt.oscname, gstt.Confs[gstt.oscname][i]["midichan"]))
|
||||
|
||||
oscserver = OSCServer( (serverIP, OSCPORT) )
|
||||
oscserver.timeout = 0
|
||||
# funny python's way to add a method to an instance of a class
|
||||
import types
|
||||
oscserver.handle_timeout = types.MethodType(handle_timeout, oscserver)
|
||||
|
||||
oscserver.addMsgHandler( "default", handler )
|
||||
oscserver.addMsgHandler( "/n", Note)
|
||||
oscserver.addMsgHandler( "/c", CC)
|
||||
oscserver.addMsgHandler( "/p", PB)
|
||||
_thread.start_new_thread(osc_thread, ())
|
||||
|
||||
|
||||
# RAW OSC Frame available ?
|
||||
def OSCframe():
|
||||
# clear timed_out flag
|
||||
oscserver.timed_out = False
|
||||
# handle all pending requests then return
|
||||
while not oscserver.timed_out:
|
||||
oscserver.handle_request()
|
||||
|
||||
|
||||
|
||||
|
||||
# OSC server Thread : handler, dacs reports and simulator points sender to UI.
|
||||
def osc_thread():
|
||||
|
||||
|
||||
#print("osc Thread launched")
|
||||
try:
|
||||
while True:
|
||||
|
||||
time.sleep(0.005)
|
||||
OSCframe()
|
||||
|
||||
except Exception as e:
|
||||
import sys, traceback
|
||||
print('\n---------------------')
|
||||
print(('Exception: %s' % e))
|
||||
print('- - - - - - - - - - -')
|
||||
traceback.print_tb(sys.exc_info()[2])
|
||||
print("\n")
|
||||
|
||||
|
||||
|
||||
|
||||
# Properly close the system. Todo
|
||||
def Stop():
|
||||
oscserver.close()
|
||||
|
||||
|
||||
# default handler
|
||||
def handler(path, tags, args, source):
|
||||
|
||||
oscaddress = ''.join(path.split("/"))
|
||||
print()
|
||||
print(("Jamidi Default OSC Handler got from " + str(source[0]),"OSC msg", path, "args", args))
|
||||
#print("OSC address", path)
|
||||
#print("find.. /bhoreal ?", path.find('/bhoreal'))
|
||||
if len(args) > 0:
|
||||
#print("with args", args)
|
||||
pass
|
||||
|
||||
'''
|
||||
# for example
|
||||
if path == '/truc':
|
||||
arg1 = args[0]
|
||||
arg2 = args[1])
|
||||
'''
|
||||
|
||||
'''
|
||||
MIDI NOTES
|
||||
=n in ORCA
|
||||
/n in OSC
|
||||
ORCA OSC
|
||||
=nmonv /n m o n v
|
||||
m : midi channel (0-15 / ORCA 0-F)
|
||||
o : octave (0-8 / ORCA 0-7)
|
||||
n : Note A to G
|
||||
v : velocity 0-Z will output (v/36)*127
|
||||
|
||||
'''
|
||||
def Note(path, tags, args, source):
|
||||
|
||||
#print('Note from ORCA received',args)
|
||||
|
||||
midichannel = int(args[0],36)
|
||||
octave = int(args[1],36)
|
||||
note = args[2]
|
||||
velocity = int((int(args[3],36)/36)*127)
|
||||
|
||||
if note.istitle() == True:
|
||||
notename = str(note)+ str(octave)
|
||||
else:
|
||||
notename = str(note)+ "#"+ str(octave)
|
||||
|
||||
if gstt.debug > 0:
|
||||
print(("incoming note", note, octave, notename, midi3.note2midi(notename) ))
|
||||
|
||||
for mididevice in midi3.findJamDevices(gstt.oscname):
|
||||
midi3.NoteOn(midi3.note2midi(notename), velocity, mididevice)
|
||||
#midi3.NoteOn(int(wspath[1]), int(wspath[2]), gstt.Confs[wscommand[1]][0]["mididevice"])
|
||||
|
||||
|
||||
'''
|
||||
CC
|
||||
=c in ORCA
|
||||
/c in OSC
|
||||
|
||||
ORCA OSC
|
||||
=cmcd /c m n d
|
||||
m : midi channel
|
||||
n : number (0-35 / ORCA 0-Z)
|
||||
d : data 0-Z will output (d/36)*127
|
||||
'''
|
||||
def CC(path, tags, args, source):
|
||||
|
||||
midichannel = int(args[0],36)
|
||||
ccvr = int(args[1],36)
|
||||
ccvl = int((int(args[2],36)/36)*127)
|
||||
|
||||
if gstt.debug > 0:
|
||||
print(("ccvr=%d/ccvl=%d"%(ccvr,ccvl)))
|
||||
if gstt.oscname == "ocs2":
|
||||
gstt.crtvalueOCS2[ccvr]=ccvl
|
||||
else:
|
||||
gstt.crtvalueMMO3[ccvr]=ccvl
|
||||
|
||||
for mididevice in midi3.findJamDevices(gstt.oscname):
|
||||
midi3.cc(gstt.Confs[gstt.oscname][0]["midichan"], ccvr, ccvl, mididevice)
|
||||
|
||||
|
||||
|
||||
def PB(path, tags, args, source):
|
||||
|
||||
#print("Pitch number",ccnumber, value)
|
||||
midichannel = int(args[0])
|
||||
ccnumber = int(args[1])
|
||||
ccdata = int(args[3])
|
||||
|
||||
'''
|
||||
# If needed to send some OSC
|
||||
def SendOSC(ip,port,oscaddress,oscargs=''):
|
||||
|
||||
oscmsg = OSCMessage()
|
||||
oscmsg.setAddress(oscaddress)
|
||||
oscmsg.append(oscargs)
|
||||
|
||||
osclient = OSCClient()
|
||||
osclient.connect((ip, port))
|
||||
|
||||
if gstt.debug == True :
|
||||
print("sending OSC message : ", oscmsg, "to", ip, ":", port)
|
||||
|
||||
try:
|
||||
osclient.sendto(oscmsg, (ip, port))
|
||||
oscmsg.clearData()
|
||||
return True
|
||||
except:
|
||||
print ('Connection to', ip, 'refused : died ?')
|
||||
return False
|
||||
'''
|
|
@ -0,0 +1,107 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
|
||||
'''
|
||||
|
||||
Ableton Link
|
||||
|
||||
LICENCE : CC
|
||||
Sam Neurohack
|
||||
|
||||
|
||||
Get:
|
||||
|
||||
git clone --recursive https://github.com/gonzaloflirt/link-python.git
|
||||
|
||||
Build:
|
||||
|
||||
Make sure python 3 is installed on your system.
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
cmake --build .
|
||||
|
||||
'''
|
||||
import midix
|
||||
import sys
|
||||
|
||||
prevphase = 0
|
||||
bpm = 120
|
||||
|
||||
def Start():
|
||||
global lnk
|
||||
import link
|
||||
|
||||
print("Link ENABLED")
|
||||
lnk = link.Link(120)
|
||||
lnk.enabled = True
|
||||
lnk.startStopSyncEnabled = True
|
||||
linked = True
|
||||
|
||||
|
||||
def BeatEvent():
|
||||
global lnk, prevphase
|
||||
|
||||
|
||||
lnkstr = lnk.captureSessionState()
|
||||
link_time = lnk.clock().micros();
|
||||
tempo_str = '{0:.2f}'.format(lnkstr.tempo())
|
||||
bpm = float(tempo_str)
|
||||
#beatstep.SendOSCUI('/bpm', [bpm])
|
||||
beats_str = '{0:.2f}'.format(lnkstr.beatAtTime(link_time, 0))
|
||||
playing_str = str(lnkstr.isPlaying()) # always False ???
|
||||
phase = lnkstr.phaseAtTime(link_time, 4)
|
||||
|
||||
|
||||
# new beat ?
|
||||
if int(phase) != prevphase:
|
||||
prevphase = int(phase)
|
||||
#print("LINK BPM:",bpm)
|
||||
sys.stdout.write("Beat "+str(beats_str) + ' \r')
|
||||
sys.stdout.flush()
|
||||
midix.SendUI('/beats', [beats_str])
|
||||
|
||||
#alink.SendOSCUI('/states/cc/'+str(ccnumber), [value])
|
||||
currentbeat = float(beats_str)
|
||||
#midix.SendAU('/aurora/beats', beats_str)
|
||||
#AllStatus("Beat "+str(beats_str))
|
||||
|
||||
|
||||
|
||||
# Change current Link Tempo.
|
||||
def newtempo(tempo):
|
||||
global lnk
|
||||
|
||||
#print("val2", val2, "tempo", tempo)
|
||||
|
||||
if linked == True:
|
||||
lnk.enabled = False
|
||||
lnk.startStopSyncEnabled = False
|
||||
lnk = link.Link(tempo)
|
||||
lnk.enabled = True
|
||||
lnk.startStopSyncEnabled = True
|
||||
bpm = tempo
|
||||
print(("New BPM", bpm))
|
||||
midix.SendUI('/bpm', [bpm])
|
||||
|
||||
else:
|
||||
print("Link is disabled")
|
||||
|
||||
|
||||
#
|
||||
def BPMAdj(val1, keyname):
|
||||
|
||||
print((gstt.currentbpm))
|
||||
|
||||
# + 1
|
||||
if val1 == 1:
|
||||
newtempo(gstt.currentbpm+1)
|
||||
|
||||
# -1
|
||||
if val1 == 127 and gstt.currentbpm > 0:
|
||||
newtempo(gstt.currentbpm-1)
|
||||
|
||||
|
||||
|
|
@ -20,6 +20,7 @@ banck change/scene/
|
|||
|
||||
"""
|
||||
|
||||
|
||||
import random
|
||||
import pysimpledmx
|
||||
from serial.tools import list_ports
|
||||
|
@ -32,8 +33,10 @@ from sys import platform, version
|
|||
import sys
|
||||
import argparse, traceback
|
||||
import os
|
||||
import log
|
||||
|
||||
is_py2 = version[0] == '2'
|
||||
|
||||
if is_py2:
|
||||
from OSC import OSCServer, OSCClient, OSCMessage
|
||||
else:
|
||||
|
@ -48,8 +51,7 @@ ljpath = r'%s' % os.getcwd().replace('\\','/')
|
|||
#import from LJ
|
||||
sys.path.append(ljpath +'/libs/')
|
||||
|
||||
import lj23 as lj
|
||||
|
||||
import lj23layers as lj
|
||||
|
||||
#
|
||||
# Init
|
||||
|
@ -73,7 +75,7 @@ for i in range(1,514):
|
|||
|
||||
|
||||
print ("")
|
||||
print ("Artnet v0.1")
|
||||
log.infog("Artnet v0.1")
|
||||
print ("Arguments parsing if needed...")
|
||||
argsparser = argparse.ArgumentParser(description="Artnet & DMX for LJ")
|
||||
argsparser.add_argument("-u","--universe",help="Universe, not implemented (0 by default)",type=int)
|
||||
|
@ -146,7 +148,7 @@ def updateDmxValue(channel, val):
|
|||
# DMX UPDATE!!! WOW!!!
|
||||
if dmxstates[channel] != val:
|
||||
dmxstates[channel] = val
|
||||
print("updating channel", channel, "with ", val )
|
||||
print("updating channel", channel, "with ", val)
|
||||
if mydmx != False:
|
||||
senddmx(channel, ord(val))
|
||||
|
||||
|
@ -155,7 +157,7 @@ def updateDmxValue(channel, val):
|
|||
|
||||
#ljnozoids.WebStatus("Available serial devices")
|
||||
|
||||
print("")
|
||||
|
||||
print("Available serial devices...")
|
||||
ports = list(list_ports.comports())
|
||||
|
||||
|
@ -219,10 +221,10 @@ oscserver.handle_timeout = types.MethodType(handle_timeout, oscserver)
|
|||
def OSChandler(path, tags, args, source):
|
||||
|
||||
oscaddress = ''.join(path.split("/"))
|
||||
print("Default OSC Handler : msg from Client : " + str(source[0]),)
|
||||
print("OSC address", path, "with",)
|
||||
print(("Default OSC Handler : msg from Client : " + str(source[0]),))
|
||||
print(("OSC address", path, "with",))
|
||||
if len(args) > 0:
|
||||
print("args", args)
|
||||
print(("args", args))
|
||||
else:
|
||||
print("noargs")
|
||||
#oscIPout = str(source[0])
|
||||
|
@ -259,15 +261,19 @@ lj.addOSCdefaults(oscserver)
|
|||
lj.SendLJ("/pong", "artnet")
|
||||
lj.WebStatus("Artnet Running...")
|
||||
|
||||
log.infog("Artnet running...")
|
||||
print()
|
||||
|
||||
oscserver.addMsgHandler( "/sendmx", OSCsendmx )
|
||||
|
||||
#
|
||||
# Running...
|
||||
#
|
||||
|
||||
|
||||
'''
|
||||
print ("Starting, use Ctrl+C to stop")
|
||||
print (lj.oscrun)
|
||||
'''
|
||||
|
||||
try:
|
||||
|
||||
|
@ -287,7 +293,7 @@ try:
|
|||
print("OpDmx")
|
||||
continue
|
||||
|
||||
print ("oscrun", lj.oscrun)
|
||||
print(("oscrun", lj.oscrun))
|
||||
protverhi = ord(data[10])
|
||||
protverlo = ord(data[11])
|
||||
sequence = ord(data[12])
|
||||
|
@ -298,9 +304,9 @@ try:
|
|||
length = ord(data[17])
|
||||
dmx = data[18:]
|
||||
|
||||
print (data[0:7], "version :",lhex(data[10])+lhex(data[11]), "sequence :", sequence, "physical", physical, "subuni",subuni,"net", net)
|
||||
print((data[0:7], "version :",lhex(data[10])+lhex(data[11]), "sequence :", sequence, "physical", physical, "subuni",subuni,"net", net))
|
||||
|
||||
for i in xrange(0,510):
|
||||
for i in range(0,510):
|
||||
updateDmxValue(i+1,dmx[i])
|
||||
|
||||
|
|
@ -63,11 +63,11 @@ def list_devices():
|
|||
p = pyaudio.PyAudio()
|
||||
i = 0
|
||||
n = p.get_device_count()
|
||||
print (n,"devices found")
|
||||
print((n,"devices found"))
|
||||
while i < n:
|
||||
dev = p.get_device_info_by_index(i)
|
||||
if dev['maxInputChannels'] > 0:
|
||||
print (str(i)+'. '+dev['name'])
|
||||
print((str(i)+'. '+dev['name']))
|
||||
i += 1
|
||||
|
||||
|
||||
|
@ -83,7 +83,7 @@ def valid_input_devices(self):
|
|||
if len(mics)==0:
|
||||
print("no microphone devices found!")
|
||||
else:
|
||||
print("found %d microphone devices: %s"%(len(mics),mics))
|
||||
print(("found %d microphone devices: %s"%(len(mics),mics)))
|
||||
return mics
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ from /team/laser
|
|||
import time
|
||||
from rtmidi.midiconstants import (CHANNEL_PRESSURE, CONTROLLER_CHANGE, NOTE_ON, NOTE_OFF,
|
||||
PITCH_BEND, POLY_PRESSURE, PROGRAM_CHANGE)
|
||||
import gstt, midi3
|
||||
from . import gstt, midi3
|
||||
import sys
|
||||
|
||||
gstt.BhorLeds = [0]*65
|
||||
|
@ -39,7 +39,7 @@ from queue import Queue
|
|||
|
||||
def NoteOn(note,color):
|
||||
|
||||
print ("bhoreal noteon", note, color)
|
||||
print(("bhoreal noteon", note, color))
|
||||
msg = [NOTE_ON, note, color]
|
||||
midi3.send(msg,"Bhoreal")
|
||||
gstt.BhorLeds[note]=color
|
||||
|
@ -201,7 +201,7 @@ def MidinProcess(bhorqueue):
|
|||
msg = bhorqueue_get()
|
||||
|
||||
# Bhoreal Led pressed
|
||||
print ("Bhoreal Matrix : ", str(msg[1]), gstt.BhorLeds[msg[1]])
|
||||
print(("Bhoreal Matrix : ", str(msg[1]), gstt.BhorLeds[msg[1]]))
|
||||
|
||||
if msg[0] == NOTE_ON and msg[2] == 64:
|
||||
# led
|
||||
|
@ -253,7 +253,7 @@ class AddQueue(object):
|
|||
def __call__(self, event, data=None):
|
||||
message, deltatime = event
|
||||
self._wallclock += deltatime
|
||||
print("[%s] @%0.6f %r" % (self.portname, self._wallclock, message))
|
||||
print(("[%s] @%0.6f %r" % (self.portname, self._wallclock, message)))
|
||||
bhorqueue.put(message)
|
||||
|
||||
'''
|
|
@ -12,11 +12,9 @@ from /team/laser
|
|||
"""
|
||||
|
||||
|
||||
import gstt
|
||||
from libs3 import gstt
|
||||
import argparse
|
||||
|
||||
print "-h will display help"
|
||||
print ""
|
||||
import subprocess
|
||||
|
||||
def handle():
|
||||
|
||||
|
@ -24,7 +22,7 @@ def handle():
|
|||
#have to be done before importing bhorosc.py to get correct port assignment
|
||||
argsparser = argparse.ArgumentParser(description="LJ v0.8")
|
||||
argsparser.add_argument("-r","--redisIP",help="IP address to bind builtin servers (OSC and websocket) also must be the Redis server IP ",type=str)
|
||||
argsparser.add_argument("-L","--Lasers",help="Number of lasers connected (4 by default).",type=int)
|
||||
argsparser.add_argument("-L","--Lasers",help="Number of lasers requested (Autodetected by default).",type=int)
|
||||
argsparser.add_argument("-v","--verbose",help="Debug mode 0,1 or 2 (0 by default)",type=int)
|
||||
argsparser.add_argument("-x","--invx",help="Invert laser 0 X axis again",action="store_true")
|
||||
argsparser.add_argument("-y","--invy",help="Invert laser 0 Y axis again",action="store_true")
|
||||
|
@ -34,6 +32,7 @@ def handle():
|
|||
argsparser.add_argument("-n","--nozoidIP",help="IP for llstr' Nozoid OSC server port 8003 ('127.0.0.1' by default)",type=str)
|
||||
argsparser.add_argument("-b","--bhoroscIP",help="IP for OSC output ('127.0.0.1' by default)",type=str)
|
||||
argsparser.add_argument("-o","--oport",help="OSC output port number (8001 by default)",type=int)
|
||||
argsparser.add_argument("-w","--webui",help="Regen the webui",action="store_true")
|
||||
|
||||
|
||||
|
||||
|
@ -50,6 +49,10 @@ def handle():
|
|||
else:
|
||||
gstt.debug = 0
|
||||
|
||||
# Webui regen
|
||||
if args.webui == True:
|
||||
subprocess.call(['python','webui/build.py'])
|
||||
|
||||
# Ports arguments
|
||||
if args.iport:
|
||||
iport = args.iport
|
||||
|
@ -64,8 +67,8 @@ def handle():
|
|||
oport = gstt.oport
|
||||
|
||||
if gstt.debug > 0:
|
||||
print "Accept OSC on port",gstt.oport
|
||||
print "gstt.iport:",gstt.iport
|
||||
print("Accept OSC on port",gstt.oport)
|
||||
print("gstt.iport:",gstt.iport)
|
||||
|
||||
|
||||
# X Y inversion arguments
|
||||
|
@ -102,15 +105,15 @@ def handle():
|
|||
# Point list number used by simulator
|
||||
if args.display != None:
|
||||
gstt.simuPL = args.display
|
||||
print "Display : " + str(gstt.simuPL)
|
||||
print("Display : " + str(gstt.simuPL))
|
||||
|
||||
|
||||
|
||||
# Lasers = number of laser connected
|
||||
# Lasers = number of laser connected otherwise will be autodetected with one minimum
|
||||
if args.Lasers != None:
|
||||
gstt.LaserNumber = args.Lasers
|
||||
else:
|
||||
gstt.LaserNumber = 4
|
||||
gstt.LaserNumber = -1
|
||||
|
||||
|
||||
if args.bhoroscIP != None:
|
|
@ -6,11 +6,16 @@ v0.7.0
|
|||
|
||||
|
||||
LICENCE : CC
|
||||
by Sam Neurohack, Loloster,
|
||||
by Sam Neurohack, Loloster
|
||||
from /team/laser
|
||||
|
||||
Commands reference. Use commands from websocket (webUI) or OSC, do not set values in redis directly except for /pl.
|
||||
|
||||
DAChecks()
|
||||
UpdateAllwww()
|
||||
|
||||
/forwardui "htmlid args"
|
||||
|
||||
/scale/X/lasernumber value
|
||||
/scale/Y/lasernumber value
|
||||
|
||||
|
@ -38,22 +43,27 @@ lsteps is a string like "[ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]"
|
|||
/swap/X/lasernumber value (0 or 1)
|
||||
/swap/Y/lasernumber value (0 or 1)
|
||||
|
||||
/loffset/X/lasernumber value : change X offset of given laser by value
|
||||
/loffset/X/lasernumber value : change X offset of given laser by value
|
||||
/loffset/Y/lasernumber value : change Y offset of given laser by value
|
||||
|
||||
/order value : instruct tracer what to do.
|
||||
|
||||
/planet will be forwarded to planetarium client.
|
||||
/nozoid will be forwarded to nozoid client.
|
||||
|
||||
/scene/scenenumber/start 0 or 1
|
||||
|
||||
0 : display user pointlist with current client key. See below for client key.
|
||||
1 : pull in redis a new correction matrix (EDH)
|
||||
2 : display black
|
||||
3 : display grid
|
||||
4 : resampler
|
||||
5 : pull in redis a new client key
|
||||
6 : Max Intensity Change = reread redis key /intensity
|
||||
7 : kpps change = reread redis key /kpps
|
||||
8 : color balance change = reread redis keys /red /green /blue
|
||||
|
||||
/planet will be forwarded to planetarium client.
|
||||
/nozoid will be forwarded to nozoid client.
|
||||
|
||||
/scene/scenenumber/start 0 or 1
|
||||
|
||||
/regen : regen webui index html page.
|
||||
|
||||
|
||||
/pl/clientnumber/lasernumber value : value is the pointlist to draw as string type. For string format see code in clients directory.
|
||||
|
@ -78,56 +88,57 @@ Bob could use /pl/2/0 and /pl/2/1 and Lisa could use /pl/2/2 and /pl/2/3.
|
|||
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
import types, time
|
||||
from libs import gstt
|
||||
import redis
|
||||
|
||||
from libs import settings, plugins, homographyp
|
||||
import types, time, socket
|
||||
from libs3 import gstt
|
||||
import redis
|
||||
from libs3 import settings, plugins, homographyp
|
||||
|
||||
|
||||
r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0)
|
||||
#r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0, password='-+F816Y+-')
|
||||
|
||||
GenericCommands = ["start","align","ljclient","scene","addest","deldest","clientnumber","vcvrack","fft","midigen","viewgen","audiogen","noteon","cc","ljpong","ljwars","mouse","emergency","simu","status","run","nozoid","planet","live","words","ai","bank0","pose","lj","cycl","glyph","pong"]
|
||||
|
||||
GenericCommands = ["start","align","ljclient","scene","addest","deldest","dest","clientnumber","vcvrack","fft","mitraille","faceosc","midigen","viewgen","audiogen","noteon","cc","ljpong","ljwars","mouse","emergency","simu","status","run","nozoid","planet","live","words","ai","bank0","pose","lj","cycl","glyph","pong","maxw","custom1","square","regen","trckr","aurora","line1","ForwardUI","settings","debug","pl"]
|
||||
|
||||
|
||||
def UserOn(laser):
|
||||
|
||||
print "User for laser ", laser
|
||||
print("User for laser ", laser)
|
||||
plugins.sendWSall("/status User on laser " + str(laser))
|
||||
r.set('/order/'+str(laser), 0)
|
||||
|
||||
|
||||
def NewEDH(laser):
|
||||
|
||||
print "New EDH requested for laser ", laser
|
||||
print("New EDH requested for laser ", laser)
|
||||
plugins.sendWSall("/status New EDH on laser " + str(laser))
|
||||
settings.Write()
|
||||
print "Settings saving swapX ", gstt.swapX[laser]
|
||||
print "Settings saving swapY ", gstt.swapY[laser]
|
||||
print("Settings saving swapX ", gstt.swapX[laser])
|
||||
print("Settings saving swapY ", gstt.swapY[laser])
|
||||
|
||||
homographyp.newEDH(laser)
|
||||
|
||||
def BlackOn(laser):
|
||||
|
||||
print "Black for laser ", laser
|
||||
print("Black for laser ", laser)
|
||||
plugins.sendWSall("/status Black on laser " + str(laser))
|
||||
r.set('/order/'+str(laser), 2)
|
||||
|
||||
|
||||
def GridOn(laser):
|
||||
|
||||
print "Grid for laser ", laser
|
||||
print("Grid for laser ", laser)
|
||||
plugins.sendWSall("/status Grid on laser " + str(laser))
|
||||
r.set('/order/'+str(laser), 3)
|
||||
|
||||
|
||||
def Resampler(laser,lsteps):
|
||||
def Resampler(laser,args):
|
||||
|
||||
# lsteps is a string like : "[ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]"
|
||||
print "Resampler change for laser ", laser
|
||||
r.set('/resampler/' + str(laser), lsteps)
|
||||
print("Resampler change for laser", laser, "[("+str(args[0])+","+str(args[1])+"),("+str(args[2])+","+str(args[3])+"),("+str(args[4])+","+str(args[5])+"),("+str(args[6])+","+str(args[7])+")]")
|
||||
#r.set('/resampler/' + str(laser), lsteps)
|
||||
r.set('/resampler/' + str(laser), "[("+str(args[0])+","+str(args[1])+"),("+str(args[2])+","+str(args[3])+"),("+str(args[4])+","+str(args[5])+"),("+str(args[6])+","+str(args[7])+")]")
|
||||
r.set('/order/'+str(laser), 4)
|
||||
|
||||
|
||||
|
@ -135,37 +146,37 @@ def LasClientChange(clientnumber):
|
|||
|
||||
if r.get("/pl/"+str(clientnumber)+"/0") != None:
|
||||
|
||||
print "Switching to laser client", clientnumber
|
||||
print("Switching to laser client", clientnumber)
|
||||
gstt.SceneNumber = clientnumber
|
||||
plugins.sendWSall("/status Client " + str(gstt.SceneNumber) + " laser " + str(gstt.Laser))
|
||||
|
||||
r.set('/clientkey', "/pl/"+str(clientnumber)+"/")
|
||||
print "clientkey set to", "/pl/"+str(clientnumber)+"/"
|
||||
for laserid in xrange(0,gstt.LaserNumber):
|
||||
print("clientkey set to", "/pl/"+str(clientnumber)+"/")
|
||||
for laserid in range(0,gstt.LaserNumber):
|
||||
r.set('/order/'+str(laserid), 5)
|
||||
else:
|
||||
print "ERROR : Maximum number of scenes is set to ", gstt.MaxScenes
|
||||
print("ERROR : Maximum number of scenes is set to ", gstt.MaxScenes)
|
||||
|
||||
|
||||
def SceneChange(newscene):
|
||||
|
||||
print "Switching to scene", newscene
|
||||
print("Switching to scene", newscene)
|
||||
gstt.SceneNumber = int(newscene)
|
||||
plugins.sendWSall("/status Scene " + newscene)
|
||||
|
||||
r.set('/clientkey', "/pl/"+ newscene +"/")
|
||||
print "clientkey set to", "/pl/" + newscene + "/"
|
||||
print("clientkey set to", "/pl/" + newscene + "/")
|
||||
|
||||
for laserid in xrange(0,gstt.LaserNumber):
|
||||
for laserid in range(0,gstt.LaserNumber):
|
||||
r.set('/order/'+str(laserid), 5)
|
||||
plugins.sendWSall("/scene/" + str(laserid) + "/start 0")
|
||||
|
||||
plugins.sendWSall("/scene/" + newscene + "/start 1")
|
||||
|
||||
|
||||
|
||||
# Change current laser and send "/scim lasernumber to each plugin"
|
||||
def NoteOn(note):
|
||||
print "NoteOn", note
|
||||
print("NoteOn", note)
|
||||
|
||||
# Change laser client
|
||||
if note < 8:
|
||||
|
@ -174,36 +185,78 @@ def NoteOn(note):
|
|||
# Change PL displayed on webui
|
||||
if note > 23 and note < 32:
|
||||
if note - 24 > gstt.LaserNumber -1:
|
||||
print "Only",gstt.LaserNumber,"lasers asked, you dum ass !"
|
||||
plugins.sendWSall("/status Not Enough Lasers")
|
||||
print("Only",gstt.LaserNumber,"lasers asked, you dum ass !")
|
||||
plugins.sendWSall("/redstatus No Laser"+str(note-24))
|
||||
plugins.sendWSall("/laser "+str(gstt.LaserNumber-1))
|
||||
|
||||
|
||||
else:
|
||||
gstt.Laser = note -24
|
||||
plugins.sendWSall("/status Scene " + str(gstt.SceneNumber) + " laser " + str(gstt.Laser))
|
||||
print "Current Laser switched to", gstt.Laser
|
||||
plugins.sendWSall("/status Laser " + str(gstt.Laser))
|
||||
plugins.SendAll("/scim "+str(gstt.Laser))
|
||||
print("Current Laser switched to", gstt.Laser)
|
||||
|
||||
def Scim(path, tags, args, source):
|
||||
|
||||
laser = int(args[0])
|
||||
print("OSC /scim", laser)
|
||||
|
||||
# Change PL displayed on webui
|
||||
if laser > 23 and laser < 32:
|
||||
if laser - 24 > gstt.LaserNumber -1:
|
||||
print("Only",gstt.LaserNumber,"lasers asked, you dum ass !")
|
||||
plugins.sendWSall("/redstatus No Laser"+str(note-24))
|
||||
plugins.sendWSall("/laser "+str(gstt.LaserNumber-1))
|
||||
|
||||
else:
|
||||
gstt.Laser = laser -24
|
||||
plugins.sendWSall("/status Laser " + str(gstt.Laser))
|
||||
print("Current Laser switched to", gstt.Laser)
|
||||
|
||||
|
||||
def Line1(path, tags, args, source):
|
||||
|
||||
line1 = args[0]
|
||||
print("OSC /line1", line1)
|
||||
plugins.sendWSall("/line1 " +"Fx "+line1)
|
||||
|
||||
|
||||
# forward
|
||||
def ForwardUI(path, tags, args, source):
|
||||
|
||||
line = args[0]
|
||||
print("OSC /forwardui to WebUI :", line)
|
||||
print('from path', path, 'args', args)
|
||||
plugins.sendWSall(line)
|
||||
|
||||
|
||||
def CC(number, value):
|
||||
print "CC", note, value
|
||||
print("CC", note, value)
|
||||
|
||||
|
||||
def Mouse(x1,y1,x2,y2):
|
||||
print "Mouse", x1,y1,x2,y2
|
||||
print("Mouse", x1,y1,x2,y2)
|
||||
|
||||
|
||||
|
||||
def handler(oscpath, args):
|
||||
|
||||
#print ""
|
||||
print("OSC handler in commands.py got /"+ str(oscpath)+ " with args :",args)
|
||||
|
||||
if gstt.debug > 0:
|
||||
print "OSC handler in commands.py got /"+ str(oscpath)+ " with args :",args
|
||||
print("OSC handler in commands.py got /"+ str(oscpath)+ " with args :",args)
|
||||
|
||||
# 2 incoming cases : generic or specific for a given lasernumber :
|
||||
|
||||
|
||||
#
|
||||
# Generic : Commands without a laser number
|
||||
#
|
||||
|
||||
if oscpath[1] in GenericCommands:
|
||||
|
||||
if gstt.debug > 0:
|
||||
print "GenericCommand :",oscpath[1],"with args",args
|
||||
print("GenericCommand :", oscpath[1], "with args", args)
|
||||
|
||||
|
||||
if oscpath[1] == "ljclient":
|
||||
|
@ -211,30 +264,42 @@ def handler(oscpath, args):
|
|||
SceneChange(args[0])
|
||||
|
||||
|
||||
if oscpath[1] == "pl":
|
||||
r.set(oscpath, args[0])
|
||||
|
||||
|
||||
#/scene/scenenumber/start 0 or 1
|
||||
if oscpath[1] == "scene":
|
||||
|
||||
print oscpath[1], oscpath[2], args[0]
|
||||
print(oscpath[1], oscpath[2], args[0])
|
||||
if args[0] == '1' and r.get("/pl/" + oscpath[2] + "/0") != None:
|
||||
SceneChange(oscpath[2])
|
||||
else:
|
||||
print "ERROR : Maximum number of scenes is set to ", gstt.MaxScenes
|
||||
print("ERROR : Maximum number of scenes is set to ", gstt.MaxScenes)
|
||||
|
||||
|
||||
elif oscpath[1] == "noteon":
|
||||
NoteOn(int(args[0]))
|
||||
|
||||
|
||||
# regen index.html (python build.py)
|
||||
elif oscpath[1] == "regen":
|
||||
subprocess.Popen(["python", plugins.ljpath + "/webui/build.py"])
|
||||
|
||||
# todo
|
||||
|
||||
elif oscpath[1] == "CC":
|
||||
CC(int(args[0]), int(args[1]))
|
||||
|
||||
|
||||
elif oscpath[1] == "pong":
|
||||
#print "LJ commands got pong from", args
|
||||
print("/" + args[0] + "/start 1")
|
||||
if gstt.debug >0:
|
||||
print(("/" + args[0] + "/start 1"))
|
||||
print(("/status got pong from "+ args[0] +"."))
|
||||
|
||||
plugins.sendWSall("/" + args[0] + "/start 1")
|
||||
print("/status got pong from "+ args[0] +".")
|
||||
plugins.sendWSall("/status got pong from "+ args[0] +".")
|
||||
#plugins.sendWSall("/status got pong from "+ args[0] +".")
|
||||
|
||||
|
||||
elif oscpath[1] == "vcvrack":
|
||||
|
@ -259,23 +324,71 @@ def handler(oscpath, args):
|
|||
if args[0] == "1":
|
||||
|
||||
for laser in range(gstt.lasernumber):
|
||||
print "Black requested for laser ", laser
|
||||
print("Black requested for laser ", laser)
|
||||
BlackOn(laser)
|
||||
print "EMERGENCY MODE"
|
||||
print("EMERGENCY MODE")
|
||||
plugins.sendWSall("/status EMERGENCY MODE")
|
||||
else:
|
||||
for laser in range(gstt.lasernumber):
|
||||
print "Back to normal for laser ", laser
|
||||
print("Back to normal for laser ", laser)
|
||||
UserOn(laser)
|
||||
|
||||
# Settings commands :
|
||||
elif oscpath[1] == "settings":
|
||||
if oscpath[2] == "lasers":
|
||||
print()
|
||||
print("new laser number",args[0])
|
||||
print()
|
||||
|
||||
if oscpath[2] == "regen":
|
||||
print()
|
||||
print("Regen www pages...")
|
||||
UpdateAllwww()
|
||||
|
||||
if oscpath[2] == "IP":
|
||||
print()
|
||||
print("new server IP for www regen",args[0])
|
||||
gstt.wwwIP = args[0]
|
||||
|
||||
|
||||
if oscpath[2] == "debug":
|
||||
print()
|
||||
print("Debug level",args[0])
|
||||
print()
|
||||
gstt.debug = int(args[0])
|
||||
plugins.SendAll("/debug "+str(gstt.debug))
|
||||
|
||||
|
||||
if oscpath[2] == "rescan":
|
||||
print()
|
||||
print("Rescanning DACs...")
|
||||
DAChecks()
|
||||
print("Done.")
|
||||
|
||||
if oscpath[2] == "rstrt":
|
||||
print()
|
||||
print("Restarting", args[0], "...")
|
||||
if args[0] == "lj":
|
||||
raise Restart(time.asctime())
|
||||
else:
|
||||
plugins.Restart(args[0])
|
||||
print()
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Commands with a laser number
|
||||
else:
|
||||
pathlength = len(oscpath)
|
||||
print("oscpath", oscpath)
|
||||
#
|
||||
|
||||
print("pathlength", pathlength)
|
||||
else:
|
||||
|
||||
pathlength = len(oscpath)
|
||||
if gstt.debug > 0:
|
||||
print("Non Generic Command :", oscpath[1], "with args", args)
|
||||
#print "oscpath", oscpath
|
||||
#print "pathlength", pathlength
|
||||
#print "args", args
|
||||
|
||||
if pathlength == 3:
|
||||
laser = int(oscpath[2])
|
||||
|
@ -283,22 +396,22 @@ def handler(oscpath, args):
|
|||
else:
|
||||
laser = int(oscpath[3])
|
||||
|
||||
print "args[0] :",args[0]," ", type(args[0])
|
||||
#print "args[0] :",args[0]," ", type(args[0])
|
||||
|
||||
# /grid/lasernumber value (0 or 1)
|
||||
if oscpath[1] == "grid":
|
||||
|
||||
if args[0] == "1":
|
||||
print "Grid requested for laser ", laser
|
||||
print("Grid requested for laser ", laser)
|
||||
GridOn(laser)
|
||||
else:
|
||||
print "No grid for laser ", laser
|
||||
print("No grid for laser ", laser)
|
||||
UserOn(laser)
|
||||
|
||||
|
||||
# /ip/lasernumber value
|
||||
if oscpath[1] == "ip":
|
||||
print "New IP for laser ", laser
|
||||
print("New IP for laser ", laser)
|
||||
gstt.lasersIPS[laser]= args[0]
|
||||
settings.Write()
|
||||
|
||||
|
@ -306,76 +419,81 @@ def handler(oscpath, args):
|
|||
# /kpps/lasernumber value
|
||||
# Live change of kpps is not implemented in newdac.py. Change will effect next startup.
|
||||
if oscpath[1] == "kpps":
|
||||
print "New kpps for laser ", laser, " next startup", int(args[0])
|
||||
print("New kpps for laser ", laser, " next startup", int(args[0]))
|
||||
gstt.kpps[laser]= int(args[0])
|
||||
settings.Write()
|
||||
r.set('/kpps/' + str(laser), str(args[0]))
|
||||
r.set('/order/'+str(laser), 7)
|
||||
|
||||
# /angle/lasernumber value
|
||||
if oscpath[1] == "angle":
|
||||
print "New Angle modification for laser ", oscpath[2], ":", float(args[0])
|
||||
print("New Angle modification for laser ", oscpath[2], ":", float(args[0]))
|
||||
gstt.finANGLE[laser] += float(args[0])
|
||||
NewEDH(laser)
|
||||
print "New angle", gstt.finANGLE[laser]
|
||||
print("New angle", gstt.finANGLE[laser])
|
||||
|
||||
# /intens/lasernumber value
|
||||
if oscpath[1] == "intens":
|
||||
print "New intensity requested for laser ", laser, ":", int(args[0])
|
||||
print "Change not implemented yet"
|
||||
print("LJ2 : New intensity requested for laser ", laser, ":", int(args[0]))
|
||||
plugins.sendWSall("/status Intensity " + str(args[0]))
|
||||
r.set('/intensity/' + str(laser), str(args[0]))
|
||||
r.set('/order/'+str(laser), 6)
|
||||
|
||||
|
||||
|
||||
# /resampler/lasernumber lsteps
|
||||
# lsteps is a string like "[ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]"
|
||||
if oscpath[1] == "resampler":
|
||||
Resampler(laser,args[0])
|
||||
#print"resampler with args", args
|
||||
Resampler(laser,args)
|
||||
|
||||
|
||||
# /mouse/lasernumber value (0 or 1)
|
||||
if oscpath[1] == "mouse":
|
||||
|
||||
if args[0] == "1":
|
||||
print "Mouse requested for laser ", oscpath[2]
|
||||
print("Mouse requested for laser ", oscpath[2])
|
||||
gstt.Laser = oscpath[2]
|
||||
else:
|
||||
print "No mouse for laser ", oscpath[2]
|
||||
print("No mouse for laser ", oscpath[2])
|
||||
|
||||
|
||||
# /swap/X/lasernumber value (0 or 1)
|
||||
if oscpath[1] == "swap" and oscpath[2] == "X":
|
||||
|
||||
print "swapX was", gstt.swapX[laser]
|
||||
print("swapX was", gstt.swapX[laser])
|
||||
if args[0] == "0":
|
||||
print "swap X -1 for laser ", laser
|
||||
print("swap X -1 for laser ", laser)
|
||||
gstt.swapX[laser]= -1
|
||||
NewEDH(laser)
|
||||
|
||||
else:
|
||||
print "swap X 1 for laser ", laser
|
||||
print("swap X 1 for laser ", laser)
|
||||
gstt.swapX[laser]= 1
|
||||
NewEDH(laser)
|
||||
|
||||
# /swap/Y/lasernumber value (0 or 1)
|
||||
if oscpath[1] == "swap" and oscpath[2] == "Y":
|
||||
|
||||
print "swapY was", gstt.swapX[laser]
|
||||
print("swapY was", gstt.swapX[laser])
|
||||
if args[0] == "0":
|
||||
print "swap Y -1 for laser ", laser
|
||||
print("swap Y -1 for laser ", laser)
|
||||
gstt.swapY[laser]= -1
|
||||
NewEDH(laser)
|
||||
else:
|
||||
print "swap Y 1 for laser ", laser
|
||||
print("swap Y 1 for laser ", laser)
|
||||
gstt.swapY[laser]= 1
|
||||
NewEDH(laser)
|
||||
|
||||
# /loffset/X/lasernumber value
|
||||
if oscpath[1] == "loffset" and oscpath[2] == "X":
|
||||
print "offset/X laser", laser, "modified to", args[0]
|
||||
print("offset/X laser", laser, "modified to", args[0])
|
||||
gstt.centerX[laser] -= int(args[0])
|
||||
NewEDH(laser)
|
||||
|
||||
# /loffset/Y/lasernumber value
|
||||
if oscpath[1] == "loffset" and oscpath[2] == "Y":
|
||||
print "offset/Y laser", laser, "modified to", args[0]
|
||||
print("offset/Y laser", laser, "modified to", args[0])
|
||||
gstt.centerY[laser] -= int(args[0])
|
||||
NewEDH(laser)
|
||||
|
||||
|
@ -384,16 +502,119 @@ def handler(oscpath, args):
|
|||
if oscpath[1] == "scale" and oscpath[2] == "X":
|
||||
if gstt.zoomX[laser] + int(args[0]) > 0:
|
||||
gstt.zoomX[laser] += int(args[0])
|
||||
print "scale/X laser", laser , "modified to", gstt.zoomX[laser]
|
||||
print("scale/X laser", laser , "modified to", gstt.zoomX[laser])
|
||||
NewEDH(laser)
|
||||
|
||||
# /scale/Y/lasernumber value
|
||||
if oscpath[1] == "scale" and oscpath[2] == "Y":
|
||||
if gstt.zoomY[laser] + int(args[0]) > 0:
|
||||
gstt.zoomY[laser] += int(args[0])
|
||||
print "scale/Y laser", laser, "modified to", gstt.zoomY[laser]
|
||||
print("scale/Y laser", laser, "modified to", gstt.zoomY[laser])
|
||||
NewEDH(laser)
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Different useful codes for some commands
|
||||
#
|
||||
|
||||
def Updatewww(file_name):
|
||||
|
||||
print("updating", file_name)
|
||||
f=open(file_name,"r+")
|
||||
a=f.readlines()
|
||||
|
||||
for line in a:
|
||||
|
||||
if "var LJ = " in line == True:
|
||||
|
||||
p=a.index(line)
|
||||
#so now we have the position of the line which to be modified
|
||||
a[p]=" var LJ = 'ws://"+gstt.wwwIP+":9001/'\n"
|
||||
#print(p, line, a[p])
|
||||
|
||||
f.seek(0)
|
||||
f.truncate() #ersing all data from the file
|
||||
f.close()
|
||||
#so now we have an empty file and we will write the modified content now in the file
|
||||
o=open(file_name,"w")
|
||||
for i in a:
|
||||
o.write(i)
|
||||
o.close()
|
||||
#now the modification is done in the file
|
||||
|
||||
# Change
|
||||
def UpdateAllwww():
|
||||
|
||||
print("Updating all www pages...")
|
||||
Updatewww(gstt.ljpath+"/www/LJ.js")
|
||||
Updatewww(gstt.ljpath+"/www/trckr/trckrcam1.html")
|
||||
Updatewww(gstt.ljpath+"/www/simu.html")
|
||||
Updatewww(gstt.ljpath+"/www/align.html")
|
||||
Updatewww(gstt.ljpath+"/www/gen0.html")
|
||||
Updatewww(gstt.ljpath+"/www/aur0.html")
|
||||
Updatewww(gstt.ljpath+"/www/aur0s.html")
|
||||
Updatewww(gstt.ljpath+"/www/aur1.html")
|
||||
Updatewww(gstt.ljpath+"/www/auralls.html")
|
||||
Updatewww(gstt.ljpath+"/www/index.html")
|
||||
|
||||
|
||||
def isOpen(ip):
|
||||
dacksock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
dacksock.settimeout(1)
|
||||
istate = False
|
||||
try:
|
||||
dacksock.connect((ip, 7765))
|
||||
#s.shutdown(2)
|
||||
istate = True
|
||||
dacksock.shutdown(socket.SHUT_RDWR)
|
||||
except:
|
||||
time.sleep(1)
|
||||
|
||||
finally:
|
||||
|
||||
dacksock.close()
|
||||
return istate
|
||||
|
||||
'''
|
||||
def isconnected(IP):
|
||||
|
||||
ipup = False
|
||||
for i in range(retry):
|
||||
if isOpen(IP, 7765):
|
||||
ipup = True
|
||||
break
|
||||
else:
|
||||
time.sleep(delay)
|
||||
return ipup
|
||||
'''
|
||||
|
||||
# autodetect connected DACs. Will change gstt.LaserNumber. One at least
|
||||
def DAChecks():
|
||||
|
||||
gstt.dacs = [-1, -1, -1, -1]
|
||||
gstt.dacnumber = 0
|
||||
print("Searching DACs...")
|
||||
for dac in range(gstt.maxdacs):
|
||||
|
||||
if isOpen(gstt.lasersIPS[dac]):
|
||||
print("DAC", dac, "at", gstt.lasersIPS[dac], ": UP")
|
||||
gstt.dacs[gstt.dacnumber] = dac
|
||||
gstt.dacnumber +=1
|
||||
|
||||
else:
|
||||
print("DAC", dac, "at", gstt.lasersIPS[dac], ": DOWN")
|
||||
|
||||
|
||||
# At least one.
|
||||
if gstt.dacnumber == 0:
|
||||
gstt.dacs = [0, -1, -1, -1]
|
||||
gstt.dacnumber = 1
|
||||
|
||||
gstt.LaserNumber = gstt.dacnumber
|
||||
|
||||
|
||||
|
||||
'''
|
||||
For reference values of EDH modifier if assign to keyboard keys (was alignp)
|
||||
|
|
@ -11,7 +11,7 @@ from /team/laser
|
|||
|
||||
|
||||
"""
|
||||
import gstt
|
||||
from libs3 import gstt
|
||||
|
||||
def DigitsDots(number,color):
|
||||
dots =[]
|
|
@ -5,10 +5,10 @@ LJ Global state
|
|||
v0.8.0
|
||||
|
||||
**
|
||||
Almost all values here Will be overriden by LJ.conf file data
|
||||
Almost all values here Will be overriden by data in LJ.conf at startup
|
||||
**
|
||||
|
||||
LICENCE : CC
|
||||
LICENCE : CC BY
|
||||
by Sam Neurohack, Loloster, pclf
|
||||
from /team/laser
|
||||
|
||||
|
@ -18,11 +18,12 @@ from /team/laser
|
|||
ConfigName = "LJ.conf"
|
||||
|
||||
debug = 0
|
||||
ljpath=''
|
||||
|
||||
anims= [[],[],[],[]]
|
||||
|
||||
# How many lasers are connected. Different that "currentlaser".
|
||||
LaserNumber = 2
|
||||
# How many lasers are connected. Different that "currentlaser" and "dacnumber" (=autodetected)
|
||||
LaserNumber = -1
|
||||
|
||||
# What laser client to listen at launch
|
||||
SceneNumber = 0
|
||||
|
@ -34,6 +35,7 @@ xy_center = [screen_size[0]/2,screen_size[1]/2]
|
|||
LjayServerIP = '192.168.1.13'
|
||||
oscIPin = '192.168.1.15'
|
||||
nozoscip = '192.168.1.15'
|
||||
wwwIP = '192.168.1.15'
|
||||
|
||||
# gstt.Laser select to what laser modifcation will occur.
|
||||
# Can be changed with /noteon 16-23
|
||||
|
@ -46,11 +48,20 @@ simuPL = 1
|
|||
# gstt.laserIPS.
|
||||
lasersIPS = ['192.168.1.5','192.168.1.6','192.168.1.3','192.168.1.4']
|
||||
|
||||
maxdacs = 4
|
||||
|
||||
# Autodetected by DAChecks() in main3 :
|
||||
# Store connected dacs. Maybe laser 1 in LJ.conf is not connected but Laser 2 is.
|
||||
dacs = [-1, -1, -1, -1]
|
||||
# Actual number of connected DACs
|
||||
dacnumber = 0
|
||||
|
||||
# gstt.kpps stores kpps for each laser.
|
||||
# ** Will be overridden by LJ.conf file values **
|
||||
kpps = [25000,25000,25000,25000]
|
||||
lasertype = ["LOCAL","LOCAL","LOCAL","LOCAL"]
|
||||
intensity = [-1,-1,-1,-1]
|
||||
|
||||
|
||||
# gstt.GridDisplay : if = 1 Curve points actually sent to PL are replaced by a grid
|
||||
GridDisplay = [0,0,0,0]
|
||||
|
@ -71,6 +82,8 @@ lstt_points = [[0], [0], [0], [0]]
|
|||
swapX = [1,1,1,-1]
|
||||
swapY = [1,1,1,-1]
|
||||
|
||||
lsteps = [[],[],[],[]]
|
||||
|
||||
# For glitch art : change position and number of points added by tracer.py
|
||||
# shortline is for distance with next point, shorter than 4000 (in etherdream coordinates)
|
||||
# i.e (0.25,3) means add 3 points at 25% on the line.
|
||||
|
@ -128,3 +141,12 @@ warpdest = [[[ 1. , 0. , 0.],[ 0. , 1. , 0.],[ 0. , 0. , 1.]],
|
|||
[[ 1. , 0. , 0.],[ 0. , 1. , 0.],[ 0. , 0. , 1.]]
|
||||
]
|
||||
|
||||
BeatstepLayer = 1
|
||||
BeatstepLayers = ['XY','Live',"Align","Zregulators"]
|
||||
|
||||
TouchOSCPort = 8101
|
||||
TouchOSCIP = '192.168.2.67' # iPad 1
|
||||
#TouchOSCIP = '192.168.2.156' # iPad mini
|
||||
#TouchOSCIP = '192.168.43.146' # iPad mini @ fuzz
|
||||
#TouchOSCIP = '192.168.151.213' # CCN
|
||||
#TouchOSCIP = '127.0.0.1' # Localhost
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
#!/usr/bin/python2.7
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
|
||||
|
@ -67,7 +66,7 @@ import numpy as np
|
|||
import math
|
||||
from scipy.linalg import svd,lstsq
|
||||
import ast
|
||||
import gstt
|
||||
from libs3 import gstt
|
||||
#from globalVars import xy_center
|
||||
import redis
|
||||
|
||||
|
@ -92,7 +91,7 @@ def find(points1,points2):
|
|||
|
||||
A = np.zeros((3*npoints,9),'float64')
|
||||
|
||||
for i in xrange(npoints):
|
||||
for i in range(npoints):
|
||||
p1i = p1[i]
|
||||
x2i,y2i,w2i = p2[i]
|
||||
xpi = x2i*p1i
|
||||
|
@ -130,7 +129,7 @@ def find_affine(points1,points2):
|
|||
|
||||
A = np.zeros((3*npoints,6),'float64')
|
||||
b = np.zeros((3*npoints,1),'float64')
|
||||
for i in xrange(npoints):
|
||||
for i in range(npoints):
|
||||
p1i = p1[i]
|
||||
x2i,y2i,w2i = p2[i]
|
||||
xpi = x2i*p1i
|
||||
|
@ -163,9 +162,10 @@ def apply(H,points):
|
|||
# Reference points
|
||||
pointsref = np.array([(300.0, 400.0), (500.0, 400.0), (500.0, 200.0), (300.0, 200.0)])
|
||||
|
||||
def EDpoint(mylaser,(pygamex,pygamey)):
|
||||
def EDpoint(mylaser, xxx_todo_changeme):
|
||||
|
||||
#print "current point : ", pygamex, pygamey
|
||||
(pygamex,pygamey) = xxx_todo_changeme
|
||||
XX = pygamex - gstt.xy_center[0]
|
||||
YY = pygamey - gstt.xy_center[1]
|
||||
CosANGLE = math.cos(gstt.finANGLE[mylaser])
|
||||
|
@ -177,15 +177,15 @@ def EDpoint(mylaser,(pygamex,pygamey)):
|
|||
if gstt.debug >1:
|
||||
|
||||
#print "global center :", xy_center
|
||||
print "EDpoint computing..."
|
||||
print "Laser :", mylaser, "center at : ", gstt.centerX[mylaser], gstt.centerY[mylaser]
|
||||
print "Pygame point",pygamex,",",pygamey
|
||||
print("EDpoint computing...")
|
||||
print("Laser :", mylaser, "center at : ", gstt.centerX[mylaser], gstt.centerY[mylaser])
|
||||
print("Pygame point",pygamex,",",pygamey)
|
||||
'''
|
||||
print "swaps : ", (gstt.swapX[mylaser]), str(gstt.swapY[mylaser])
|
||||
print "zooms : ", gstt.zoomX[mylaser], gstt.zoomY[mylaser]
|
||||
print "angles : ", gstt.finANGLE[mylaser]
|
||||
'''
|
||||
print "Result point : ", x * gstt.swapX[mylaser] , y * gstt.swapY[mylaser]
|
||||
print("Result point : ", x * gstt.swapX[mylaser] , y * gstt.swapY[mylaser])
|
||||
return [x * gstt.swapX[mylaser] , y * gstt.swapY[mylaser]]
|
||||
|
||||
'''
|
||||
|
@ -208,7 +208,7 @@ def EDpoint((pygamex,pygamey)):
|
|||
def newEDH(mylaser):
|
||||
|
||||
EDpoints = []
|
||||
for point in xrange(4):
|
||||
for point in range(4):
|
||||
EDpoints.append(EDpoint(mylaser,pointsref[point]))
|
||||
|
||||
# H matrix tansform pygame points in Etherdream system with align and swap correction,
|
||||
|
@ -222,12 +222,12 @@ def newEDH(mylaser):
|
|||
|
||||
# EDH matrix is H x Hwarp
|
||||
#gstt.EDH[mylaser] = np.dot(H,Hwarp)
|
||||
print "Laser",mylaser,"New EDH computed, sending to redis..."
|
||||
print("Tracer", mylaser, ": new EDH computed, sending to redis...")
|
||||
if r.set('/EDH/'+str(mylaser), np.array2string(gstt.EDH[mylaser], separator=',')) == True:
|
||||
r.set('/order/'+str(mylaser), 1)
|
||||
print "New EDH sent."
|
||||
print("New EDH sent.")
|
||||
else:
|
||||
print "New EDH not sent."
|
||||
print("New EDH not sent.")
|
||||
'''
|
||||
# Laser bit 0 = 0 and bit 1 = 1 : New EDH
|
||||
order = r.get('/order')
|
||||
|
@ -238,15 +238,15 @@ def newEDH(mylaser):
|
|||
'''
|
||||
|
||||
if gstt.debug >1:
|
||||
print ""
|
||||
print "laser ", mylaser
|
||||
print "reference points", pointsref
|
||||
print "laser EDpoints :", EDpoints
|
||||
print "-> Computed H :",H
|
||||
print("")
|
||||
print("laser ", mylaser)
|
||||
print("reference points", pointsref)
|
||||
print("laser EDpoints :", EDpoints)
|
||||
print("-> Computed H :",H)
|
||||
#print "warped points coordinates ", gstt.warpdest[mylaser]
|
||||
#print "-> Computed Hwarp", Hwarp
|
||||
#print "laser ", mylaser, "warpd ",ast.literal_eval(gstt.warpdest[gstt.Laser])
|
||||
#print "laser ", mylaser, "Hwarp ", Hwarp
|
||||
#print ""
|
||||
print "-> new EDH :", gstt.EDH[mylaser]
|
||||
print("-> new EDH :", gstt.EDH[mylaser])
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
|
||||
typetext('hello')
|
||||
tap(key)
|
||||
|
||||
Loosely found and reuse in LPHK from nimaid
|
||||
https://github.com/nimaid/LPHK
|
||||
|
||||
mouse functions commented yet
|
||||
|
||||
"""
|
||||
import keyboard
|
||||
# import ms
|
||||
|
||||
media_keys = {"vol_up" : 57392, "vol_down" : 57390, "mute" : 57376, "play_pause" : 57378, "prev_track" : 57360, "next_track" : 57369}
|
||||
#with mouse
|
||||
#media_keys = {"vol_up" : 57392, "vol_down" : 57390, "mute" : 57376, "play_pause" : 57378, "prev_track" : 57360, "next_track" : 57369, "mouse_left" : "mouse_left","mouse_middle" : "mouse_middle", "mouse_right" : "mouse_right"}
|
||||
pressed = set()
|
||||
|
||||
def sp(name):
|
||||
try:
|
||||
return keyboard.key_to_scan_codes(str(name))[0]
|
||||
except:
|
||||
try:
|
||||
return media_keys[str(name)]
|
||||
except:
|
||||
return None
|
||||
|
||||
def press(key):
|
||||
pressed.add(key)
|
||||
if type(key) == str:
|
||||
'''
|
||||
if "mouse_" in key:
|
||||
ms.press(key[6:])
|
||||
return
|
||||
'''
|
||||
keyboard.press(key)
|
||||
|
||||
def release(key):
|
||||
pressed.discard(key)
|
||||
if type(key) == str:
|
||||
'''
|
||||
if "mouse_" in key:
|
||||
ms.release(key[6:])
|
||||
return
|
||||
'''
|
||||
keyboard.release(key)
|
||||
|
||||
def release_all():
|
||||
for key in pressed.copy():
|
||||
release(key)
|
||||
|
||||
def tap(key):
|
||||
if type(key) == str:
|
||||
'''
|
||||
if "mouse_" in key:
|
||||
ms.click(key[6:])
|
||||
return
|
||||
'''
|
||||
press(key)
|
||||
release(key)
|
||||
|
||||
def typetext(name):
|
||||
|
||||
#print(name)
|
||||
for letter in name:
|
||||
#print (letter)
|
||||
tap(letter)
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,34 +1,33 @@
|
|||
# coding=UTF-8
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
|
||||
'''
|
||||
|
||||
lj23 v0.7.6 for LJ v0.8+
|
||||
lj23layers v0.7.6 for LJ v0.8+
|
||||
|
||||
Some LJ functions useful for python clients
|
||||
LJ functions (API) for python plugins/clients
|
||||
|
||||
"layers" version :
|
||||
- "PL" has been replaced by "layer"
|
||||
- "Client"
|
||||
|
||||
Each program using this API to manage complexity, should declare itself by calling Config, but it's not mandatory
|
||||
|
||||
Class management :
|
||||
Config(redisIP, client number, name)
|
||||
|
||||
https://stackoverflow.com/questions/739882/iterating-over-object-instances-of-a-given-class-in-python
|
||||
https://stackoverflow.com/questions/8628123/counting-instances-of-a-class
|
||||
http://effbot.org/pyfaq/how-do-i-get-a-list-of-all-instances-of-a-given-class.htm
|
||||
|
||||
|
||||
|
||||
|
||||
Config(redisIP, client number,name)
|
||||
|
||||
Basic Draw :
|
||||
|
||||
- PolyLineOneColor, rPolyLineOneColor, LineTo, Line
|
||||
- PolyLineRGB, rPolyLineRGB, LineRGBTo, LineRGB
|
||||
- rgb2int(r,g,b)
|
||||
- DrawPL(point list number) : once you stacked all wanted elements, like 2 polylines, send them to lasers.
|
||||
- DrawDests(): Draw all requested destinations for each PL.
|
||||
- Drawlayer (point list number) : once you stacked all wanted elements, like 2 polylines, send them to lasers.
|
||||
- DrawDests(): Draw all requested destinations for each layer .
|
||||
|
||||
High level draw :
|
||||
|
||||
- Text(word, integercolor, PL, xpos, ypos, resize, rotx, roty, rotz) : Display a word
|
||||
- Text(word, integercolor, layer , xpos, ypos, resize, rotx, roty, rotz) : Display a word
|
||||
- TextRGB(word, red, green, blue, ...)
|
||||
- Embeded font1
|
||||
|
||||
|
@ -38,37 +37,51 @@ Laser objects (name and convenient group of parameters for one or several point
|
|||
- RelativeObject
|
||||
- FixedObject
|
||||
|
||||
PL "Destinations" : tells Live what PL to draw and to what scene/Laser ("destination") to send it.
|
||||
"Destinations" : Tell for given Layer a scene/Laser ("destination").
|
||||
Each Layer can have different destination (i.e to display same stuff on different laser)
|
||||
|
||||
|
||||
OSC and plugins functions :
|
||||
|
||||
SendLJ(adress,message) : LJ remote control. See commands.py
|
||||
SendResol(address,message): Send OSC message to Resolume.
|
||||
WebStatus(message) : display message on webui
|
||||
SendLJ(adress,message) LJ remote control. See commands.py
|
||||
SendResol(address,message) Send OSC message to Resolume.
|
||||
WebStatus(message) display message on webui
|
||||
SendIntensity(laser, intensity)
|
||||
Sendkpps(laser, kpps)
|
||||
|
||||
LjClient(client): Change Client number in redis keys
|
||||
LjPl(pl): Change pl number in redis keys = laser target.
|
||||
ClosePlugin(name): Send UI closing info of given plugin
|
||||
Ljscene(client) Change scene number in redis keys
|
||||
Ljlayer(layer) Change layer number in redis keys = laser target.
|
||||
ClosePlugin(name) Send UI closing info of given plugin
|
||||
|
||||
OSCstart(): Start the OSC system.
|
||||
OSCframe(): Handle incoming OSC message. Calling the right callback
|
||||
OSCstop(): Properly close the OSC system
|
||||
OSCping(): /ping Answer to LJ pings by sending /pong name
|
||||
OSCquit(): /quit Exit calling script using name in terminal
|
||||
OSCadddest(): PL, scene, laser Add a destination
|
||||
OSCdeldest(): PL, scene, lasers delete a destination
|
||||
OSCobj(): /name/obj objectname attribute value for automation
|
||||
OSCvar(): /name/var variablename value for automation
|
||||
OSCstart() Start the OSC system.
|
||||
OSCframe() Handle incoming OSC message. Calling the right callback
|
||||
OSCstop() Properly close the OSC system
|
||||
OSCping() /ping Answer to LJ pings by sending /pong name
|
||||
OSCquit() /quit Exit calling script using name in terminal
|
||||
OSCadddest(layer, scene, laser) Add a destination
|
||||
OSCdeldest(layer , scene, laser) Delete a destination
|
||||
OSCobj() /name/obj objectname attribute value for automation
|
||||
OSCvar() /name/var variablename value for automation
|
||||
OSCdebug()
|
||||
|
||||
** Joystick management is removed. Get it back in todolist **
|
||||
|
||||
setup_controls(joystick)
|
||||
|
||||
XboxController : getLeftHori, getLeftVert, getRightHori, getRightVert, getLeftTrigger, getRightTrigger
|
||||
Ps3Controller : getLeftHori, getLeftVert, getRightHori, getRightVert, getLeftTrigger, getRightTrigger, getUp, getDown, getLeft, getRight, getFire1, getFire2(self):
|
||||
MySaitekController : getLeftHori,getLeftVert, getRightHori,getRightVert, getLeftTrigger,getRightTrigger
|
||||
MyThrustController : getLeftHori, getLeftVert, getRightHori, getRightVert, getLeftTrigger, getRightTrigger
|
||||
CSLController : getLeftHori,getLeftVert,getRightHori, getRightVert,getLeftTrigger,getRightTrigger,getFire1,getFire2
|
||||
my USB Joystick : getUp,getDown,getLeft,getRight,etLeftTrigger, getRightTrigger,getFire1, getFire2
|
||||
XboxController getLeftHori, getLeftVert, getRightHori, getRightVert, getLeftTrigger, getRightTrigger
|
||||
Ps3Controller getLeftHori, getLeftVert, getRightHori, getRightVert, getLeftTrigger, getRightTrigger, getUp, getDown, getLeft, getRight, getFire1, getFire2(self):
|
||||
MySaitekController getLeftHori,getLeftVert, getRightHori,getRightVert, getLeftTrigger,getRightTrigger
|
||||
MyThrustController getLeftHori, getLeftVert, getRightHori, getRightVert, getLeftTrigger, getRightTrigger
|
||||
CSLController getLeftHori,getLeftVert,getRightHori, getRightVert,getLeftTrigger,getRightTrigger,getFire1,getFire2
|
||||
my USB Joystick getUp,getDown,getLeft,getRight,etLeftTrigger, getRightTrigger,getFire1, getFire2
|
||||
|
||||
|
||||
|
||||
Class management manuals:
|
||||
|
||||
https://stackoverflow.com/questions/739882/iterating-over-object-instances-of-a-given-class-in-python
|
||||
https://stackoverflow.com/questions/8628123/counting-instances-of-a-class
|
||||
http://effbot.org/pyfaq/how-do-i-get-a-list-of-all-instances-of-a-given-class.htm
|
||||
|
||||
|
||||
LICENCE : CC
|
||||
|
@ -82,6 +95,7 @@ import sys
|
|||
import weakref
|
||||
import struct
|
||||
import numpy as np
|
||||
import gstt
|
||||
from multiprocessing import Process, Queue, TimeoutError
|
||||
|
||||
is_py2 = sys.version[0] == '2'
|
||||
|
@ -100,7 +114,7 @@ ClientNumber = 0
|
|||
name = "noname"
|
||||
oscrun = True
|
||||
point_list = []
|
||||
pl = [[],[],[],[]]
|
||||
layers = [[],[],[],[],[],[],[],[],[],[]]
|
||||
|
||||
fft3Groups = [-1,-1,-1,-1]
|
||||
|
||||
|
@ -109,6 +123,10 @@ Dests = dict()
|
|||
oscIPresol = "127.0.0.1"
|
||||
oscPORTresol = 7000
|
||||
|
||||
# 3D to 2D projection parameters
|
||||
fov = 256
|
||||
viewer_distance = 100
|
||||
|
||||
|
||||
'''
|
||||
|
||||
|
@ -134,7 +152,7 @@ class RelativeObject:
|
|||
kind = 'relative'
|
||||
counter = 0
|
||||
|
||||
def __init__(self, name, active, intensity, xy, color, red, green, blue, PL , closed, xpos , ypos , resize , rotx , roty , rotz):
|
||||
def __init__(self, name, active, intensity, xy, color, red, green, blue, layer , closed, xpos , ypos , resize , rotx , roty , rotz):
|
||||
self.name = name
|
||||
self.active = active # True/False
|
||||
self.intensity = intensity
|
||||
|
@ -143,7 +161,7 @@ class RelativeObject:
|
|||
self.red = red
|
||||
self.green = green
|
||||
self.blue = blue
|
||||
self.PL = PL
|
||||
self.layer = layer
|
||||
self.closed = closed
|
||||
self.xpos = xpos
|
||||
self.ypos = ypos
|
||||
|
@ -165,7 +183,7 @@ class FixedObject:
|
|||
kind = 'fixed'
|
||||
counter = 0
|
||||
|
||||
def __init__(self, name, intensity, active, xy, color, red, green, blue, PL , closed):
|
||||
def __init__(self, name, intensity, active, xy, color, red, green, blue, layer , closed):
|
||||
self.name = name
|
||||
self.active = active # True/False
|
||||
self.intensity = intensity
|
||||
|
@ -174,7 +192,7 @@ class FixedObject:
|
|||
self.red = red
|
||||
self.green = green
|
||||
self.blue = blue
|
||||
self.PL = PL
|
||||
self.layer = layer
|
||||
self.closed = closed
|
||||
|
||||
FixedObject.counter += 1
|
||||
|
@ -202,11 +220,11 @@ class DestObject():
|
|||
# class Destinations(metaclass=IterDest):
|
||||
__metaclass__ = IterDest
|
||||
counter = 0
|
||||
def __init__(self, name, number, active, PL , scene, laser):
|
||||
def __init__(self, name, number, active, layer , scene, laser):
|
||||
self.name = name
|
||||
self.number = number
|
||||
self.active = active
|
||||
self.PL = PL
|
||||
self.layer = layer
|
||||
self.scene = scene
|
||||
self.laser = laser
|
||||
|
||||
|
@ -221,11 +239,11 @@ class DestObject():
|
|||
_instances = set()
|
||||
counter = 0
|
||||
|
||||
def __init__(self, name, number, active, PL , scene, laser):
|
||||
def __init__(self, name, number, active, layer , scene, laser):
|
||||
self.name = name
|
||||
self.number = number
|
||||
self.active = active
|
||||
self.PL = PL
|
||||
self.layer = layer
|
||||
self.scene = scene
|
||||
self.laser = laser
|
||||
self._instances.add(weakref.ref(self))
|
||||
|
@ -258,8 +276,8 @@ def Config(redIP,client,myname):
|
|||
ClientNumber = client
|
||||
#print ("client configured",ClientNumber)
|
||||
name = myname
|
||||
print ("Plugin declare its name",name)
|
||||
#print pl
|
||||
print ("lj23layers : Plugin declare its name :",name)
|
||||
#print layer
|
||||
return r
|
||||
|
||||
|
||||
|
@ -270,10 +288,10 @@ def LjClient(client):
|
|||
|
||||
|
||||
|
||||
def LjPl(pl):
|
||||
global PL
|
||||
def Ljlayer(somelayer):
|
||||
global layer
|
||||
|
||||
PL = pl
|
||||
layer = somelayer
|
||||
|
||||
|
||||
def fromRedis(n):
|
||||
|
@ -322,11 +340,15 @@ def SendLJ(oscaddress,oscargs=''):
|
|||
|
||||
osclientlj = OSCClient()
|
||||
osclientlj.connect((redisIP, 8002))
|
||||
#print("lj23layers for", name, "sending OSC message :", oscmsg, "to", redisIP, ":8002")
|
||||
|
||||
if gstt.debug >0:
|
||||
print("lj23layers for", name, "sending OSC message :", oscmsg, "to", redisIP, ":8002")
|
||||
|
||||
print("lj23 in",name," sending OSC message : ", oscmsg, "to", redisIP, ":8002")
|
||||
try:
|
||||
osclientlj.sendto(oscmsg, (redisIP, 8002))
|
||||
oscmsg.clearData()
|
||||
|
||||
except:
|
||||
print ('Connection to LJ refused : died ?')
|
||||
pass
|
||||
|
@ -347,7 +369,7 @@ def SendResol(oscaddress,oscargs):
|
|||
osclientresol = OSCClient()
|
||||
osclientresol.connect((oscIPresol, oscPORTresol))
|
||||
|
||||
print("lj sending OSC message : ", oscmsg, "to Resolume", oscIPresol, ":", oscPORTresol)
|
||||
print("lj23layers sending OSC message : ", oscmsg, "to Resolume", oscIPresol, ":", oscPORTresol)
|
||||
try:
|
||||
osclientresol.sendto(oscmsg, (oscIPresol, oscPORTresol))
|
||||
oscmsg.clearData()
|
||||
|
@ -356,6 +378,15 @@ def SendResol(oscaddress,oscargs):
|
|||
pass
|
||||
|
||||
|
||||
def SendIntensity(laser, intensity):
|
||||
r.set('/intensity/' + str(laser), str(intensity))
|
||||
r.set('/order/'+str(laser), 6)
|
||||
SendLJ("/kpps/" + str(layer)+ " " + str(int(args[1])))
|
||||
|
||||
|
||||
def Sendkpps(laser, kpps):
|
||||
r.set('/kpps/' + str(laser), str(kpps))
|
||||
r.set('/order/'+str(laser), 7)
|
||||
|
||||
|
||||
def WebStatus(message):
|
||||
|
@ -364,8 +395,8 @@ def WebStatus(message):
|
|||
|
||||
# Closing plugin messages to LJ
|
||||
def ClosePlugin():
|
||||
WebStatus(name+" Exiting")
|
||||
SendLJ("/"+name+"/start",0)
|
||||
WebStatus(name+" Exiting")
|
||||
SendLJ("/"+name+"/start",0)
|
||||
|
||||
|
||||
|
||||
|
@ -382,20 +413,26 @@ def OSCframe():
|
|||
# Answer to LJ pings with /pong value
|
||||
def OSCping(path, tags, args, source):
|
||||
#def OSCping():
|
||||
print(name, "got /ping from LJ -> reply /pong", name)
|
||||
if gstt.debug >0:
|
||||
print(name, "lj23layers got /ping from LJ -> reply /pong", name)
|
||||
SendLJ("/pong",name)
|
||||
|
||||
# Properly close the system. Todo
|
||||
|
||||
# Properly close the system.
|
||||
def OSCstop():
|
||||
oscserver.close()
|
||||
|
||||
# change debug level (0-2)
|
||||
def OSCdebug(path, tags, args, source):
|
||||
print("new debug level", args[0] )
|
||||
gstt.debug = int(args[0])
|
||||
|
||||
# /quit
|
||||
def OSCquit(path, tags, args, source):
|
||||
global oscrun
|
||||
|
||||
oscrun = False
|
||||
print('lj23 got /quit for',name)
|
||||
print('lj23layers got /quit for',name)
|
||||
#WebStatus(name + " quit.")
|
||||
#SendLJ("/"+name+"/start",0)
|
||||
#print("Stopping OSC...")
|
||||
|
@ -407,7 +444,7 @@ def OSCquit(path, tags, args, source):
|
|||
def OSChandler(path, tags, args, source):
|
||||
|
||||
oscaddress = ''.join(path.split("/"))
|
||||
print("Default OSC Handler in",name,": msg from Client : " + str(source[0]),)
|
||||
print("lj23layers Default OSC Handler for",name,": msg from Client :" + str(source[0]),)
|
||||
print("OSC address", path)
|
||||
if len(args) > 0:
|
||||
print("with args", args)
|
||||
|
@ -418,7 +455,7 @@ def OSChandler(path, tags, args, source):
|
|||
|
||||
# for any laser object : /pluginame/obj objectname attribute value
|
||||
# like : /pluginname/obj 'fft' 'xpos' 100
|
||||
# attributes for all lj Objects: name, xy_list, c, PL
|
||||
# attributes for all lj Objects: name, xy_list, c, layer
|
||||
# + for RelativeObjects : closed, xpos , ypos , resize , rotx , roty , rotz
|
||||
def OSCobj(path, tags, args, source):
|
||||
|
||||
|
@ -439,40 +476,82 @@ def addOSCdefaults(server):
|
|||
oscserver.addMsgHandler( "default", OSChandler )
|
||||
oscserver.addMsgHandler( "/ping", OSCping)
|
||||
oscserver.addMsgHandler( "/quit", OSCquit)
|
||||
oscserver.addMsgHandler( "/debug", OSCdebug)
|
||||
oscserver.addMsgHandler( "/"+ name + "/adddest", OSCadddest)
|
||||
oscserver.addMsgHandler( "/"+ name + "/deldest", OSCdeldest)
|
||||
oscserver.addMsgHandler( "/"+ name + "/dest", OSCdest)
|
||||
oscserver.addMsgHandler( "/"+ name + "/obj", OSCobj)
|
||||
oscserver.addMsgHandler( "/"+ name + "/var", OSCvar)
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Color functions
|
||||
#
|
||||
|
||||
# input hexcode = '0xff00ff'
|
||||
def hex2rgb(hexcode):
|
||||
|
||||
hexcode = hexcode[2:]
|
||||
return tuple(int(hexcode[i:i+2], 16) for i in (0, 2, 4))
|
||||
#return tuple(map(ord,hexcode[1:].decode('hex')))
|
||||
|
||||
# input rgb=(255,0,255) output '0xff00ff'
|
||||
#def rgb2hex(rgb):
|
||||
# return '0x%02x%02x%02x' % tuple(rgb)
|
||||
|
||||
def rgb2hex(r, g, b):
|
||||
return hex((r << 16) + (g << 8) + b)
|
||||
|
||||
|
||||
#def rgb2int(rgb):
|
||||
# return int('0x%02x%02x%02x' % tuple(rgb),0)
|
||||
|
||||
def rgb2int(r,g,b):
|
||||
return int('0x%02x%02x%02x' % (r,g,b),0)
|
||||
|
||||
def int2rgb(intcode):
|
||||
#hexcode = '0x{0:06X}'.format(intcode)
|
||||
hexcode = '{0:06X}'.format(intcode)
|
||||
return tuple(int(hexcode[i:i+2], 16) for i in (0, 2, 4))
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Drawing basic functions
|
||||
#
|
||||
|
||||
def rgb2int(r,g,b):
|
||||
return int('0x%02x%02x%02x' % (r,g,b),0)
|
||||
# Lines
|
||||
def Line(xy1, xy2, c, layer ):
|
||||
LineTo(xy1, 0, layer )
|
||||
LineTo(xy2, c , layer )
|
||||
|
||||
def rLine(xy1, xy2, c, layer , xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
rLineTo(xy1, 0, layer )
|
||||
rLineTo(xy2, c , layer )
|
||||
|
||||
def LineRGB(xy1, xy2, red,green,blue, layer ):
|
||||
|
||||
LineTo(xy1, 0, layer )
|
||||
LineTo(xy2, int('0x%02x%02x%02x' % (red,green,blue),0) , layer )
|
||||
|
||||
|
||||
def LineTo(xy, c, PL):
|
||||
# Lineto
|
||||
def LineTo(xy, c, layer ):
|
||||
|
||||
pl[PL].append((xy + (c,)))
|
||||
layers[layer].append((xy + (c,)))
|
||||
|
||||
def rLineTo(xy, c, PL, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
def LineRGBTo(xy, red, green, blue, layer ):
|
||||
|
||||
pl[PL].append((Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz) + (c,)))
|
||||
LineTo(xy, int('0x%02x%02x%02x' % (red,green,blue),0), layer )
|
||||
|
||||
def rLineTo(xy, c, layer , xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
layers[layer ].append((Pointransf(xy, xpos, ypos, resize, rotx, roty, rotz) + (c,)))
|
||||
|
||||
|
||||
def Line(xy1, xy2, c, PL):
|
||||
LineTo(xy1, 0, PL)
|
||||
LineTo(xy2, c , PL)
|
||||
|
||||
def rLine(xy1, xy2, c, PL, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
rLineTo(xy1, 0, PL)
|
||||
rLineTo(xy2, c , PL)
|
||||
|
||||
|
||||
def PolyLineOneColor(xy_list, c, PL , closed ):
|
||||
# Polylines
|
||||
def PolyLineOneColor(xy_list, c, layer , closed ):
|
||||
#print "--"
|
||||
#print "c",c
|
||||
#print "xy_list",xy_list
|
||||
|
@ -482,13 +561,37 @@ def PolyLineOneColor(xy_list, c, PL , closed ):
|
|||
if xy0 is None:
|
||||
xy0 = xy
|
||||
#print "xy0:",xy0
|
||||
LineTo(xy0,0, PL)
|
||||
LineTo(xy0,c, PL)
|
||||
LineTo(xy0,0, layer )
|
||||
LineTo(xy0,c, layer )
|
||||
else:
|
||||
#print "xy:",xy
|
||||
LineTo(xy,c, PL)
|
||||
LineTo(xy,c, layer )
|
||||
if closed:
|
||||
LineTo(xy0,c, PL)
|
||||
LineTo(xy0,c, layer )
|
||||
|
||||
def PolyLineRGB(xy_list, red, green, blue, layer , closed ):
|
||||
|
||||
PolyLineOneColor(xy_list, int('0x%02x%02x%02x' % (red,green,blue),0), layer , closed )
|
||||
|
||||
|
||||
# rPolylines
|
||||
# Send 2D point list around 0,0 with 3D rotation resizing and reposition around xpos ypos
|
||||
#def rPolyLineOneColor(self, xy_list, c, layer , closed, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
||||
def rPolyLineOneColor(xy_list, c, layer , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
xy0 = None
|
||||
for xy in xy_list:
|
||||
if xy0 is None:
|
||||
xy0 = xy
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz), 0, layer )
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz), c, layer )
|
||||
else:
|
||||
LineTo(Pointransf(xy, xpos, ypos, resize, rotx, roty, rotz), c, layer )
|
||||
if closed:
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz), c, layer )
|
||||
|
||||
def rPolyLineRGB(xy_list, red, green, blue, layer , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
rPolyLineOneColor(xy_list, int('0x%02x%02x%02x' % (red,green,blue),0), layer , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0)
|
||||
|
||||
|
||||
|
||||
|
@ -497,7 +600,7 @@ def Pointransf(xy, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
|||
|
||||
x = xy[0] * resize
|
||||
y = xy[1] * resize
|
||||
z = 0
|
||||
z = xy[2] * resize
|
||||
|
||||
rad = math.radians(rotx)
|
||||
cosaX = math.cos(rad)
|
||||
|
@ -523,113 +626,75 @@ def Pointransf(xy, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
|||
x = x2 * cosZ - y * sinZ
|
||||
y = x2 * sinZ + y * cosZ
|
||||
|
||||
#print xy, (x + xpos,y+ ypos)
|
||||
return (x + xpos,y+ ypos)
|
||||
'''
|
||||
to understand why it get negative Y
|
||||
#print("transf",xy, (x + xpos,y+ ypos))
|
||||
factor = resize / (10*(viewer_distance + z))
|
||||
#print("resize", resize, "z", z, "factor", factor)
|
||||
#print("perspec", xy, (x * factor) + xpos, (- y * factor)+ ypos)
|
||||
#print()
|
||||
return ((x * factor) + xpos, (y * factor)+ ypos)
|
||||
#return (x + xpos, y + ypos)
|
||||
|
||||
# 3D to 2D projection
|
||||
factor = 4 * gstt.cc[22] / ((gstt.cc[21] * 8) + z)
|
||||
print xy, (x * factor + xpos, - y * factor + ypos )
|
||||
return (x * factor + xpos, - y * factor + ypos )
|
||||
'''
|
||||
|
||||
def rLineTo(xy, c, PL, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
pl[PL].append((Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz) + (c,)))
|
||||
#to understand why it get negative Y
|
||||
""" Transforms this 3D point to 2D using a perspective projection. """
|
||||
factor = fov / (viewer_distance + z)
|
||||
print("z", z, "factor", factor)
|
||||
#x = (x * factor)
|
||||
#y = (- y * factor)
|
||||
print("perspec", xy, (x * factor) + xpos, (- y * factor)+ ypos)
|
||||
print()
|
||||
return (x + xpos, y + ypos)
|
||||
#return (x, y)
|
||||
|
||||
|
||||
def rLine(xy1, xy2, c, PL, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
LineTo(Pointransf(xy1, xpos, ypos, resize, rotx, roty, rotz),0, PL)
|
||||
LineTo(Pointransf(xy2, xpos, ypos, resize, rotx, roty, rotz),c, PL)
|
||||
def Lineslayer(layer):
|
||||
print("Stupido !! your code is to old : use Drawlayer() instead of LinesPL()")
|
||||
Drawlayer(layer )
|
||||
|
||||
|
||||
|
||||
# Send 2D point list around 0,0 with 3D rotation resizing and reposition around xpos ypos
|
||||
#def rPolyLineOneColor(self, xy_list, c, PL , closed, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
||||
def rPolyLineOneColor(xy_list, c, PL , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
xy0 = None
|
||||
for xy in xy_list:
|
||||
if xy0 is None:
|
||||
xy0 = xy
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),0, PL)
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),c, PL)
|
||||
else:
|
||||
LineTo(Pointransf(xy, xpos, ypos, resize, rotx, roty, rotz),c, PL)
|
||||
if closed:
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),c, PL)
|
||||
|
||||
|
||||
def LineRGBTo(xy, red, green, blue, PL):
|
||||
|
||||
LineTo(xy, int('0x%02x%02x%02x' % (red,green,blue),0), PL)
|
||||
|
||||
def LineRGB(xy1, xy2, red,green,blue, PL):
|
||||
|
||||
LineTo(xy1, 0, PL)
|
||||
LineTo(xy2, int('0x%02x%02x%02x' % (red,green,blue),0) , PL)
|
||||
|
||||
|
||||
def PolyLineRGB(xy_list, red, green, blue, PL , closed ):
|
||||
|
||||
PolyLineOneColor(xy_list, int('0x%02x%02x%02x' % (red,green,blue),0), PL , closed )
|
||||
|
||||
def rPolyLineRGB(xy_list, red, green, blue, PL , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
rPolyLineOneColor(xy_list, int('0x%02x%02x%02x' % (red,green,blue),0), PL , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0)
|
||||
|
||||
|
||||
|
||||
def LinesPL(PL):
|
||||
print("Stupido !! your code is to old : use DrawPL() instead of LinesPL()")
|
||||
DrawPL(PL)
|
||||
|
||||
|
||||
def DrawPL(PL):
|
||||
#print '/pl/0/'+str(PL), str(pl[PL])
|
||||
if r.set('/pl/'+str(ClientNumber)+'/'+str(PL), str(pl[PL])) == True:
|
||||
#print '/pl/'+str(ClientNumber)+'/'+str(PL), str(pl[PL])
|
||||
pl[PL] = []
|
||||
def Draw(layer):
|
||||
#print '/pl/0/'+str(layer), str(layers[layer])
|
||||
if r.set('/pl/'+str(ClientNumber)+'/'+str(layer), str(layers[layer])) == True:
|
||||
#print '/pl/'+str(ClientNumber)+'/'+str(layer), str(layers[layer])
|
||||
layers[layer] = []
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def ResetPL(self, PL):
|
||||
pl[PL] = []
|
||||
def Resetlayer(self, layer):
|
||||
layers[layer] = []
|
||||
|
||||
|
||||
#
|
||||
# "Destinations" management for PLs
|
||||
# "Destinations" management for layers
|
||||
#
|
||||
|
||||
|
||||
# Add a destination for a given PL
|
||||
def Addest(PL, scene, laser):
|
||||
# Add a destination for a given layer
|
||||
def Addest(layer, scene, laser):
|
||||
|
||||
print (name,'adding',PL,scene,laser,'?')
|
||||
if Findest(PL, scene, laser) == -1:
|
||||
print (name,'adding',layer,scene,laser,'?')
|
||||
if Findest(layer, scene, laser) == -1:
|
||||
newdest = DestsObjects.counter + 1
|
||||
Dest0 = lj.DestObject(str(newdest), newdest, True, PL , scene, laser)
|
||||
Dest0 = lj.DestObject(str(newdest), newdest, True, layer , scene, laser)
|
||||
print("New destination added with number", newdest)
|
||||
else:
|
||||
print("Destination already existed")
|
||||
|
||||
|
||||
# OSC add a destination for a given PL
|
||||
# /pluginame/dest PL, scene, laser
|
||||
# OSC add a destination for a given layer
|
||||
# /pluginame/dest layer, scene, laser
|
||||
def OSCadddest(path, tags, args, source):
|
||||
|
||||
Addests(int(args[0]),int(args[1]),int(args[2]))
|
||||
|
||||
|
||||
# Find PL destination with its parameters in destinations dictionnary
|
||||
def Findest(PL, scene, laser):
|
||||
# Find layer destination with its parameters in destinations dictionnary
|
||||
def Findest(layer, scene, laser):
|
||||
|
||||
print(name, 'searching PL,scene,laser',PL,scene,laser)
|
||||
print(name, 'searching layer,scene,laser',layer,scene,laser)
|
||||
for item in DestObjects.getinstances():
|
||||
#print(item)
|
||||
if item.PL == PL and item.scene == scene and item.laser == laser:
|
||||
if item.layer == layer and item.scene == scene and item.laser == laser:
|
||||
#Dests.append(item[0])
|
||||
print('found number',item.number)
|
||||
return item.number
|
||||
|
@ -641,18 +706,18 @@ def Findest(PL, scene, laser):
|
|||
allDests = Dests.items()
|
||||
for item in allDests:
|
||||
print(item)
|
||||
if item[1] == PL and item[2] == scene and item[3] == laser:
|
||||
if item[1] == layer and item[2] == scene and item[3] == laser:
|
||||
#Dests.append(item[0])
|
||||
return Dests[item[0]]
|
||||
else:
|
||||
return -1
|
||||
'''
|
||||
|
||||
# Find and remove a PL destination with its parameters in destinations dictionnary
|
||||
def Deldest(PL, scene, laser):
|
||||
# Find and remove a layer destination with its parameters in destinations dictionnary
|
||||
def Deldest(layer, scene, laser):
|
||||
|
||||
Destnumber = Findest(PL, scene, laser)
|
||||
print(name,'deleting Destination PL, scene, laser', PL,scene, laser)
|
||||
Destnumber = Findest(layer, scene, laser)
|
||||
print(name,'deleting Destination layer, scene, laser', layer,scene, laser)
|
||||
|
||||
if Destnumber != -1:
|
||||
print('found DestObject', Destnumber)
|
||||
|
@ -662,14 +727,25 @@ def Deldest(PL, scene, laser):
|
|||
print("Destination was not found")
|
||||
|
||||
|
||||
# OSC Delete a destination for a given PL
|
||||
# /pluginame/deldests PL, scene, laser
|
||||
# OSC Delete a destination for a given layer
|
||||
# /pluginame/deldests layer, scene, laser
|
||||
def OSCdeldest(path, tags, args, source):
|
||||
|
||||
Deldests(args[0],args[1],args[2])
|
||||
Deldests(args[0], args[1], args[2])
|
||||
|
||||
|
||||
# Replace DrawPL if Destinations paradigm is implemented in plugin code
|
||||
# pluginame/dest layer, scene, laser
|
||||
def OSCdest(path, tags, args, source):
|
||||
|
||||
# For single layer plugin : add a new destination
|
||||
Addest(0, args[0], args[1])
|
||||
|
||||
# For single layer plugin : remove a destination
|
||||
|
||||
# For multiple layers plugin : add or remove
|
||||
|
||||
|
||||
# Replace Drawlayer if Destinations paradigm is implemented in plugin code
|
||||
def DrawDests():
|
||||
|
||||
# Objects style
|
||||
|
@ -677,22 +753,21 @@ def DrawDests():
|
|||
#print("DrawDest")
|
||||
|
||||
for destination in DestObject.getinstances():
|
||||
#print (destination.name, destination.number, destination.active, destination.PL, destination.scene, destination.laser, pl[destination.PL] )
|
||||
|
||||
#print(Dests[str(destination)])
|
||||
#print('/pl/'+str(Dests[str(destination)]["scene"])+'/'+str(Dests[str(destination)]["laser"]), ":", str(pl[Dests[str(destination)]["PL"]]))
|
||||
#print(len(pl[destination.PL]))
|
||||
#print('/pl/'+str(Dests[str(destination)]["scene"])+'/'+str(Dests[str(destination)]["laser"]), ":", str(layers[Dests[str(destination)]["PL"]]))
|
||||
#print(len(layers[destination.layer]))
|
||||
if destination.active == True:
|
||||
if r.set('/pl/'+str(destination.scene)+'/'+str(destination.laser), str(pl[destination.PL])) == True:
|
||||
#print ('pl', destination.PL, '/pl/'+str(destination.scene)+'/'+str(destination.laser), str(pl[destination.PL]))
|
||||
if r.set('/pl/'+str(destination.scene)+'/'+str(destination.laser), str(layers[destination.layer])) == True:
|
||||
#print ('layer', destination.layer, '/pl/'+str(destination.scene)+'/'+str(destination.laser), str(layers[destination.layer]))
|
||||
pass
|
||||
else:
|
||||
print('Redis key modification failed')
|
||||
|
||||
# Maybe one PL can be sent to multiple destination so they are all reset *after* all sending.
|
||||
for pls in range(4):
|
||||
# Maybe one layer can be sent to multiple destination so they are all reset *after* all sending.
|
||||
for layerss in range(4):
|
||||
|
||||
pl[pls] = []
|
||||
layers[layerss] = []
|
||||
|
||||
'''
|
||||
# Dictionnary style
|
||||
|
@ -700,30 +775,30 @@ def DrawDests():
|
|||
#print(Dests)
|
||||
for destination in range(len(Dests)):
|
||||
#print(Dests[str(destination)])
|
||||
#print('/pl/'+str(Dests[str(destination)]["scene"])+'/'+str(Dests[str(destination)]["laser"]), ":", str(pl[Dests[str(destination)]["PL"]]))
|
||||
if r.set('/pl/'+str(Dests[str(destination)]["scene"])+'/'+str(Dests[str(destination)]["laser"]), str(pl[Dests[str(destination)]["PL"]])) == True:
|
||||
#print '/pl/'+str(ClientNumber)+'/'+str(PL), str(pl[PL])
|
||||
#print('/pl/'+str(Dests[str(destination)]["scene"])+'/'+str(Dests[str(destination)]["laser"]), ":", str(layers[Dests[str(destination)]["layer"]]))
|
||||
if r.set('/pl/'+str(Dests[str(destination)]["scene"])+'/'+str(Dests[str(destination)]["laser"]), str(layers[Dests[str(destination)]["layer"]])) == True:
|
||||
#print '/pl/'+str(ClientNumber)+'/'+str(layer), str(layers[layer])
|
||||
pass
|
||||
else:
|
||||
print('Redis key modification failed')
|
||||
|
||||
# Maybe one PL can be sent to multiple destination so they are all reset *after* all sending.
|
||||
# Maybe one layer can be sent to multiple destination so they are all reset *after* all sending.
|
||||
for destination in range(len(Dests)):
|
||||
|
||||
pl[Dests[str(destination)]["PL"]] = []
|
||||
layers[Dests[str(destination)]["layer"]] = []
|
||||
'''
|
||||
'''
|
||||
scenes = 4
|
||||
|
||||
def DrawDestsPL(PL):
|
||||
def DrawDestslayer(layer):
|
||||
|
||||
for scene in range(scenes):
|
||||
|
||||
if Dests[laser]["scene"] != -1:
|
||||
if r.set('/pl/'+str(Dests[laser]["scene"])+'/'+str(Dests[laser]["laser"]), str(pl[Dests[laser]["laser"]])) == True:
|
||||
if r.set('/pl/'+str(ClientNumber)+'/'+str(PL), str(pl[PL])) == True:
|
||||
#print '/pl/'+str(ClientNumber)+'/'+str(PL), str(pl[PL])
|
||||
pl[Dests[laser]["laser"]] = []
|
||||
if r.set('/pl/'+str(Dests[laser]["scene"])+'/'+str(Dests[laser]["laser"]), str(layers[Dests[laser]["laser"]])) == True:
|
||||
if r.set('/pl/'+str(ClientNumber)+'/'+str(layer), str(layers[layer])) == True:
|
||||
#print '/pl/'+str(ClientNumber)+'/'+str(layer), str(layers[layer])
|
||||
layers[Dests[laser]["laser"]] = []
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
@ -762,8 +837,7 @@ ASCII_GRAPHICS = [
|
|||
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], # ?
|
||||
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], # @
|
||||
|
||||
# Implementé
|
||||
|
||||
# Implementé 65-90
|
||||
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], # A
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], # A
|
||||
|
@ -793,7 +867,7 @@ ASCII_GRAPHICS = [
|
|||
[(0,30), (0,0), (30,-30), (0,0), (-30,-30)], # Y
|
||||
[(30,30), (-30,30), (30,-30), (-30,-30)], # Z
|
||||
|
||||
# A implementer
|
||||
# A implementer
|
||||
|
||||
[(-30,-10), (0,-30), (0,30)], [(-30,30), (30,30)], # [
|
||||
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], # \
|
||||
|
@ -802,7 +876,7 @@ ASCII_GRAPHICS = [
|
|||
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], # _
|
||||
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], # `
|
||||
|
||||
# Implementé
|
||||
# Implementé 97-122
|
||||
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], # a
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20), (-20,0), (20,0)], # b
|
||||
|
@ -831,7 +905,38 @@ ASCII_GRAPHICS = [
|
|||
[(0,20), (0,0), (20,-20), (0,0), (-20,-20)], # y
|
||||
[(20,20), (-20,20), (20,-20), (-20,-20)], # z
|
||||
|
||||
[(-2,15), (2,15)] # Point a la place de {
|
||||
# A implementer
|
||||
[(-2,15), (2,15)], # Point a la place de {
|
||||
[(-30,-10), (0,-30), (0,30)], [(-30,30), (30,30)], # |
|
||||
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], # }
|
||||
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #
|
||||
[(30,10), (-30,10), (0,-30), (0,30)], # DEL
|
||||
|
||||
# Accents 128-151 a implementer
|
||||
[(30,30), (-30,30), (-30,-30), (30,-30)], # C
|
||||
[(-20,-20), (-20,20), (20,20), (20,-20)], # û
|
||||
[(20,20), (-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], # é
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], # â
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], # ä
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], # a
|
||||
[(20,20), (-20,20), (-20,-20), (20,-20)], # c
|
||||
[(20,20), (-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], # é
|
||||
[(20,20), (-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], # é
|
||||
[(20,20), (-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], # é
|
||||
[(0,20), (0,-20)], # i
|
||||
[(0,20), (0,-20)], # i
|
||||
[(0,20), (0,-20)], # i
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], # A
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], # A
|
||||
[(30,30), (-30,30), (-30,-0), (30,0), (-30,0), (-30,-30), (30,-30)], # E
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], # a
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], # a
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], # o
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], # o
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], # o
|
||||
[(-20,-20), (-20,20), (20,20), (20,-20)], # u
|
||||
[(-20,-20), (-20,20), (20,20), (20,-20)] # u
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
@ -850,7 +955,7 @@ def CharDots(char,color):
|
|||
dots.append((dot[0],dot[1],color))
|
||||
return dots
|
||||
|
||||
def Text(message,c, PL, xpos, ypos, resize, rotx, roty, rotz):
|
||||
def Text(message, c, layer, xpos, ypos, resize, rotx, roty, rotz):
|
||||
|
||||
dots =[]
|
||||
|
||||
|
@ -866,23 +971,29 @@ def Text(message,c, PL, xpos, ypos, resize, rotx, roty, rotz):
|
|||
x_offset = 26 * (- (0.9*l) + 3*i)
|
||||
# Digits
|
||||
if ord(ch)<58:
|
||||
char_pl_list = ASCII_GRAPHICS[ord(ch) - 48]
|
||||
else:
|
||||
char_pl_list = ASCII_GRAPHICS[ord(ch) - 46]
|
||||
char_layer_list = ASCII_GRAPHICS[ord(ch) - 48]
|
||||
|
||||
# Uppercase
|
||||
elif 64 < ord(ch) < 91 :
|
||||
char_layer_list = ASCII_GRAPHICS[ord(ch) - 46]
|
||||
|
||||
# Lowercase
|
||||
elif 96 < ord(ch) < 123 :
|
||||
char_layer_list = ASCII_GRAPHICS[ord(ch) - 45]
|
||||
|
||||
char_draw = []
|
||||
#dots.append((char_pl_list[0][0] + x_offset,char_pl_list[0][1],0))
|
||||
#dots.append((char_layer_list[0][0] + x_offset,char_layer_list[0][1],0))
|
||||
|
||||
for xy in char_pl_list:
|
||||
for xy in char_layer_list:
|
||||
char_draw.append((xy[0] + x_offset,xy[1],c))
|
||||
i +=1
|
||||
#print ch,char_pl_list,char_draw
|
||||
rPolyLineOneColor(char_draw, c, PL , False, xpos, ypos, resize, rotx, roty, rotz)
|
||||
#print ch,char_layer_list,char_draw
|
||||
rPolyLineOneColor(char_draw, c, layer , False, xpos, ypos, resize, rotx, roty, rotz)
|
||||
#dots.append(char_draw)
|
||||
|
||||
def TextRGB(message,c, PL, xpos, ypos, resize, rotx, roty, rotz):
|
||||
def TextRGB(message,c, layer, xpos, ypos, resize, rotx, roty, rotz):
|
||||
|
||||
Text(message,int('0x%02x%02x%02x' % (red,green,blue),0), PL, xpos, ypos, resize, rotx, roty, rotz)
|
||||
Text(message,int('0x%02x%02x%02x' % (red,green,blue),0), layer, xpos, ypos, resize, rotx, roty, rotz)
|
||||
|
||||
|
||||
|
|
@ -1,20 +1,21 @@
|
|||
# coding=UTF-8
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
|
||||
'''
|
||||
|
||||
lj23layers v0.7.6 for LJ v0.8+
|
||||
|
||||
Some LJ functions useful for python clients
|
||||
LJ functions (API) for python plugins/clients
|
||||
|
||||
"layers" version : "PL" has been replaced by layer
|
||||
"layers" version :
|
||||
- "PL" has been replaced by "layer"
|
||||
- "Client"
|
||||
|
||||
Each program using LJ should declare itself by call lj23layers Config :
|
||||
|
||||
Class management :
|
||||
Config(redisIP, client number, name)
|
||||
|
||||
https://stackoverflow.com/questions/739882/iterating-over-object-instances-of-a-given-class-in-python
|
||||
https://stackoverflow.com/questions/8628123/counting-instances-of-a-class
|
||||
http://effbot.org/pyfaq/how-do-i-get-a-list-of-all-instances-of-a-given-class.htm
|
||||
|
||||
Config(redisIP, client number,name)
|
||||
|
||||
Basic Draw :
|
||||
|
||||
|
@ -36,7 +37,8 @@ Laser objects (name and convenient group of parameters for one or several point
|
|||
- RelativeObject
|
||||
- FixedObject
|
||||
|
||||
layer "Destinations" : tells Live what layer to draw and to what scene/Laser ("destination") to send it.
|
||||
"Destinations" : Tell for given Layer a scene/Laser ("destination").
|
||||
Each Layer can have different destination (i.e to display same stuff on different laser)
|
||||
|
||||
|
||||
OSC and plugins functions :
|
||||
|
@ -59,6 +61,9 @@ OSCdeldest(): layer , scene, lasers delete a destination
|
|||
OSCobj(): /name/obj objectname attribute value for automation
|
||||
OSCvar(): /name/var variablename value for automation
|
||||
|
||||
|
||||
Joystick management is removed. Get it back in todolist
|
||||
|
||||
setup_controls(joystick)
|
||||
|
||||
XboxController : getLeftHori, getLeftVert, getRightHori, getRightVert, getLeftTrigger, getRightTrigger
|
||||
|
@ -69,6 +74,14 @@ CSLController : getLeftHori,getLeftVert,getRightHori, getRightVert,getLeftT
|
|||
my USB Joystick : getUp,getDown,getLeft,getRight,etLeftTrigger, getRightTrigger,getFire1, getFire2
|
||||
|
||||
|
||||
|
||||
Class management manuals:
|
||||
|
||||
https://stackoverflow.com/questions/739882/iterating-over-object-instances-of-a-given-class-in-python
|
||||
https://stackoverflow.com/questions/8628123/counting-instances-of-a-class
|
||||
http://effbot.org/pyfaq/how-do-i-get-a-list-of-all-instances-of-a-given-class.htm
|
||||
|
||||
|
||||
LICENCE : CC
|
||||
Sam Neurohack
|
||||
|
||||
|
@ -80,6 +93,7 @@ import sys
|
|||
import weakref
|
||||
import struct
|
||||
import numpy as np
|
||||
import gstt
|
||||
from multiprocessing import Process, Queue, TimeoutError
|
||||
|
||||
is_py2 = sys.version[0] == '2'
|
||||
|
@ -98,7 +112,7 @@ ClientNumber = 0
|
|||
name = "noname"
|
||||
oscrun = True
|
||||
point_list = []
|
||||
layers = [[],[],[],[]]
|
||||
layers = [[],[],[],[],[],[],[],[],[],[]]
|
||||
|
||||
fft3Groups = [-1,-1,-1,-1]
|
||||
|
||||
|
@ -107,6 +121,10 @@ Dests = dict()
|
|||
oscIPresol = "127.0.0.1"
|
||||
oscPORTresol = 7000
|
||||
|
||||
# 3D to 2D projection parameters
|
||||
fov = 256
|
||||
viewer_distance = 2.2
|
||||
|
||||
|
||||
'''
|
||||
|
||||
|
@ -256,7 +274,7 @@ def Config(redIP,client,myname):
|
|||
ClientNumber = client
|
||||
#print ("client configured",ClientNumber)
|
||||
name = myname
|
||||
print ("Plugin declare its name",name)
|
||||
print ("lj23layers : Plugin declare its name :",name)
|
||||
#print layer
|
||||
return r
|
||||
|
||||
|
@ -321,7 +339,9 @@ def SendLJ(oscaddress,oscargs=''):
|
|||
osclientlj = OSCClient()
|
||||
osclientlj.connect((redisIP, 8002))
|
||||
|
||||
print("lj23 in",name," sending OSC message : ", oscmsg, "to", redisIP, ":8002")
|
||||
print("lj23layers for",name,"sending OSC message :", oscmsg, "to", redisIP, ":8002")
|
||||
if gstt.debug >0:
|
||||
print("lj23layers for",name,"sending OSC message :", oscmsg, "to", redisIP, ":8002")
|
||||
try:
|
||||
osclientlj.sendto(oscmsg, (redisIP, 8002))
|
||||
oscmsg.clearData()
|
||||
|
@ -345,7 +365,7 @@ def SendResol(oscaddress,oscargs):
|
|||
osclientresol = OSCClient()
|
||||
osclientresol.connect((oscIPresol, oscPORTresol))
|
||||
|
||||
print("lj sending OSC message : ", oscmsg, "to Resolume", oscIPresol, ":", oscPORTresol)
|
||||
print("lj23layers sending OSC message : ", oscmsg, "to Resolume", oscIPresol, ":", oscPORTresol)
|
||||
try:
|
||||
osclientresol.sendto(oscmsg, (oscIPresol, oscPORTresol))
|
||||
oscmsg.clearData()
|
||||
|
@ -354,6 +374,15 @@ def SendResol(oscaddress,oscargs):
|
|||
pass
|
||||
|
||||
|
||||
def SendIntensity(laser, intensity):
|
||||
r.set('/intensity/' + str(laser), str(intensity))
|
||||
r.set('/order/'+str(laser), 6)
|
||||
SendLJ("/kpps/" + str(layer)+ " " + str(int(args[1])))
|
||||
|
||||
|
||||
def Sendkpps(laser, kpps):
|
||||
r.set('/kpps/' + str(laser), str(kpps))
|
||||
r.set('/order/'+str(laser), 7)
|
||||
|
||||
|
||||
def WebStatus(message):
|
||||
|
@ -362,8 +391,8 @@ def WebStatus(message):
|
|||
|
||||
# Closing plugin messages to LJ
|
||||
def ClosePlugin():
|
||||
WebStatus(name+" Exiting")
|
||||
SendLJ("/"+name+"/start",0)
|
||||
WebStatus(name+" Exiting")
|
||||
SendLJ("/"+name+"/start",0)
|
||||
|
||||
|
||||
|
||||
|
@ -380,7 +409,8 @@ def OSCframe():
|
|||
# Answer to LJ pings with /pong value
|
||||
def OSCping(path, tags, args, source):
|
||||
#def OSCping():
|
||||
print(name, "got /ping from LJ -> reply /pong", name)
|
||||
if gstt.debug >0:
|
||||
print(name, "lj23layers got /ping from LJ -> reply /pong", name)
|
||||
SendLJ("/pong",name)
|
||||
|
||||
# Properly close the system. Todo
|
||||
|
@ -393,7 +423,7 @@ def OSCquit(path, tags, args, source):
|
|||
global oscrun
|
||||
|
||||
oscrun = False
|
||||
print('lj23 got /quit for',name)
|
||||
print('lj23layers got /quit for',name)
|
||||
#WebStatus(name + " quit.")
|
||||
#SendLJ("/"+name+"/start",0)
|
||||
#print("Stopping OSC...")
|
||||
|
@ -405,7 +435,7 @@ def OSCquit(path, tags, args, source):
|
|||
def OSChandler(path, tags, args, source):
|
||||
|
||||
oscaddress = ''.join(path.split("/"))
|
||||
print("Default OSC Handler in",name,": msg from Client : " + str(source[0]),)
|
||||
print("lj23layers Default OSC Handler for",name,": msg from Client :" + str(source[0]),)
|
||||
print("OSC address", path)
|
||||
if len(args) > 0:
|
||||
print("with args", args)
|
||||
|
@ -439,28 +469,49 @@ def addOSCdefaults(server):
|
|||
oscserver.addMsgHandler( "/quit", OSCquit)
|
||||
oscserver.addMsgHandler( "/"+ name + "/adddest", OSCadddest)
|
||||
oscserver.addMsgHandler( "/"+ name + "/deldest", OSCdeldest)
|
||||
oscserver.addMsgHandler( "/"+ name + "/dest", OSCdest)
|
||||
oscserver.addMsgHandler( "/"+ name + "/obj", OSCobj)
|
||||
oscserver.addMsgHandler( "/"+ name + "/var", OSCvar)
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Color functions
|
||||
#
|
||||
|
||||
# input hexcode = '0xff00ff'
|
||||
def hex2rgb(hexcode):
|
||||
|
||||
hexcode = hexcode[2:]
|
||||
return tuple(int(hexcode[i:i+2], 16) for i in (0, 2, 4))
|
||||
#return tuple(map(ord,hexcode[1:].decode('hex')))
|
||||
|
||||
# input rgb=(255,0,255) output '0xff00ff'
|
||||
#def rgb2hex(rgb):
|
||||
# return '0x%02x%02x%02x' % tuple(rgb)
|
||||
|
||||
def rgb2hex(r, g, b):
|
||||
return hex((r << 16) + (g << 8) + b)
|
||||
|
||||
|
||||
#def rgb2int(rgb):
|
||||
# return int('0x%02x%02x%02x' % tuple(rgb),0)
|
||||
|
||||
def rgb2int(r,g,b):
|
||||
return int('0x%02x%02x%02x' % (r,g,b),0)
|
||||
|
||||
def int2rgb(intcode):
|
||||
#hexcode = '0x{0:06X}'.format(intcode)
|
||||
hexcode = '{0:06X}'.format(intcode)
|
||||
return tuple(int(hexcode[i:i+2], 16) for i in (0, 2, 4))
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Drawing basic functions
|
||||
#
|
||||
|
||||
def rgb2int(r,g,b):
|
||||
return int('0x%02x%02x%02x' % (r,g,b),0)
|
||||
|
||||
|
||||
def LineTo(xy, c, layer ):
|
||||
|
||||
layers[layer].append((xy + (c,)))
|
||||
|
||||
def rLineTo(xy, c, layer , xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
layers[layer ].append((Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz) + (c,)))
|
||||
|
||||
|
||||
# Lines
|
||||
def Line(xy1, xy2, c, layer ):
|
||||
LineTo(xy1, 0, layer )
|
||||
LineTo(xy2, c , layer )
|
||||
|
@ -469,7 +520,27 @@ def rLine(xy1, xy2, c, layer , xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0
|
|||
rLineTo(xy1, 0, layer )
|
||||
rLineTo(xy2, c , layer )
|
||||
|
||||
def LineRGB(xy1, xy2, red,green,blue, layer ):
|
||||
|
||||
LineTo(xy1, 0, layer )
|
||||
LineTo(xy2, int('0x%02x%02x%02x' % (red,green,blue),0) , layer )
|
||||
|
||||
|
||||
# Lineto
|
||||
def LineTo(xy, c, layer ):
|
||||
|
||||
layers[layer].append((xy + (c,)))
|
||||
|
||||
def LineRGBTo(xy, red, green, blue, layer ):
|
||||
|
||||
LineTo(xy, int('0x%02x%02x%02x' % (red,green,blue),0), layer )
|
||||
|
||||
def rLineTo(xy, c, layer , xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
layers[layer ].append((Pointransf(xy, xpos, ypos, resize, rotx, roty, rotz) + (c,)))
|
||||
|
||||
|
||||
# Polylines
|
||||
def PolyLineOneColor(xy_list, c, layer , closed ):
|
||||
#print "--"
|
||||
#print "c",c
|
||||
|
@ -488,6 +559,31 @@ def PolyLineOneColor(xy_list, c, layer , closed ):
|
|||
if closed:
|
||||
LineTo(xy0,c, layer )
|
||||
|
||||
def PolyLineRGB(xy_list, red, green, blue, layer , closed ):
|
||||
|
||||
PolyLineOneColor(xy_list, int('0x%02x%02x%02x' % (red,green,blue),0), layer , closed )
|
||||
|
||||
|
||||
# rPolylines
|
||||
# Send 2D point list around 0,0 with 3D rotation resizing and reposition around xpos ypos
|
||||
#def rPolyLineOneColor(self, xy_list, c, layer , closed, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
||||
def rPolyLineOneColor(xy_list, c, layer , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
xy0 = None
|
||||
for xy in xy_list:
|
||||
print(xy,xy0)
|
||||
if xy0 is None:
|
||||
xy0 = xy
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz), 0, layer )
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz), c, layer )
|
||||
else:
|
||||
LineTo(Pointransf(xy, xpos, ypos, resize, rotx, roty, rotz), c, layer )
|
||||
if closed:
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz), c, layer )
|
||||
|
||||
def rPolyLineRGB(xy_list, red, green, blue, layer , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
rPolyLineOneColor(xy_list, int('0x%02x%02x%02x' % (red,green,blue),0), layer , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0)
|
||||
|
||||
|
||||
|
||||
# Computing points coordinates for rPolyline function from 3D and around 0,0 to pygame coordinates
|
||||
|
@ -495,7 +591,7 @@ def Pointransf(xy, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
|||
|
||||
x = xy[0] * resize
|
||||
y = xy[1] * resize
|
||||
z = 0
|
||||
z = xy[2] * resize
|
||||
|
||||
rad = math.radians(rotx)
|
||||
cosaX = math.cos(rad)
|
||||
|
@ -522,61 +618,15 @@ def Pointransf(xy, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
|||
y = x2 * sinZ + y * cosZ
|
||||
|
||||
#print xy, (x + xpos,y+ ypos)
|
||||
return (x + xpos,y+ ypos)
|
||||
'''
|
||||
to understand why it get negative Y
|
||||
|
||||
# 3D to 2D projection
|
||||
factor = 4 * gstt.cc[22] / ((gstt.cc[21] * 8) + z)
|
||||
print xy, (x * factor + xpos, - y * factor + ypos )
|
||||
return (x * factor + xpos, - y * factor + ypos )
|
||||
'''
|
||||
|
||||
def rLineTo(xy, c, layer , xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
layers[layer ].append((Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz) + (c,)))
|
||||
|
||||
|
||||
def rLine(xy1, xy2, c, layer , xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
LineTo(Pointransf(xy1, xpos, ypos, resize, rotx, roty, rotz),0, layer )
|
||||
LineTo(Pointransf(xy2, xpos, ypos, resize, rotx, roty, rotz),c, layer )
|
||||
|
||||
|
||||
|
||||
# Send 2D point list around 0,0 with 3D rotation resizing and reposition around xpos ypos
|
||||
#def rPolyLineOneColor(self, xy_list, c, layer , closed, xpos = 0, ypos =0, resize =1, rotx =0, roty =0 , rotz=0):
|
||||
def rPolyLineOneColor(xy_list, c, layer , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
xy0 = None
|
||||
for xy in xy_list:
|
||||
if xy0 is None:
|
||||
xy0 = xy
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),0, layer )
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),c, layer )
|
||||
else:
|
||||
LineTo(Pointransf(xy, xpos, ypos, resize, rotx, roty, rotz),c, layer )
|
||||
if closed:
|
||||
LineTo(Pointransf(xy0, xpos, ypos, resize, rotx, roty, rotz),c, layer )
|
||||
|
||||
|
||||
def LineRGBTo(xy, red, green, blue, layer ):
|
||||
|
||||
LineTo(xy, int('0x%02x%02x%02x' % (red,green,blue),0), layer )
|
||||
|
||||
def LineRGB(xy1, xy2, red,green,blue, layer ):
|
||||
|
||||
LineTo(xy1, 0, layer )
|
||||
LineTo(xy2, int('0x%02x%02x%02x' % (red,green,blue),0) , layer )
|
||||
|
||||
|
||||
def PolyLineRGB(xy_list, red, green, blue, layer , closed ):
|
||||
|
||||
PolyLineOneColor(xy_list, int('0x%02x%02x%02x' % (red,green,blue),0), layer , closed )
|
||||
|
||||
def rPolyLineRGB(xy_list, red, green, blue, layer , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0):
|
||||
|
||||
rPolyLineOneColor(xy_list, int('0x%02x%02x%02x' % (red,green,blue),0), layer , closed, xpos = 0, ypos =0, resize =0.7, rotx =0, roty =0 , rotz=0)
|
||||
#return (x + xpos, y + ypos)
|
||||
|
||||
#to understand why it get negative Y
|
||||
""" Transforms this 3D point to 2D using a perspective projection. """
|
||||
factor = fov / (viewer_distance + z)
|
||||
x = x * factor + xpos
|
||||
y = y * factor + ypos
|
||||
#y = - y * factor + ypos
|
||||
return (x, y)
|
||||
|
||||
|
||||
def Lineslayer(layer):
|
||||
|
@ -584,7 +634,7 @@ def Lineslayer(layer):
|
|||
Drawlayer(layer )
|
||||
|
||||
|
||||
def Draw(layer ):
|
||||
def Draw(layer):
|
||||
#print '/pl/0/'+str(layer), str(layers[layer])
|
||||
if r.set('/pl/'+str(ClientNumber)+'/'+str(layer), str(layers[layer])) == True:
|
||||
#print '/pl/'+str(ClientNumber)+'/'+str(layer), str(layers[layer])
|
||||
|
@ -664,7 +714,18 @@ def Deldest(layer, scene, laser):
|
|||
# /pluginame/deldests layer, scene, laser
|
||||
def OSCdeldest(path, tags, args, source):
|
||||
|
||||
Deldests(args[0],args[1],args[2])
|
||||
Deldests(args[0], args[1], args[2])
|
||||
|
||||
|
||||
# pluginame/dest layer, scene, laser
|
||||
def OSCdest(path, tags, args, source):
|
||||
|
||||
# For single layer plugin : add a new destination
|
||||
Addest(0, args[0], args[1])
|
||||
|
||||
# For single layer plugin : remove a destination
|
||||
|
||||
# For multiple layers plugin : add or remove
|
||||
|
||||
|
||||
# Replace Drawlayer if Destinations paradigm is implemented in plugin code
|
||||
|
@ -675,7 +736,6 @@ def DrawDests():
|
|||
#print("DrawDest")
|
||||
|
||||
for destination in DestObject.getinstances():
|
||||
#print (destination.name, destination.number, destination.active, destination.layer, destination.scene, destination.laser, layers[destination.layer] )
|
||||
|
||||
#print(Dests[str(destination)])
|
||||
#print('/pl/'+str(Dests[str(destination)]["scene"])+'/'+str(Dests[str(destination)]["laser"]), ":", str(layers[Dests[str(destination)]["PL"]]))
|
||||
|
@ -760,8 +820,7 @@ ASCII_GRAPHICS = [
|
|||
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], # ?
|
||||
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], # @
|
||||
|
||||
# Implementé
|
||||
|
||||
# Implementé 65-90
|
||||
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], # A
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], # A
|
||||
|
@ -791,7 +850,7 @@ ASCII_GRAPHICS = [
|
|||
[(0,30), (0,0), (30,-30), (0,0), (-30,-30)], # Y
|
||||
[(30,30), (-30,30), (30,-30), (-30,-30)], # Z
|
||||
|
||||
# A implementer
|
||||
# A implementer
|
||||
|
||||
[(-30,-10), (0,-30), (0,30)], [(-30,30), (30,30)], # [
|
||||
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], # \
|
||||
|
@ -800,7 +859,7 @@ ASCII_GRAPHICS = [
|
|||
[(30,-30), (-30,-30), (-30,0), (0,0), (30,10), (0,30), (-30,30)], # _
|
||||
[(30,-30), (0,-30), (-30,-10), (-30,30), (0,30), (30,10), (30,0), (-30,0)], # `
|
||||
|
||||
# Implementé
|
||||
# Implementé 97-122
|
||||
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], # a
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20), (-20,0), (20,0)], # b
|
||||
|
@ -829,7 +888,38 @@ ASCII_GRAPHICS = [
|
|||
[(0,20), (0,0), (20,-20), (0,0), (-20,-20)], # y
|
||||
[(20,20), (-20,20), (20,-20), (-20,-20)], # z
|
||||
|
||||
[(-2,15), (2,15)] # Point a la place de {
|
||||
# A implementer
|
||||
[(-2,15), (2,15)], # Point a la place de {
|
||||
[(-30,-10), (0,-30), (0,30)], [(-30,30), (30,30)], # |
|
||||
[(-30,-10), (0,-30), (30,-10), (30,0), (-30,30), (30,30)], # }
|
||||
[(-30,-30), (0,-30), (30,-10), (0,0), (30,10), (0,30), (-30,30)], #
|
||||
[(30,10), (-30,10), (0,-30), (0,30)], # DEL
|
||||
|
||||
# Accents 128-151 a implementer
|
||||
[(30,30), (-30,30), (-30,-30), (30,-30)], # C
|
||||
[(-20,-20), (-20,20), (20,20), (20,-20)], # û
|
||||
[(20,20), (-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], # é
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], # â
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], # ä
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], # a
|
||||
[(20,20), (-20,20), (-20,-20), (20,-20)], # c
|
||||
[(20,20), (-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], # é
|
||||
[(20,20), (-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], # é
|
||||
[(20,20), (-20,20), (-20,-0), (20,0), (-20,0), (-20,-20), (20,-20)], # é
|
||||
[(0,20), (0,-20)], # i
|
||||
[(0,20), (0,-20)], # i
|
||||
[(0,20), (0,-20)], # i
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], # A
|
||||
[(-30,30), (-30,-30), (30,-30), (30,30), (30,0), (-30,0)], # A
|
||||
[(30,30), (-30,30), (-30,-0), (30,0), (-30,0), (-30,-30), (30,-30)], # E
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], # a
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (20,0), (-20,0)], # a
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], # o
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], # o
|
||||
[(-20,20), (-20,-20), (20,-20), (20,20), (-20,20)], # o
|
||||
[(-20,-20), (-20,20), (20,20), (20,-20)], # u
|
||||
[(-20,-20), (-20,20), (20,20), (20,-20)] # u
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
@ -848,7 +938,7 @@ def CharDots(char,color):
|
|||
dots.append((dot[0],dot[1],color))
|
||||
return dots
|
||||
|
||||
def Text(message,c, layer, xpos, ypos, resize, rotx, roty, rotz):
|
||||
def Text(message, c, layer, xpos, ypos, resize, rotx, roty, rotz):
|
||||
|
||||
dots =[]
|
||||
|
||||
|
@ -865,9 +955,15 @@ def Text(message,c, layer, xpos, ypos, resize, rotx, roty, rotz):
|
|||
# Digits
|
||||
if ord(ch)<58:
|
||||
char_layer_list = ASCII_GRAPHICS[ord(ch) - 48]
|
||||
else:
|
||||
|
||||
# Uppercase
|
||||
elif 64 < ord(ch) < 91 :
|
||||
char_layer_list = ASCII_GRAPHICS[ord(ch) - 46]
|
||||
|
||||
# Lowercase
|
||||
elif 96 < ord(ch) < 123 :
|
||||
char_layer_list = ASCII_GRAPHICS[ord(ch) - 45]
|
||||
|
||||
char_draw = []
|
||||
#dots.append((char_layer_list[0][0] + x_offset,char_layer_list[0][1],0))
|
||||
|
|
@ -5,6 +5,8 @@ lj3 v0.7.5 for LJ v0.8+
|
|||
|
||||
Some LJ functions useful for python clients
|
||||
|
||||
lj3 is deprecated use lj23
|
||||
|
||||
OSC functions commented, waiting working on OSC in python3
|
||||
|
||||
Config(redisIP, client number,name)
|
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
|
||||
'''
|
||||
Log in color from
|
||||
|
||||
https://stackoverflow.com/questions/287871/how-to-print-colored-text-in-terminal-in-python
|
||||
|
||||
usage :
|
||||
|
||||
import log
|
||||
log.info("Hello World")
|
||||
log.err("System Error")
|
||||
|
||||
'''
|
||||
HEADER = '\033[95m'
|
||||
OKBLUE = '\033[94m'
|
||||
OKGREEN = '\033[92m'
|
||||
WARNING = '\033[93m'
|
||||
FAIL = '\033[91m'
|
||||
ENDC = '\033[0m'
|
||||
BOLD = "\033[1m"
|
||||
|
||||
def disable():
|
||||
HEADER = ''
|
||||
OKBLUE = ''
|
||||
OKGREEN = ''
|
||||
WARNING = ''
|
||||
FAIL = ''
|
||||
ENDC = ''
|
||||
|
||||
def infog( msg):
|
||||
print(OKGREEN + msg + ENDC)
|
||||
|
||||
def info( msg):
|
||||
print(OKBLUE + msg + ENDC)
|
||||
|
||||
def warn( msg):
|
||||
print(WARNING + msg + ENDC)
|
||||
|
||||
def err( msg):
|
||||
print(FAIL + msg + ENDC)
|
|
@ -0,0 +1,404 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
|
||||
Maxwell Macros
|
||||
v0.7.0
|
||||
|
||||
by Sam Neurohack
|
||||
from /team/laser
|
||||
|
||||
Launchpad set a "current path"
|
||||
|
||||
"""
|
||||
|
||||
from OSC3 import OSCServer, OSCClient, OSCMessage
|
||||
import time
|
||||
import numpy as np
|
||||
import rtmidi
|
||||
from rtmidi.midiutil import open_midiinput
|
||||
from threading import Thread
|
||||
from rtmidi.midiconstants import (CHANNEL_PRESSURE, CONTROLLER_CHANGE, NOTE_ON, NOTE_OFF,
|
||||
PITCH_BEND, POLY_PRESSURE, PROGRAM_CHANGE)
|
||||
|
||||
import os, json
|
||||
import midi3
|
||||
|
||||
if os.uname()[1]=='raspberrypi':
|
||||
pass
|
||||
|
||||
port = 8090
|
||||
ip = "127.0.0.1"
|
||||
mididest = 'Session 1'
|
||||
djdest = 'Port'
|
||||
|
||||
midichannel = 1
|
||||
computerIP = ['127.0.0.1','192.168.2.95','192.168.2.52','127.0.0.1',
|
||||
'127.0.0.1','127.0.0.1','127.0.0.1','127.0.0.1']
|
||||
computer = 0
|
||||
|
||||
# store current value for computer 1
|
||||
cc1 =[0]*140
|
||||
|
||||
current = {
|
||||
"patch": 0,
|
||||
"prefixLeft": "/osc/left/X",
|
||||
"prefixRight": "/osc/right/X",
|
||||
"suffix": "/amp",
|
||||
"path": "/osc/left/X/curvetype",
|
||||
"pathLeft": "/osc/left/X/curvetype",
|
||||
"pathRight": "/osc/left/X/curvetype",
|
||||
"previousmacro": -1,
|
||||
"LeftCurveType": 0,
|
||||
"lfo": 1,
|
||||
"rotator": 1,
|
||||
"translator": 1
|
||||
}
|
||||
|
||||
specificvalues = {
|
||||
|
||||
# Sine: 0-32, Tri: 33-64, Square: 65-96, Line: 96-127
|
||||
"curvetype": {"sin": 0, "saw": 33, "squ": 95, "lin": 127},
|
||||
"freqlimit": {"1": 0, "4": 26, "16": 52, "32": 80, "127": 127},
|
||||
"amptype": {"constant": 0, "lfo1": 33, "lfo2": 95, "lfo3": 127},
|
||||
"phasemodtype": {"linear": 0,"sin": 90},
|
||||
"phaseoffsettype": {"manual": 0, "lfo1": 33, "lfo2": 95, "lfo3": 127},
|
||||
"ampoffsettype": { "manual": 0, "lfo1": 33, "lfo2": 95, "lfo3": 127},
|
||||
"inversion": {"off": 0, "on": 127},
|
||||
"colortype": {"solid": 0, "lfo": 127},
|
||||
"modtype": {"sin": 0,"linear": 127},
|
||||
"switch": {"off": 0,"on": 127},
|
||||
"operation": {"+": 0, "-": 50, "*": 127}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Maxwell CCs
|
||||
#
|
||||
|
||||
def FindCC(FunctionName):
|
||||
|
||||
for Maxfunction in range(len(maxwell['ccs'])):
|
||||
if FunctionName == maxwell['ccs'][Maxfunction]['Function']:
|
||||
#print(FunctionName, "is CC", Maxfunction)
|
||||
return Maxfunction
|
||||
|
||||
def LoadCC():
|
||||
global maxwell
|
||||
|
||||
print("Loading Maxwell CCs Functions...")
|
||||
|
||||
if os.path.exists('maxwell.json'):
|
||||
#print('File maxwell.json exits')
|
||||
f=open("maxwell.json","r")
|
||||
|
||||
else:
|
||||
if os.path.exists('../maxwell.json'):
|
||||
#print('File ../maxwell.json exits')
|
||||
f=open("../maxwell.json","r")
|
||||
|
||||
s = f.read()
|
||||
maxwell = json.loads(s)
|
||||
print(len(maxwell['ccs']),"Functions")
|
||||
print("Loaded.")
|
||||
|
||||
# /cc cc number value
|
||||
def cc(ccnumber, value, dest=mididest):
|
||||
|
||||
#print('Output CC',[CONTROLLER_CHANGE+midichannel-1, ccnumber, value], dest)
|
||||
midi3.MidiMsg([CONTROLLER_CHANGE+midichannel-1,ccnumber,value], dest)
|
||||
|
||||
def NoteOn(note,velocity, dest=mididest):
|
||||
midi3.NoteOn(note,velocity, mididest)
|
||||
|
||||
def NoteOff(note, dest=mididest):
|
||||
midi3.NoteOn(note, mididest)
|
||||
|
||||
|
||||
def Send(oscaddress,oscargs=''):
|
||||
|
||||
oscmsg = OSCMessage()
|
||||
oscmsg.setAddress(oscaddress)
|
||||
oscmsg.append(oscargs)
|
||||
|
||||
osclient = OSCClient()
|
||||
osclient.connect((ip, port))
|
||||
|
||||
print("sending OSC message : ", oscmsg, "to", ip, ":",port)
|
||||
try:
|
||||
osclient.sendto(oscmsg, (ip, port))
|
||||
oscmsg.clearData()
|
||||
return True
|
||||
except:
|
||||
print ('Connection to', ip, 'refused : died ?')
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def ssawtooth(samples,freq,phase):
|
||||
|
||||
t = np.linspace(0+phase, 1+phase, samples)
|
||||
for ww in range(samples):
|
||||
samparray[ww] = signal.sawtooth(2 * np.pi * freq * t[ww])
|
||||
return samparray
|
||||
|
||||
def ssquare(samples,freq,phase):
|
||||
|
||||
t = np.linspace(0+phase, 1+phase, samples)
|
||||
for ww in range(samples):
|
||||
samparray[ww] = signal.square(2 * np.pi * freq * t[ww])
|
||||
return samparray
|
||||
|
||||
def ssine(samples,freq,phase):
|
||||
|
||||
t = np.linspace(0+phase, 1+phase, samples)
|
||||
for ww in range(samples):
|
||||
samparray[ww] = np.sin(2 * np.pi * freq * t[ww])
|
||||
return samparray
|
||||
|
||||
|
||||
|
||||
def MixerLeft(value):
|
||||
|
||||
if value == 127:
|
||||
Send("/mixer/value", 0)
|
||||
|
||||
|
||||
def MixerRight(value):
|
||||
|
||||
if value == 127:
|
||||
Send("/mixer/value", 127)
|
||||
|
||||
def MixerTempo(tempo):
|
||||
|
||||
for counter in range(127):
|
||||
Send("/mixer/value", counter)
|
||||
|
||||
# Jog send 127 to left and 1 to right
|
||||
# increase or decrease current CC defined in current path
|
||||
def jogLeft(value):
|
||||
path = current["pathLeft"]
|
||||
print("jog : path =",path, "CC :", FindCC(path), "value", value)
|
||||
MaxwellCC = FindCC(current["pathLeft"])
|
||||
if value == 127:
|
||||
# decrease CC
|
||||
if cc1[MaxwellCC] > 0:
|
||||
cc1[MaxwellCC] -= 1
|
||||
else:
|
||||
if cc1[MaxwellCC] < 127:
|
||||
cc1[MaxwellCC] += 1
|
||||
#print("sending", cc1[MaxwellCC], "to CC", MaxwellCC )
|
||||
cc(MaxwellCC, cc1[MaxwellCC] , dest ='to Maxwell 1')
|
||||
#RotarySpecifics(MaxwellCC, path[path.rfind("/")+1:len(path)], value)
|
||||
|
||||
|
||||
# Jog send 127 to left and 1 to right
|
||||
# increase or decrease current CC defined in current path
|
||||
def jogRight(value):
|
||||
path = current["pathRight"]
|
||||
print("jog : path =",path, "CC :", FindCC(path), "value", value)
|
||||
MaxwellCC = FindCC(current["pathRight"])
|
||||
if value == 127:
|
||||
# decrease CC
|
||||
if cc1[MaxwellCC] > 0:
|
||||
cc1[MaxwellCC] -= 1
|
||||
else:
|
||||
if cc1[MaxwellCC] < 127:
|
||||
cc1[MaxwellCC] += 1
|
||||
#print("sending", cc1[MaxwellCC], "to CC", MaxwellCC )
|
||||
cc(MaxwellCC, cc1[MaxwellCC] , dest ='to Maxwell 1')
|
||||
#RotarySpecifics(MaxwellCC, path[path.rfind("/")+1:len(path)], value)
|
||||
|
||||
|
||||
# Parameter change : to left 127 / to right 0 or 1
|
||||
def RotarySpecifics( MaxwellCC, specificsname, value):
|
||||
global maxwell
|
||||
|
||||
print("Maxwell CC :",MaxwellCC)
|
||||
print("Current :",maxwell['ccs'][MaxwellCC]['init'])
|
||||
print("Specifics :",specificvalues[specificsname])
|
||||
print("midi value :", value)
|
||||
|
||||
|
||||
elements = list(enumerate(specificvalues[specificsname]))
|
||||
print(elements)
|
||||
nextype = maxwell['ccs'][MaxwellCC]['init']
|
||||
|
||||
for count,ele in elements:
|
||||
|
||||
if ele == maxwell['ccs'][MaxwellCC]['init']:
|
||||
if count > 0 and value == 127:
|
||||
nextype = elements[count-1][1]
|
||||
|
||||
if count < len(elements)-1 and value < 2:
|
||||
#print("next is :",elements[count+1][1])
|
||||
nextype = elements[count+1][1]
|
||||
|
||||
print("result :", nextype, "new value :", specificvalues[specificsname][nextype], "Maxwell CC", MaxwellCC)
|
||||
maxwell['ccs'][MaxwellCC]['init'] = nextype
|
||||
cc(MaxwellCC, specificvalues[specificsname][nextype], dest ='to Maxwell 1')
|
||||
|
||||
|
||||
# Change type : trig with only with midi value 127 on a CC event
|
||||
def ButtonSpecifics127( MaxwellCC, specificsname, value):
|
||||
global maxwell
|
||||
|
||||
print("Maxwell CC :",MaxwellCC)
|
||||
print("Current :",maxwell['ccs'][MaxwellCC]['init'])
|
||||
print("Specifics :",specificvalues[specificsname])
|
||||
print("midi value :", value)
|
||||
|
||||
|
||||
elements = list(enumerate(specificvalues[specificsname]))
|
||||
print(elements)
|
||||
nextype = maxwell['ccs'][MaxwellCC]['init']
|
||||
|
||||
for count,ele in elements:
|
||||
|
||||
if ele == maxwell['ccs'][MaxwellCC]['init']:
|
||||
if count >0 and value == 127:
|
||||
nextype = elements[count-1][1]
|
||||
|
||||
if count < len(elements)-1 and value < 2:
|
||||
#print("next is :",elements[count+1][1])
|
||||
nextype = elements[count+1][1]
|
||||
|
||||
print("result :", nextype, "new value :", specificvalues[specificsname][nextype], "Maxwell CC", MaxwellCC)
|
||||
maxwell['ccs'][MaxwellCC]['init'] = nextype
|
||||
cc(MaxwellCC, specificvalues[specificsname][nextype], dest ='to Maxwell 1')
|
||||
|
||||
|
||||
|
||||
# Left cue button 127 = on 0 = off
|
||||
def PrevPatch(value):
|
||||
global current
|
||||
|
||||
print('PrevPatch function')
|
||||
if value == 127 and current['patch'] - 1 > -1:
|
||||
cc(9, 127, dest=djdest)
|
||||
time.sleep(0.1)
|
||||
current['patch'] -= 1
|
||||
print("Current patch is now :",current['patch'])
|
||||
midi3.NoteOn(current['patch'], 127, 'to Maxwell 1')
|
||||
cc(9, 0, dest=djdest)
|
||||
|
||||
# Right cue button 127 = on 0 = off
|
||||
def NextPatch(value):
|
||||
global current
|
||||
|
||||
print('NextPatch function', current["patch"])
|
||||
if value == 127 and current["patch"] + 1 < 41:
|
||||
cc(3, 127, dest = djdest)
|
||||
current["patch"] += 1
|
||||
#ModeNote(current["patch"], 127, 'to Maxwell 1')
|
||||
midi3.NoteOn(current["patch"], 127, 'to Maxwell 1')
|
||||
print("Current patch is now :",current["patch"])
|
||||
time.sleep(0.1)
|
||||
cc(3, 0, dest = djdest)
|
||||
|
||||
|
||||
# increase/decrease a CC
|
||||
def changeCC(value, path):
|
||||
global current
|
||||
|
||||
#path = current["pathLeft"]
|
||||
MaxwellCC = FindCC(path)
|
||||
cc1[MaxwellCC] += value
|
||||
print("Change Left CC : path =",path, "CC :", FindCC(path), "is now ", cc1[MaxwellCC])
|
||||
cc(MaxwellCC, cc1[MaxwellCC] , dest ='to Maxwell 1')
|
||||
|
||||
|
||||
def PlusTenLeft(value):
|
||||
value = 10
|
||||
changeCC(value, current["pathLeft"])
|
||||
|
||||
def MinusTenLeft(value):
|
||||
value = -10
|
||||
changeCC(value, current["pathLeft"])
|
||||
|
||||
def PlusOneLeft(value):
|
||||
value = 1
|
||||
changeCC(value, current["pathLeft"])
|
||||
|
||||
def MinusOneLeft(value):
|
||||
value = -1
|
||||
changeCC(value, current["pathLeft"])
|
||||
|
||||
def PlusTenRight(value):
|
||||
value = 10
|
||||
changeCC(value, current["pathRight"])
|
||||
|
||||
def MinusTenRight(value):
|
||||
value = -10
|
||||
changeCC(value, current["pathRight"])
|
||||
|
||||
def PlusOneRight(value):
|
||||
value = 1
|
||||
changeCC(value, current["pathRight"])
|
||||
|
||||
def MinusOneRight(value):
|
||||
value = -1
|
||||
changeCC(value, current["pathRight"])
|
||||
|
||||
|
||||
|
||||
def ChangeCurveLeft(value):
|
||||
|
||||
MaxwellCC = FindCC(current["prefixLeft"] + '/curvetype')
|
||||
RotarySpecifics(MaxwellCC, "curvetype", value)
|
||||
|
||||
|
||||
def ChangeFreqLimitLeft(value):
|
||||
|
||||
MaxwellCC = FindCC(current["prefixLeft"] + '/freqlimit')
|
||||
RotarySpecifics(MaxwellCC, "curvetype", value)
|
||||
|
||||
|
||||
def ChangeATypeLeft(value):
|
||||
|
||||
MaxwellCC = FindCC(current["prefixLeft"] + '/freqlimit')
|
||||
RotarySpecifics(MaxwellCC, "curvetype", value)
|
||||
|
||||
def ChangePMTypeLeft(value):
|
||||
|
||||
MaxwellCC = FindCC(current["prefixLeft"] + '/phasemodtype')
|
||||
RotarySpecifics(MaxwellCC, "curvetype", value)
|
||||
|
||||
def ChangePOTypeLeft(value):
|
||||
|
||||
MaxwellCC = FindCC(current["prefixLeft"] + '/phaseoffsettype')
|
||||
RotarySpecifics(MaxwellCC, "curvetype", value)
|
||||
|
||||
|
||||
def ChangeAOTypeLeft(value):
|
||||
|
||||
MaxwellCC = FindCC(current["prefixLeft"] + '/ampoffsettype')
|
||||
RotarySpecifics(MaxwellCC, "curvetype", value)
|
||||
|
||||
|
||||
def ChangeCurveRight(value):
|
||||
|
||||
MaxwellCC = FindCC(current["prefixRight"] + '/curvetype')
|
||||
RotarySpecifics(MaxwellCC, "curvetype", value)
|
||||
|
||||
|
||||
def ChangeCurveLFO(value):
|
||||
|
||||
MaxwellCC = FindCC('/lfo/'+ current["lfo"] +'/curvetype')
|
||||
RotarySpecifics(MaxwellCC, "curvetype", value)
|
||||
|
||||
|
||||
def ChangeCurveRot(value):
|
||||
|
||||
MaxwellCC = FindCC('/rotator/'+ current["rotator"] +'/curvetype')
|
||||
RotarySpecifics(MaxwellCC, "curvetype", value)
|
||||
|
||||
|
||||
def ChangeCurveTrans(value):
|
||||
|
||||
MaxwellCC = FindCC('/translator/'+ current["translator"] +'/curvetype')
|
||||
RotarySpecifics(MaxwellCC, "curvetype", value)
|
||||
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ print('Midi startup...')
|
|||
|
||||
import gstt, bhoreal, launchpad, LPD8
|
||||
from queue import Queue
|
||||
#from OSC3 import OSCServer, OSCClient, OSCMessage
|
||||
from OSC3 import OSCServer, OSCClient, OSCMessage
|
||||
|
||||
|
||||
midiname = ["Name"] * 16
|
||||
|
@ -219,24 +219,31 @@ def NoteOff(note, mididest):
|
|||
|
||||
# mididest : all or specifiname, won't be sent to launchpad or Bhoreal.
|
||||
def MidiMsg(midimsg, mididest):
|
||||
#print("MidiMsg", midimsg, "Dest", mididest)
|
||||
#print("midi3 got MidiMsg", midimsg, "Dest", mididest)
|
||||
|
||||
desterror = -1
|
||||
for port in range(MidInsNumber):
|
||||
##print("port",port,"midiname", midiname[port])
|
||||
#print("port",port,"midiname", midiname[port])
|
||||
|
||||
# To mididest
|
||||
if midiname[port].find(mididest) != -1:
|
||||
#print("sending to name", midiname[port],midimsg)
|
||||
#print("midi 3 sending to name", midiname[port], "port", port, ":", midimsg)
|
||||
midiport[port].send_message(midimsg)
|
||||
desterror = 0
|
||||
|
||||
# To All
|
||||
elif mididest == "all" and midiname[port].find(mididest) == -1 and midiname[port].find(BhorealMidiName) == -1 and midiname[port].find(LaunchMidiName) == -1:
|
||||
elif mididest == "all" and midiname[port].find(mididest) == -1 and midiname[port].find(BhorealMidiName) == -1 and midiname[port].find(LaunchMidiName) == -1 and midiname[port].find(DJName) == -1:
|
||||
#print("all sending to port",port,"name", midiname[port])
|
||||
midiport[port].send_message(midimsg)
|
||||
desterror = 0
|
||||
|
||||
for OSCtarget in midi2OSC:
|
||||
if (OSCtarget == mididest or mididest == 'all') and midi2OSC[OSCtarget]["msgs"]:
|
||||
OSCsend(OSCtarget, "/cc", [midimsg[1], midimsg[2]])
|
||||
desterror = 0
|
||||
|
||||
if desterror == -1:
|
||||
print ("** This midi or OSC destination doesn't exists **")
|
||||
|
||||
|
||||
def OSCsend(name, oscaddress, oscargs =''):
|
||||
|
@ -303,25 +310,18 @@ def MidinProcess(inqueue, portname):
|
|||
# Note On
|
||||
if msg[0]==NOTE_ON:
|
||||
print ("from", portname, "noteon", msg[1])
|
||||
NoteOn(msg[1],msg[2],mididest)
|
||||
# Webstatus(''.join(("note ",msg[1]," to ",msg[2])))
|
||||
# NoteOn(msg[1],msg[2],mididest)
|
||||
|
||||
# Note Off
|
||||
if msg[0]==NOTE_OFF:
|
||||
print("from", portname,"noteoff")
|
||||
NoteOff(msg[1],msg[2], mididest)
|
||||
# Webstatus(''.join(("note ",msg[1]," to ",msg[2])))
|
||||
# NoteOff(msg[1],msg[2], mididest)
|
||||
|
||||
# Midi CC message
|
||||
if msg[0] == CONTROLLER_CHANGE:
|
||||
print("from", portname,"CC :", msg[1], msg[2])
|
||||
'''
|
||||
Webstatus("CC :" + str(msg[1]) + " " + str(msg[2]))
|
||||
for OSCtarget in midi2OSC:
|
||||
if OSCtarget["notes"]:
|
||||
pass
|
||||
#OSCsend(OSCtarget, "/CC", note)
|
||||
'''
|
||||
|
||||
|
||||
# other midi message
|
||||
if msg[0] != NOTE_OFF and msg[0] != NOTE_ON and msg[0] != CONTROLLER_CHANGE:
|
||||
print("from", portname,"other midi message")
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python2.7
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
'''
|
||||
|
@ -9,9 +9,9 @@ Plugins Handler.
|
|||
|
||||
'''
|
||||
|
||||
from OSC import OSCServer, OSCClient, OSCMessage
|
||||
from OSC3 import OSCServer, OSCClient, OSCMessage
|
||||
from websocket_server import WebsocketServer
|
||||
import gstt
|
||||
from libs3 import gstt
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
@ -34,6 +34,14 @@ def Port(name):
|
|||
data = gstt.plugins.get(name)
|
||||
return data.get("OSC")
|
||||
|
||||
|
||||
def Ping(name):
|
||||
|
||||
sendWSall("/"+ name + "/start 0")
|
||||
return OSCsend(name,"/ping",1)
|
||||
#return True
|
||||
|
||||
|
||||
# How to start the plugin ?
|
||||
def Command(name):
|
||||
|
||||
|
@ -45,6 +53,34 @@ def Data(name):
|
|||
|
||||
return gstt.plugins.get(name)
|
||||
|
||||
|
||||
|
||||
def Kill(name):
|
||||
|
||||
#data = Data(name)
|
||||
print("Killing", name, "...")
|
||||
|
||||
OSCsend(name,"/quit")
|
||||
|
||||
'''
|
||||
if data["process"] != None:
|
||||
print name, "plugin is owned by LJ."
|
||||
print "Killing plugin", name
|
||||
OSCsend(name,"/quit")
|
||||
#data["process"].terminate()
|
||||
sendWSall("/status Killing "+ name +".")
|
||||
|
||||
else:
|
||||
print "Killing asked but plugin is not owned by LJ"
|
||||
sendWSall("/status Not own plugin")
|
||||
'''
|
||||
|
||||
def Restart(name):
|
||||
|
||||
Kill(name)
|
||||
Start(name)
|
||||
|
||||
|
||||
# See LJ.conf data
|
||||
def Start(name):
|
||||
|
||||
|
@ -53,20 +89,30 @@ def Start(name):
|
|||
|
||||
sendWSall("/status Starting "+name+"...")
|
||||
# Get LJ path
|
||||
ljpath = r'%s' % os.getcwd().replace('\\','/')
|
||||
#ljpath = r'%s' % os.getcwd().replace('\\','/')
|
||||
|
||||
|
||||
print("")
|
||||
print("LJ is starting plugin :", name)
|
||||
|
||||
print ""
|
||||
print "LJ is starting plugin :", name
|
||||
|
||||
# Construct the command with absolute path.
|
||||
|
||||
PluginPath = command.split(" ")
|
||||
# Launch as a subprocess
|
||||
PluginProcess = subprocess.Popen([PluginPath[0], ljpath + "/" + PluginPath[1]])
|
||||
print("launch :", PluginPath[0], gstt.ljpath + "/" + PluginPath[1])
|
||||
|
||||
# without argument
|
||||
if len(PluginPath) < 3:
|
||||
PluginProcess = subprocess.Popen( [PluginPath[0], gstt.ljpath + "/" + PluginPath[1] ], env=os.environ)
|
||||
# with 1 argument
|
||||
else:
|
||||
PluginProcess = subprocess.Popen( [PluginPath[0], gstt.ljpath + "/" + PluginPath[1] + " " + PluginPath[2]], env=os.environ)
|
||||
#PluginProcess = os.execv([PluginPath[0], ljpath + "/" + PluginPath[1]])
|
||||
|
||||
if gstt.debug >0:
|
||||
print "LJ path :", ljpath
|
||||
print "New process pid for ", name, ":", PluginProcess.pid
|
||||
print("LJ path :", ljpath)
|
||||
print("New process pid for ", name, ":", PluginProcess.pid)
|
||||
|
||||
'''
|
||||
# Maybe it's not fully started
|
||||
|
@ -114,17 +160,17 @@ def OSCsend(name, oscaddress, oscargs =''):
|
|||
|
||||
try:
|
||||
if gstt.debug > 0:
|
||||
print "Plugins manager : OSCsending", oscmsg,"to plugin", name, "at", gstt.LjayServerIP, ":", PluginPort
|
||||
print("Plugins manager : OSCsending", oscmsg,"to plugin", name, "at", gstt.LjayServerIP, ":", PluginPort)
|
||||
|
||||
osclientplugin.sendto(oscmsg, (gstt.LjayServerIP, PluginPort))
|
||||
oscmsg.clearData()
|
||||
if gstt.debug >0:
|
||||
print oscaddress, oscargs, "was sent to",name
|
||||
print(oscaddress, oscargs, "was sent to",name)
|
||||
return True
|
||||
|
||||
except:
|
||||
if gstt.debug > 0:
|
||||
print 'OSCSend : Connection to plugin IP', gstt.LjayServerIP ,':', PluginPort,'refused : died ?'
|
||||
print('OSCSend : Connection to plugin IP', gstt.LjayServerIP ,':', PluginPort,'refused : died ?')
|
||||
#sendWSall("/status No plugin.")
|
||||
#sendWSall("/status " + name + " is offline")
|
||||
#sendWSall("/" + name + "/start 0")
|
||||
|
@ -132,33 +178,19 @@ def OSCsend(name, oscaddress, oscargs =''):
|
|||
return False
|
||||
|
||||
|
||||
def Ping(name):
|
||||
|
||||
# for each plugin will automatically add /pluginame before oscpath to send like /aurora/scim 1, if oscpath = "/scim 1"
|
||||
def SendAll(oscpath):
|
||||
|
||||
sendWSall("/"+ name + "/start 0")
|
||||
return OSCsend(name,"/ping",1)
|
||||
#return True
|
||||
if gstt.debug > 0:
|
||||
print("Sending to all plugins ", oscpath)
|
||||
|
||||
for plugin in list(gstt.plugins.keys()):
|
||||
if gstt.debug > 0:
|
||||
print("sending ",oscpath,"to", plugin)
|
||||
#sendWSall("/"+ plugin + "/start 0")
|
||||
Send(plugin, "/"+plugin+oscpath)
|
||||
|
||||
def Kill(name):
|
||||
|
||||
#data = Data(name)
|
||||
print "Killing",name
|
||||
|
||||
OSCsend(name,"/quit")
|
||||
|
||||
'''
|
||||
if data["process"] != None:
|
||||
print name, "plugin is owned by LJ."
|
||||
print "Killing plugin", name
|
||||
OSCsend(name,"/quit")
|
||||
#data["process"].terminate()
|
||||
sendWSall("/status Killing "+ name +".")
|
||||
|
||||
else:
|
||||
print "Killing asked but plugin is not owned by LJ"
|
||||
sendWSall("/status Not own plugin")
|
||||
'''
|
||||
|
||||
# Send a command to given plugin. Will also start it if command contain /start 1
|
||||
def Send(name, oscpath):
|
||||
|
@ -173,15 +205,15 @@ def Send(name, oscpath):
|
|||
#sendWSall("/" + name + "/start 1")
|
||||
#sendWSall("/status " + name + " online")
|
||||
if gstt.debug > 0:
|
||||
print ''
|
||||
print "Plugins manager got", oscpath, "for plugin", name, "currently online."
|
||||
print('')
|
||||
print("Plugins manager got", oscpath, "for plugin", name, "currently online.")
|
||||
|
||||
|
||||
# If start 0, try to kill plugin
|
||||
if oscpath[0].find("start") != -1 and oscpath[1] == "0":
|
||||
|
||||
if gstt.debug >0:
|
||||
print "start 0, so killing", name, "..."
|
||||
print("start 0, so killing", name, "...")
|
||||
Kill(name)
|
||||
|
||||
# Send osc command
|
||||
|
@ -191,22 +223,29 @@ def Send(name, oscpath):
|
|||
OSCsend(name, oscpath[0], oscargs=oscpath[1])
|
||||
elif len(oscpath) == 3:
|
||||
OSCsend(name, oscpath[0], oscargs=(oscpath[1], oscpath[2]))
|
||||
|
||||
elif name == "trckr":
|
||||
#print("To trckr", name, oscpath, len(oscpath))
|
||||
OSCsend(name, oscpath[0], oscpath[1:])
|
||||
elif name == "aurora":
|
||||
#print("To Aurora", oscpath, len(oscpath))
|
||||
OSCsend(name, oscpath[0], oscpath[1:])
|
||||
return True
|
||||
|
||||
# Plugin not online..
|
||||
else:
|
||||
|
||||
if gstt.debug >0:
|
||||
print "Plugin manager send says plugin " + name + " is offline."
|
||||
print("Plugin manager send says plugin " + name + " is offline.")
|
||||
#print "Command", oscpath
|
||||
|
||||
sendWSall("/status Plugin " + name + " offline")
|
||||
sendWSall("/redstatus Plugin " + name + " offline")
|
||||
sendWSall("/"+ name + "/start 0")
|
||||
|
||||
# Try to Start it if /start 1
|
||||
if oscpath[0].find("start") != -1 and oscpath[1] == "1":
|
||||
if gstt.debug >0:
|
||||
print "Plugin Manager Trying to start", name, "..."
|
||||
print("Plugin Manager Trying to start", name, "...")
|
||||
Start(name)
|
||||
|
||||
return False
|
|
@ -0,0 +1,82 @@
|
|||
import serial, sys
|
||||
|
||||
START_VAL = 0x7E
|
||||
END_VAL = 0xE7
|
||||
|
||||
COM_BAUD = 57600
|
||||
COM_TIMEOUT = 1
|
||||
COM_PORT = 7
|
||||
DMX_SIZE = 512
|
||||
|
||||
LABELS = {
|
||||
'GET_WIDGET_PARAMETERS' :3, #unused
|
||||
'SET_WIDGET_PARAMETERS' :4, #unused
|
||||
'RX_DMX_PACKET' :5, #unused
|
||||
'TX_DMX_PACKET' :6,
|
||||
'TX_RDM_PACKET_REQUEST' :7, #unused
|
||||
'RX_DMX_ON_CHANGE' :8, #unused
|
||||
}
|
||||
|
||||
|
||||
class DMXConnection(object):
|
||||
def __init__(self, comport = None):
|
||||
'''
|
||||
On Windows, the only argument is the port number. On *nix, it's the path to the serial device.
|
||||
For example:
|
||||
DMXConnection(4) # Windows
|
||||
DMXConnection('/dev/tty2') # Linux
|
||||
DMXConnection("/dev/ttyUSB0") # Linux
|
||||
'''
|
||||
self.dmx_frame = [0] * DMX_SIZE
|
||||
try:
|
||||
self.com = serial.Serial(comport, baudrate = COM_BAUD, timeout = COM_TIMEOUT)
|
||||
except:
|
||||
com_name = 'COM%s' % (comport + 1) if type(comport) == int else comport
|
||||
print("Could not open device %s. Quitting application." % com_name)
|
||||
sys.exit(0)
|
||||
|
||||
print("Opened %s." % (self.com.portstr))
|
||||
|
||||
|
||||
def setChannel(self, chan, val, autorender = False):
|
||||
'''
|
||||
Takes channel and value arguments to set a channel level in the local
|
||||
DMX frame, to be rendered the next time the render() method is called.
|
||||
'''
|
||||
if not 1 <= chan-1 <= DMX_SIZE:
|
||||
print('Invalid channel specified: %s' % chan-1)
|
||||
return
|
||||
# clamp value
|
||||
val = max(0, min(val, 255))
|
||||
self.dmx_frame[chan-1] = val
|
||||
if autorender: self.render()
|
||||
|
||||
def clear(self, chan = 0):
|
||||
'''
|
||||
Clears all channels to zero. blackout.
|
||||
With optional channel argument, clears only one channel.
|
||||
'''
|
||||
if chan == 0:
|
||||
self.dmx_frame = [0] * DMX_SIZE
|
||||
else:
|
||||
self.dmx_frame[chan-1] = 0
|
||||
|
||||
|
||||
def render(self):
|
||||
''''
|
||||
Updates the DMX output from the USB DMX Pro with the values from self.dmx_frame.
|
||||
'''
|
||||
packet = [
|
||||
START_VAL,
|
||||
LABELS['TX_DMX_PACKET'],
|
||||
len(self.dmx_frame) & 0xFF,
|
||||
(len(self.dmx_frame) >> 8) & 0xFF,
|
||||
]
|
||||
packet += self.dmx_frame
|
||||
packet.append(END_VAL)
|
||||
|
||||
packet = list(map(chr, packet))
|
||||
self.com.write(''.join(packet))
|
||||
|
||||
def close(self):
|
||||
self.com.close()
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python2.7
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
'''
|
||||
|
@ -10,8 +10,8 @@ Settings Handler
|
|||
LICENCE : CC
|
||||
'''
|
||||
|
||||
import ConfigParser
|
||||
import gstt
|
||||
import configparser
|
||||
from libs3 import gstt
|
||||
import ast
|
||||
import numpy as np
|
||||
|
||||
|
@ -20,14 +20,16 @@ def Write():
|
|||
|
||||
config.set('General', 'lasernumber', str(gstt.LaserNumber))
|
||||
config.set('General', 'ljayserverip', str(gstt.LjayServerIP))
|
||||
config.set('General', 'wwwip', str(gstt.wwwIP))
|
||||
config.set('General', 'bhoroscip', str(gstt.oscIPin))
|
||||
config.set('General', 'nozoscip', str(gstt.nozoscIP))
|
||||
config.set('General', 'debug', str(gstt.debug))
|
||||
|
||||
config.set('General', 'autostart', gstt.autostart)
|
||||
|
||||
for i in range(gstt.LaserNumber):
|
||||
laser = 'laser' + str(i)
|
||||
config.set(laser, 'ip', str(gstt.lasersIPS[i]))
|
||||
config.set(laser, 'type', str(gstt.lasertype[i]))
|
||||
config.set(laser, 'kpps', str(gstt.kpps[i]))
|
||||
config.set(laser, 'centerx', str(gstt.centerX[i]))
|
||||
config.set(laser, 'centery', str(gstt.centerY[i]))
|
||||
|
@ -47,16 +49,18 @@ def Read():
|
|||
|
||||
gstt.LaserNumber = config.getint('General', 'lasernumber')
|
||||
gstt.LjayServerIP= config.get('General', 'ljayserverip')
|
||||
gstt.wwwIP= config.get('General', 'wwwip')
|
||||
gstt.oscIPin = config.get('General', 'bhoroscip')
|
||||
gstt.nozoscip = config.get('General', 'nozoscip')
|
||||
gstt.debug = config.get('General', 'debug')
|
||||
gstt.plugins = ast.literal_eval(config.get('plugins', 'plugins'))
|
||||
gstt.plugins = ast.literal_eval(config.get('plugins', 'plugins'))
|
||||
gstt.autostart = config.get('General', 'autostart')
|
||||
|
||||
|
||||
print ""
|
||||
for i in range(4):
|
||||
laser = 'laser' + str(i)
|
||||
gstt.lasersIPS[i]= config.get(laser, 'ip')
|
||||
gstt.lasertype[i]= config.get(laser, 'type')
|
||||
gstt.kpps[i] = config.getint(laser, 'kpps')
|
||||
#gstt.lasersPLcolor[i] = config.getint(laser, 'color')
|
||||
gstt.centerX[i]= config.getint(laser, 'centerx')
|
||||
|
@ -68,10 +72,11 @@ def Read():
|
|||
gstt.finANGLE[i] = config.getfloat(laser, 'finangle')
|
||||
gstt.swapX[i] = config.getint(laser, 'swapx')
|
||||
gstt.swapY[i] = config.getint(laser, 'swapy')
|
||||
gstt.lsteps[i] = ast.literal_eval(config.get(laser, 'lsteps'))
|
||||
gstt.warpdest[i]= np.array(ast.literal_eval(config.get(laser, 'warpdest')))
|
||||
|
||||
|
||||
print "* Reading", gstt.ConfigName, "setup file.*"
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
config.read(gstt.ConfigName)
|
||||
|
||||
|
|
@ -0,0 +1,583 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
|
||||
'''
|
||||
|
||||
Tracer v0.8.2
|
||||
|
||||
Etherdream DACs handler on network via Redis
|
||||
|
||||
LICENCE : CC
|
||||
Sam Neurohack, pclf
|
||||
|
||||
Includes live conversion in etherdream coordinates, geometric corrections, color balance change, intensity limitation, grid display,...
|
||||
|
||||
One tracer process is launched per requested laser by LJ. Lasers parameters in LJ.conf.
|
||||
Live I/O based on redis keys : inputs (Pointlists to draw,...) and outputs (DAC state, errors,..).
|
||||
Keys are mostly read and set at each main loop.
|
||||
This tracer include an enhanced version (support for several lasers) of the etherdream python library from j4cDAC.
|
||||
|
||||
|
||||
* Redis keys reference *
|
||||
|
||||
- Drawing things :
|
||||
|
||||
/pl/Scene/lasernumber [(x,y,color),(x1,y1,color),...] The live list of drawn pygame points. Tracer continously ask redis for key /clientkey+lasernumber
|
||||
/resampler/lasernumber [(1.0,8), (0.25,3),(0.75,3),(1.0,10)] : a string for resampling rules.
|
||||
the first tuple (1.0,8) is for short line < 4000 in etherdream space
|
||||
(0.25,3),(0.75,3),(1.0,10) for long line > 4000
|
||||
i.e (0.25,3) means go at 25% position on the line, send 3 times this position to etherdream
|
||||
/clientkey "/pl/SceneNumber/" What Scene to retrieve from redis
|
||||
/EDH/lasernumber
|
||||
|
||||
- Tracer control :
|
||||
|
||||
/order 0-8 Set redis key with new value then issue the order number
|
||||
|
||||
0 : Draw Normal point list
|
||||
1 : Get the new EDH = reread redis key /EDH/lasernumber
|
||||
2 : Draw BLACK point list
|
||||
3 : Draw GRID point list
|
||||
4 : Resampler Change (longs and shorts lsteps)
|
||||
5 : Client Key Change = reread redis key /clientkey
|
||||
6 : Max Intensity Change = reread redis key /intensity
|
||||
7 : kpps change = reread redis key /kpps
|
||||
8 : color balance change = reread redis keys /red /green /blue
|
||||
|
||||
|
||||
- Managing Etherdream DACs :
|
||||
|
||||
Discrete drawing values
|
||||
|
||||
/kpps 0- DAC output speed to laser, then order 7. Depends of actual angle
|
||||
/intensity 0-255 Laser output power, then order 6 (for alignement,...)
|
||||
/red 0-100 % of full red, then order 8
|
||||
/green 0-100 % of full green, then order 8
|
||||
/blue 0-100 % of full blue, then order 8
|
||||
|
||||
DAC status report
|
||||
|
||||
/lstt/lasernumber etherdream last_status.playback_state (0: idle 1: prepare 2: playing)
|
||||
/cap/lasernumber number of empty points sent to fill etherdream buffer (up to 1799)
|
||||
/lack/lasernumber "a": ACK "F": Full "I": invalid. 64 or 35 for no connection.
|
||||
|
||||
|
||||
Geometric corrections
|
||||
|
||||
Doctodo
|
||||
|
||||
|
||||
'''
|
||||
import socket
|
||||
import time
|
||||
import struct
|
||||
#from gstt import debug
|
||||
from libs3 import gstt,log
|
||||
import math
|
||||
from itertools import cycle
|
||||
#from globalVars import *
|
||||
import pdb
|
||||
import ast
|
||||
import redis
|
||||
|
||||
from libs3 import homographyp
|
||||
import numpy as np
|
||||
import binascii
|
||||
|
||||
black_points = [(278.0,225.0,0),(562.0,279.0,0),(401.0,375.0,0),(296.0,454.0,0),(298.0,165.0,0)]
|
||||
grid_points = [(300.0,200.0,0),(500.0,200.0,65280),(500.0,400.0,65280),(300.0,400.0,65280),(300.0,200.0,65280),(300.0,200.0,0),(200.0,100.0,0),(600.0,100.0,65280),(600.0,500.0,65280),(200.0,500.0,65280),(200.0,100.0,65280)]
|
||||
|
||||
r = redis.StrictRedis(host=gstt.LjayServerIP, port=6379, db=0)
|
||||
# r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0, password='-+F816Y+-')
|
||||
ackstate = {'61': 'ACK', '46': 'FULL', '49': "INVALID", '21': 'STOP', '64': "NO CONNECTION ?", '35': "NO CONNECTION ?" , '97': 'ACK', '70': 'FULL', '73': "INVALID", '33': 'STOP', '100': "NOCONNECTION", '48': "NOCONNECTION", 'a': 'ACK', 'F': 'FULL', 'I': "INVALID", '!': 'STOP', 'd': "NO CONNECTION ?", '0': "NO CONNECTION ?"}
|
||||
lstate = {'0': 'IDLE', '1': 'PREPARE', '2': "PLAYING", '64': "NOCONNECTION ?" }
|
||||
|
||||
def pack_point(laser, intensity, x, y, r, g, b, i = -1, u1 = 0, u2 = 0, flags = 0):
|
||||
"""Pack some color values into a struct dac_point."""
|
||||
|
||||
#print("Tracer", laser,":", r,g,b,"intensity", intensity, "i", i)
|
||||
|
||||
if r > intensity:
|
||||
r = intensity
|
||||
if g > intensity:
|
||||
g = intensity
|
||||
if b > intensity:
|
||||
b = intensity
|
||||
|
||||
|
||||
if max(r, g, b) == 0:
|
||||
i = 0
|
||||
else:
|
||||
i = intensity
|
||||
|
||||
x = int(x)
|
||||
y = int(y)
|
||||
#print("Tracer ", laser, ": packing", x, y, r, g, b, "intensity", intensity, "i", i)
|
||||
|
||||
|
||||
if x < -32767:
|
||||
x = -32767
|
||||
if gstt.debug >1:
|
||||
log.err("Tracer "+ str(laser) +" : x coordinates was below -32767")
|
||||
|
||||
if x > 32767:
|
||||
x = 32767
|
||||
if gstt.debug >1:
|
||||
log.err("Tracer "+ str(laser) +" : x coordinates was bigger than 32767")
|
||||
|
||||
|
||||
if y < -32767:
|
||||
y = -32767
|
||||
if gstt.debug >1:
|
||||
log.err("Tracer "+ str(laser) +" : y coordinates was below -32767")
|
||||
|
||||
if y > 32767:
|
||||
y = 32767
|
||||
if gstt.debug >1:
|
||||
log.err("Tracer "+ str(laser) +" : y coordinates was bigger than 32767")
|
||||
|
||||
return struct.pack("<HhhHHHHHH", flags, x, y, r, g, b, i, u1, u2)
|
||||
#return struct.pack("<HhhHHHHHH", flags, round(x), round(y), r, g, b, i, u1, u2)
|
||||
|
||||
|
||||
class ProtocolError(Exception):
|
||||
"""Exception used when a protocol error is detected."""
|
||||
pass
|
||||
|
||||
|
||||
class Status(object):
|
||||
"""Represents a status response from the DAC."""
|
||||
|
||||
def __init__(self, data):
|
||||
"""Initialize from a chunk of data."""
|
||||
self.protocol_version, self.le_state, self.playback_state, \
|
||||
self.source, self.le_flags, self.playback_flags, \
|
||||
self.source_flags, self.fullness, self.point_rate, \
|
||||
self.point_count = \
|
||||
struct.unpack("<BBBBHHHHII", data)
|
||||
|
||||
def dump(self, prefix = " - "):
|
||||
"""Dump to a string."""
|
||||
lines = [
|
||||
""
|
||||
"Host ",
|
||||
"Light engine: state %d, flags 0x%x" %
|
||||
(self.le_state, self.le_flags),
|
||||
"Playback: state %d, flags 0x%x" %
|
||||
(self.playback_state, self.playback_flags),
|
||||
"Buffer: %d points" %
|
||||
(self.fullness, ),
|
||||
"Playback: %d kpps, %d points played" %
|
||||
(self.point_rate, self.point_count),
|
||||
"Source: %d, flags 0x%x" %
|
||||
(self.source, self.source_flags)
|
||||
]
|
||||
|
||||
if gstt.debug == 2:
|
||||
print()
|
||||
for l in lines:
|
||||
print(prefix + l)
|
||||
|
||||
|
||||
class BroadcastPacket(object):
|
||||
"""Represents a broadcast packet from the DAC."""
|
||||
|
||||
def __init__(self, st):
|
||||
"""Initialize from a chunk of data."""
|
||||
self.mac = st[:6]
|
||||
self.hw_rev, self.sw_rev, self.buffer_capacity, \
|
||||
self.max_point_rate = struct.unpack("<HHHI", st[6:16])
|
||||
self.status = Status(st[16:36])
|
||||
|
||||
def dump(self, prefix = " - "):
|
||||
"""Dump to a string."""
|
||||
lines = [
|
||||
"MAC: " + ":".join(
|
||||
"%02x" % (ord(o), ) for o in self.mac),
|
||||
"HW %d, SW %d" %
|
||||
(self.hw_rev, self.sw_rev),
|
||||
"Capabilities: max %d points, %d kpps" %
|
||||
(self.buffer_capacity, self.max_point_rate)
|
||||
]
|
||||
print()
|
||||
for l in lines:
|
||||
print(prefix + l)
|
||||
if gstt.debug > 1:
|
||||
self.status.dump(prefix)
|
||||
|
||||
|
||||
class DAC(object):
|
||||
"""A connection to a DAC."""
|
||||
|
||||
|
||||
# "Laser point List" Point generator
|
||||
# each points is yielded : Getpoints() call n times OnePoint()
|
||||
|
||||
def OnePoint(self):
|
||||
|
||||
while True:
|
||||
|
||||
#pdb.set_trace()
|
||||
for indexpoint,currentpoint in enumerate(self.pl):
|
||||
#print indexpoint, currentpoint
|
||||
xyc = [currentpoint[0],currentpoint[1],currentpoint[2]]
|
||||
self.xyrgb = self.EtherPoint(xyc)
|
||||
#print(self.xyrgb[2:])
|
||||
rgb = (round(self.xyrgb[2:][0] *self.intred/100), round(self.xyrgb[2:][1] *self.intgreen/100), round(self.xyrgb[2:][2] *self.intblue/100))
|
||||
#print("rgb :", rgb)
|
||||
|
||||
#round(*self.intred/100)
|
||||
#round(*self.intgreen/100)
|
||||
#round(*self.intblue/100)
|
||||
|
||||
delta_x, delta_y = self.xyrgb[0] - self.xyrgb_prev[0], self.xyrgb[1] - self.xyrgb_prev[1]
|
||||
|
||||
#test adaptation selon longueur ligne
|
||||
if math.hypot(delta_x, delta_y) < 4000:
|
||||
|
||||
# For glitch art : decrease lsteps
|
||||
#l_steps = [ (1.0, 8)]
|
||||
l_steps = gstt.stepshortline
|
||||
|
||||
else:
|
||||
# For glitch art : decrease lsteps
|
||||
#l_steps = [ (0.25, 3), (0.75, 3), (1.0, 10)]
|
||||
l_steps = gstt.stepslongline
|
||||
|
||||
for e in l_steps:
|
||||
step = e[0]
|
||||
|
||||
for i in range(0,e[1]):
|
||||
|
||||
self.xyrgb_step = (self.xyrgb_prev[0] + step*delta_x, self.xyrgb_prev[1] + step*delta_y) + rgb # + self.xyrgb_prev[2:]# + rgb
|
||||
#print(self.xyrgb_step)
|
||||
yield self.xyrgb_step
|
||||
|
||||
self.xyrgb_prev = self.xyrgb
|
||||
|
||||
|
||||
def GetPoints(self, n):
|
||||
|
||||
d = [next(self.newstream) for i in range(n)]
|
||||
#print d
|
||||
return d
|
||||
|
||||
|
||||
# Etherpoint all transform in one matrix, with warp !!
|
||||
# xyc : x y color
|
||||
def EtherPoint(self,xyc):
|
||||
|
||||
c = xyc[2]
|
||||
|
||||
#print("")
|
||||
#print("pygame point",[(xyc[0],xyc[1],xyc[2])])
|
||||
#gstt.EDH[self.mylaser]= np.array(ast.literal_eval(r.get('/EDH/'+str(self.mylaser))))
|
||||
position = homographyp.apply(gstt.EDH[self.mylaser],np.array([(xyc[0],xyc[1])]))
|
||||
|
||||
#print("etherdream point",position[0][0], position[0][1], ((c >> 16) & 0xFF) << 8, ((c >> 8) & 0xFF) << 8, (c & 0xFF) << 8)
|
||||
|
||||
return (position[0][0], position[0][1], ((c >> 16) & 0xFF) << 8, ((c >> 8) & 0xFF) << 8, (c & 0xFF) << 8)
|
||||
|
||||
|
||||
def read(self, l):
|
||||
"""Read exactly length bytes from the connection."""
|
||||
while l > len(self.buf):
|
||||
self.buf += self.conn.recv(4096)
|
||||
|
||||
obuf = self.buf
|
||||
self.buf = obuf[l:]
|
||||
return obuf[:l]
|
||||
|
||||
def readresp(self, cmd):
|
||||
"""Read a response from the DAC."""
|
||||
|
||||
|
||||
data = self.read(22)
|
||||
response = data[0]
|
||||
gstt.lstt_dacanswers[self.mylaser] = response
|
||||
cmdR = chr(data[1])
|
||||
status = Status(data[2:])
|
||||
|
||||
r.set('/lack/'+str(self.mylaser), response)
|
||||
|
||||
if cmdR != cmd:
|
||||
raise ProtocolError("expected resp for %r, got %r"
|
||||
% (cmd, cmdR))
|
||||
|
||||
if response != ord('a'):
|
||||
raise ProtocolError("expected ACK, got %r"
|
||||
% (response, ))
|
||||
|
||||
self.last_status = status
|
||||
return status
|
||||
|
||||
def __init__(self, mylaser, PL, port = 7765):
|
||||
"""Connect to the DAC over TCP."""
|
||||
socket.setdefaulttimeout(2)
|
||||
|
||||
self.mylaser = mylaser
|
||||
self.clientkey = r.get("/clientkey").decode('ascii')
|
||||
|
||||
#log.info("Tracer "+str(self.mylaser)+" connecting to "+ gstt.lasersIPS[mylaser])
|
||||
#print("DAC", self.mylaser, "Handler process, connecting to", gstt.lasersIPS[mylaser] )
|
||||
self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.connstatus = self.conn.connect_ex((gstt.lasersIPS[mylaser], port))
|
||||
if self.connstatus == 35 or self.connstatus == 64:
|
||||
log.err("Tracer "+ str(self.mylaser)+" ("+ gstt.lasersIPS[mylaser]+"): "+ackstate[str(self.connstatus)])
|
||||
else:
|
||||
print("Tracer "+ str(self.mylaser)+" ("+ gstt.lasersIPS[mylaser]+"): "+ackstate[str(self.connstatus)])
|
||||
|
||||
# ipconn state is -1 at startup (see gstt) and modified here
|
||||
r.set('/lack/'+str(self.mylaser), self.connstatus)
|
||||
gstt.lstt_ipconn[self.mylaser] = self.connstatus
|
||||
|
||||
self.buf = b''
|
||||
# Upper case PL is the Point List number
|
||||
self.PL = PL
|
||||
|
||||
# Lower case pl is the actual point list coordinates
|
||||
|
||||
|
||||
#pdb.set_trace()
|
||||
self.pl = ast.literal_eval(r.get(self.clientkey + str(self.mylaser)).decode('ascii'))
|
||||
if r.get('/EDH/'+str(self.mylaser)) == None:
|
||||
#print("Laser",self.mylaser,"NO EDH !! Computing one...")
|
||||
homographyp.newEDH(self.mylaser)
|
||||
else:
|
||||
|
||||
gstt.EDH[self.mylaser] = np.array(ast.literal_eval(r.get('/EDH/'+str(self.mylaser)).decode('ascii')))
|
||||
#print("Laser",self.mylaser,"found its EDH in redis")
|
||||
#print gstt.EDH[self.mylaser]
|
||||
|
||||
self.xyrgb = self.xyrgb_prev = (0,0,0,0,0)
|
||||
self.intensity = 65280
|
||||
self.intred = 100
|
||||
self.intgreen = 100
|
||||
self.intblue = 100
|
||||
self.newstream = self.OnePoint()
|
||||
|
||||
if gstt.debug >0:
|
||||
print("Tracer",self.mylaser,"init asked for ckey", self.clientkey+str(self.mylaser))
|
||||
if self.connstatus != 0:
|
||||
#print(""
|
||||
log.err("Connection ERROR " +str(self.connstatus)+" with laser "+str(mylaser)+" : "+str(gstt.lasersIPS[mylaser]))
|
||||
#print("first 10 points in PL",self.PL, self.GetPoints(10)
|
||||
else:
|
||||
print("Connection status for DAC "+str(self.mylaser)+" : "+ str(self.connstatus))
|
||||
|
||||
|
||||
# Reference points
|
||||
# Read the "hello" message
|
||||
first_status = self.readresp("?")
|
||||
first_status.dump()
|
||||
position = []
|
||||
|
||||
|
||||
def begin(self, lwm, rate):
|
||||
cmd = struct.pack("<cHI", b'b', lwm, rate)
|
||||
print("Tracer", str(self.mylaser), "begin with PL : ", str(self.PL))
|
||||
self.conn.sendall(cmd)
|
||||
return self.readresp("b")
|
||||
|
||||
def update(self, lwm, rate):
|
||||
print(("update", lwm, rate))
|
||||
cmd = struct.pack("<cHI", b'u', lwm, rate)
|
||||
self.conn.sendall(cmd)
|
||||
return self.readresp("u")
|
||||
|
||||
def encode_point(self, point):
|
||||
return pack_point(self.mylaser, self.intensity, *point)
|
||||
|
||||
def write(self, points):
|
||||
epoints = list(map(self.encode_point, points))
|
||||
cmd = struct.pack("<cH", b'd', len(epoints))
|
||||
self.conn.sendall(cmd + b''.join(epoints))
|
||||
return self.readresp('d')
|
||||
|
||||
def prepare(self):
|
||||
self.conn.sendall(b'p')
|
||||
return self.readresp('p')
|
||||
|
||||
|
||||
def stop(self):
|
||||
self.conn.sendall('s')
|
||||
return self.readresp('s')
|
||||
|
||||
def estop(self):
|
||||
self.conn.sendall("\xFF")
|
||||
return self.readresp("\xFF")
|
||||
|
||||
def clear_estop(self):
|
||||
self.conn.sendall("c")
|
||||
return self.readresp("c")
|
||||
|
||||
def ping(self):
|
||||
self.conn.sendall('?')
|
||||
return self.readresp('?')
|
||||
|
||||
|
||||
|
||||
def play_stream(self):
|
||||
|
||||
#print("laser", self.mylaser, "Pb : ",self.last_status.playback_state)
|
||||
|
||||
# error if etherdream is already playing state (from other source)
|
||||
if self.last_status.playback_state == 2:
|
||||
raise Exception("already playing?!")
|
||||
|
||||
# if idle go to prepare state
|
||||
elif self.last_status.playback_state == 0:
|
||||
self.prepare()
|
||||
|
||||
started = 0
|
||||
|
||||
while True:
|
||||
|
||||
#print("laser", self.mylaser, "Pb : ",self.last_status.playback_state)
|
||||
|
||||
order = int(r.get('/order/'+str(self.mylaser)).decode('ascii'))
|
||||
#print("tracer", str(self.mylaser),"order", order, type(order)
|
||||
|
||||
if order == 0:
|
||||
|
||||
# USER point list
|
||||
self.pl = ast.literal_eval(r.get(self.clientkey+str(self.mylaser)).decode('ascii'))
|
||||
#print("Tracer : laser", self.mylaser, " order 0 : pl : ",len(self.pl))
|
||||
|
||||
else:
|
||||
|
||||
# Get the new EDH
|
||||
if order == 1:
|
||||
print("Tracer",self.mylaser,"new EDH ORDER in redis")
|
||||
gstt.EDH[self.mylaser]= np.array(ast.literal_eval(r.get('/EDH/'+str(self.mylaser)).decode('ascii')))
|
||||
# Back to user point list
|
||||
r.set('/order/'+str(self.mylaser), 0)
|
||||
|
||||
# BLACK point list
|
||||
if order == 2:
|
||||
print("Tracer",self.mylaser,"BLACK ORDER in redis")
|
||||
self.pl = black_points
|
||||
|
||||
# GRID point list
|
||||
if order == 3:
|
||||
print("Tracer",self.mylaser,"GRID ORDER in redis")
|
||||
self.pl = grid_points
|
||||
|
||||
|
||||
# Resampler Change
|
||||
if order == 4:
|
||||
self.resampler = ast.literal_eval(r.get('/resampler/'+str(self.mylaser)).decode('ascii'))
|
||||
print("Tracer", self.mylaser," : resetting lsteps for",self.resampler)
|
||||
gstt.stepshortline = self.resampler[0]
|
||||
gstt.stepslongline[0] = self.resampler[1]
|
||||
gstt.stepslongline[1] = self.resampler[2]
|
||||
gstt.stepslongline[2] = self.resampler[3]
|
||||
# Back to user point list order
|
||||
r.set('/order/'+str(self.mylaser), 0)
|
||||
|
||||
# Client Key change
|
||||
if order == 5:
|
||||
print("Tracer", self.mylaser, "new clientkey")
|
||||
self.clientkey = r.get('/clientkey')
|
||||
# Back to user point list order
|
||||
r.set('/order/'+str(self.mylaser), 0)
|
||||
|
||||
# Intensity change
|
||||
if order == 6:
|
||||
self.intensity = int(r.get('/intensity/' + str(self.mylaser)).decode('ascii')) << 8
|
||||
print("Tracer" , self.mylaser, "new Intensity", self.intensity)
|
||||
gstt.intensity[self.mylaser] = self.intensity
|
||||
r.set('/order/'+str(self.mylaser), "0")
|
||||
|
||||
# kpps change
|
||||
if order == 7:
|
||||
gstt.kpps[self.mylaser] = int(r.get('/kpps/' + str(self.mylaser)).decode('ascii'))
|
||||
print("Tracer",self.mylaser,"new kpps", gstt.kpps[self.mylaser])
|
||||
self.update(0, gstt.kpps[self.mylaser])
|
||||
r.set('/order/'+str(self.mylaser), "0")
|
||||
|
||||
# color balance change
|
||||
if order == 8:
|
||||
self.intred = int(r.get('/red/' + str(self.mylaser)).decode('ascii'))
|
||||
self.intgreen = int(r.get('/green/' + str(self.mylaser)).decode('ascii'))
|
||||
self.intblue = int(r.get('/blue/' + str(self.mylaser)).decode('ascii'))
|
||||
print("Tracer", self.mylaser, "new color balance", self.intred,"% ", self.intgreen, "% ",self.intblue,"% ")
|
||||
r.set('/order/'+str(self.mylaser), "0")
|
||||
|
||||
|
||||
r.set('/lstt/'+str(self.mylaser), self.last_status.playback_state)
|
||||
# pdb.set_trace()
|
||||
# How much room?
|
||||
|
||||
cap = 1799 - self.last_status.fullness
|
||||
points = self.GetPoints(cap)
|
||||
|
||||
r.set('/cap/'+str(self.mylaser), cap)
|
||||
|
||||
if cap < 100:
|
||||
time.sleep(0.001)
|
||||
cap += 150
|
||||
|
||||
# print("Writing %d points" % (cap, ))
|
||||
#t0 = time.time()
|
||||
#print points
|
||||
self.write(points)
|
||||
#t1 = time.time()
|
||||
# print("Took %f" % (t1 - t0, )
|
||||
|
||||
if not started:
|
||||
print("Tracer", self.mylaser, "starting with", gstt.kpps[self.mylaser],"kpps")
|
||||
self.begin(0, gstt.kpps[self.mylaser])
|
||||
started = 1
|
||||
|
||||
# not used in LJ.
|
||||
def find_dac():
|
||||
"""Listen for broadcast packets."""
|
||||
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
s.bind(("0.0.0.0", 7654))
|
||||
|
||||
while True:
|
||||
data, addr = s.recvfrom(1024)
|
||||
bp = BroadcastPacket(data)
|
||||
|
||||
print(("Packet from %s: " % (addr, )))
|
||||
bp.dump()
|
||||
|
||||
|
||||
'''
|
||||
#Laser order bit 0 = 0
|
||||
if not order & (1 << (self.mylaser*2)):
|
||||
#print("laser",mylaser,"bit 0 : 0")
|
||||
|
||||
# Laser bit 0 = 0 and bit 1 = 0 : USER PL
|
||||
if not order & (1 << (1+self.mylaser*2)):
|
||||
#print("laser",mylaser,"bit 1 : 0")
|
||||
self.pl = ast.literal_eval(r.get('/pl/'+str(self.mylaser)))
|
||||
|
||||
else:
|
||||
# Laser bit 0 = 0 and bit 1 = 1 : New EDH
|
||||
#print("laser",mylaser,"bit 1 : 1" )
|
||||
print("Laser",self.mylaser,"new EDH ORDER in redis"
|
||||
gstt.EDH[self.mylaser]= np.array(ast.literal_eval(r.get('/EDH/'+str(self.mylaser))))
|
||||
# Back to USER PL
|
||||
order = r.get('/order')
|
||||
neworder = order & ~(1<< self.mylaser*2)
|
||||
neworder = neworder & ~(1<< 1+ self.mylaser*2)
|
||||
r.set('/order', str(neworder))
|
||||
else:
|
||||
|
||||
# Laser bit 0 = 1
|
||||
print("laser",mylaser,"bit 0 : 1")
|
||||
|
||||
# Laser bit 0 = 1 and bit 1 = 0 : Black PL
|
||||
if not order & (1 << (1+self.mylaser*2)):
|
||||
#print("laser",mylaser,"bit 1 : 0")
|
||||
self.pl = black_points
|
||||
|
||||
else:
|
||||
# Laser bit 0 = 1 and bit 1 = 1 : GRID PL
|
||||
#print("laser",mylaser,"bit 1 : 1" )
|
||||
self.pl = grid_points
|
||||
'''
|
|
@ -1,45 +1,72 @@
|
|||
#!/usr/bin/python2.7
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
'''
|
||||
LJay/LJ v0.8.0
|
||||
|
||||
tracer.py (was newdacp.py)
|
||||
'''
|
||||
|
||||
Tracer
|
||||
for LJ v0.8.2
|
||||
|
||||
Enhanced version (support for several lasers) of the etherdream python library from j4cDAC.
|
||||
One tracer process is launched per requested laser. I/O based on redis keys.
|
||||
|
||||
LICENCE : CC
|
||||
Sam Neurohack, pclf
|
||||
|
||||
Conversion in etherdream coordinates, geometric corrections,...
|
||||
Init call with a laser number and which point list to draw. Etherdream IP is found in conf file for given laser number
|
||||
Uses redis keys value for live inputs (Pointlists to draw,...) and outputs (DAC state, errors,..).
|
||||
Most of redis keys are read and set at each main loop.
|
||||
Includes live conversion in etherdream coordinates, geometric corrections,...
|
||||
Etherdream IP is found in conf file for given laser number. (LJ.conf)
|
||||
|
||||
Uses redis keys value for live inputs/outputs
|
||||
These redis keys are read and set at each main loop.
|
||||
|
||||
Redis keys pulled to draw things :
|
||||
/order select some change to adjust
|
||||
/pl/lasernumber [(x,y,color),(x1,y1,color),...] A string of list of pygame points list.
|
||||
Redis keys to draw things :
|
||||
/order select some change to adjust. See below
|
||||
/pl/lasernumber [(x,y,color),(x1,y1,color),...] A string of list of points list.
|
||||
/resampler/lasernumber [(1.0,8), (0.25,3),(0.75,3),(1.0,10)] : a string for resampling rules.
|
||||
the first tuple (1.0,8) is for short line < 4000 in etherdream space
|
||||
(0.25,3),(0.75,3),(1.0,10) for long line > 4000
|
||||
i.e (0.25,3) means go at 25% position on the line, send 3 times this position to etherdream
|
||||
/clientkey
|
||||
|
||||
Etherdream status reports in redis keys:
|
||||
|
||||
Redis keys for Etherdream DAC
|
||||
|
||||
- Control
|
||||
/kpps see order 7
|
||||
/intensity see order 6
|
||||
/red see order 8
|
||||
/green see order 8
|
||||
/blue see order 8
|
||||
|
||||
- DAC status report
|
||||
/lstt/lasernumber value etherdream last_status.playback_state (0: idle 1: prepare 2: playing)
|
||||
/cap/lasernumber value number of empty points sent to fill etherdream buffer (up to 1799)
|
||||
/lack/lasernumber value "a": ACK "F": Full "I": invalid. 64 or 35 for no connection.
|
||||
|
||||
|
||||
|
||||
Order
|
||||
|
||||
0 : Draw Normal point list
|
||||
1 : Get the new EDH
|
||||
2 : Draw BLACK point list
|
||||
3 : Draw GRID point list
|
||||
4 : Resampler Change (longs and shorts lsteps)
|
||||
5 : Client Key change
|
||||
6 : Intensity change
|
||||
7 : kpps change
|
||||
8 : color balance change
|
||||
|
||||
Geometric corrections :
|
||||
|
||||
Doctodo
|
||||
|
||||
'''
|
||||
|
||||
'''
|
||||
import socket
|
||||
import time
|
||||
import struct
|
||||
#from gstt import debug
|
||||
import gstt
|
||||
from libs3 import gstt,log
|
||||
import math
|
||||
from itertools import cycle
|
||||
#from globalVars import *
|
||||
|
@ -47,27 +74,40 @@ import pdb
|
|||
import ast
|
||||
import redis
|
||||
|
||||
import homographyp
|
||||
from libs3 import homographyp
|
||||
import numpy as np
|
||||
import binascii
|
||||
|
||||
black_points = [(278.0,225.0,0),(562.0,279.0,0),(401.0,375.0,0),(296.0,454.0,0),(298.0,165.0,0)]
|
||||
grid_points = [(300.0,200.0,0),(500.0,200.0,65280),(500.0,400.0,65280),(300.0,400.0,65280),(300.0,200.0,65280),(300.0,200.0,0),(200.0,100.0,0),(600.0,100.0,65280),(600.0,500.0,65280),(200.0,500.0,65280),(200.0,100.0,65280)]
|
||||
|
||||
r = redis.StrictRedis(host=gstt.LjayServerIP, port=6379, db=0)
|
||||
# r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0, password='-+F816Y+-')
|
||||
ackstate = {'61': 'ACK', '46': 'FULL', '49': "INVALID", '21': 'STOP', '64': "NO CONNECTION ?", '35': "NO CONNECTION ?" , '97': 'ACK', '70': 'FULL', '73': "INVALID", '33': 'STOP', '100': "NOCONNECTION", '48': "NOCONNECTION", 'a': 'ACK', 'F': 'FULL', 'I': "INVALID", '!': 'STOP', 'd': "NO CONNECTION ?", '0': "NO CONNECTION ?"}
|
||||
lstate = {'0': 'IDLE', '1': 'PREPARE', '2': "PLAYING", '64': "NOCONNECTION ?" }
|
||||
|
||||
def pack_point(laser,intensity, x, y, r, g, b, i = -1, u1 = 0, u2 = 0, flags = 0):
|
||||
"""Pack some color values into a struct dac_point."""
|
||||
|
||||
#print("Tracer", laser,":", r,g,b,"intensity", intensity, "i", i)
|
||||
|
||||
if r > intensity:
|
||||
r = intensity
|
||||
if g > intensity:
|
||||
g = intensity
|
||||
if b > intensity:
|
||||
b = intensity
|
||||
|
||||
|
||||
def pack_point(x, y, r, g, b, i = -1, u1 = 0, u2 = 0, flags = 0):
|
||||
"""Pack some color values into a struct dac_point.
|
||||
if max(r, g, b) == 0:
|
||||
i = 0
|
||||
else:
|
||||
i = intensity
|
||||
|
||||
Values must be specified for x, y, r, g, and b. If a value is not
|
||||
passed in for the other fields, i will default to max(r, g, b); the
|
||||
rest default to zero.
|
||||
"""
|
||||
|
||||
if i < 0:
|
||||
i = max(r, g, b)
|
||||
|
||||
return struct.pack("<HhhHHHHHH", flags, x, y, r, g, b, i, u1, u2)
|
||||
#print("Tracer", laser,":", r,g,b,"intensity", intensity, "i", i)
|
||||
#print(x, type(x), int(x))
|
||||
return struct.pack("<HhhHHHHHH", flags, int(x), int(y), r, g, b, i, u1, u2)
|
||||
|
||||
|
||||
class ProtocolError(Exception):
|
||||
|
@ -102,11 +142,12 @@ class Status(object):
|
|||
"Source: %d, flags 0x%x" %
|
||||
(self.source, self.source_flags)
|
||||
]
|
||||
'''
|
||||
if debug == 2:
|
||||
|
||||
if gstt.debug == 2:
|
||||
print()
|
||||
for l in lines:
|
||||
print prefix + l
|
||||
'''
|
||||
print(prefix + l)
|
||||
|
||||
|
||||
class BroadcastPacket(object):
|
||||
"""Represents a broadcast packet from the DAC."""
|
||||
|
@ -128,9 +169,10 @@ class BroadcastPacket(object):
|
|||
"Capabilities: max %d points, %d kpps" %
|
||||
(self.buffer_capacity, self.max_point_rate)
|
||||
]
|
||||
print()
|
||||
for l in lines:
|
||||
print prefix + l
|
||||
if debug == 1:
|
||||
print(prefix + l)
|
||||
if gstt.debug > 1:
|
||||
self.status.dump(prefix)
|
||||
|
||||
|
||||
|
@ -168,7 +210,7 @@ class DAC(object):
|
|||
for e in l_steps:
|
||||
step = e[0]
|
||||
|
||||
for i in xrange(0,e[1]):
|
||||
for i in range(0,e[1]):
|
||||
|
||||
self.xyrgb_step = (self.xyrgb_prev[0] + step*delta_x, self.xyrgb_prev[1] + step*delta_y) + self.xyrgb[2:]
|
||||
yield self.xyrgb_step
|
||||
|
@ -178,7 +220,7 @@ class DAC(object):
|
|||
|
||||
def GetPoints(self, n):
|
||||
|
||||
d = [self.newstream.next() for i in xrange(n)]
|
||||
d = [next(self.newstream) for i in range(n)]
|
||||
#print d
|
||||
return d
|
||||
|
||||
|
@ -189,13 +231,13 @@ class DAC(object):
|
|||
|
||||
c = xyc[2]
|
||||
|
||||
#print ""
|
||||
#print "pygame point",[(xyc[0],xyc[1],xyc[2])]
|
||||
#print("")
|
||||
#print("pygame point",[(xyc[0],xyc[1],xyc[2])])
|
||||
#gstt.EDH[self.mylaser]= np.array(ast.literal_eval(r.get('/EDH/'+str(self.mylaser))))
|
||||
position = homographyp.apply(gstt.EDH[self.mylaser],np.array([(xyc[0],xyc[1])]))
|
||||
|
||||
#print "etherdream point",position[0][0], position[0][1], ((c >> 16) & 0xFF) << 8, ((c >> 8) & 0xFF) << 8, (c & 0xFF) << 8
|
||||
#print ''
|
||||
#print("etherdream point",position[0][0], position[0][1], ((c >> 16) & 0xFF) << 8, ((c >> 8) & 0xFF) << 8, (c & 0xFF) << 8)
|
||||
|
||||
return (position[0][0], position[0][1], ((c >> 16) & 0xFF) << 8, ((c >> 8) & 0xFF) << 8, (c & 0xFF) << 8)
|
||||
|
||||
|
||||
|
@ -210,19 +252,21 @@ class DAC(object):
|
|||
|
||||
def readresp(self, cmd):
|
||||
"""Read a response from the DAC."""
|
||||
|
||||
|
||||
data = self.read(22)
|
||||
response = data[0]
|
||||
#print "laser response", self.mylaser, response
|
||||
gstt.lstt_dacanswers[self.mylaser] = response
|
||||
cmdR = data[1]
|
||||
cmdR = chr(data[1])
|
||||
status = Status(data[2:])
|
||||
|
||||
r.set('/lack/'+str(self.mylaser), response)
|
||||
|
||||
if cmdR != cmd:
|
||||
raise ProtocolError("expected resp for %r, got %r"
|
||||
% (cmd, cmdR))
|
||||
|
||||
if response != "a":
|
||||
if response != ord('a'):
|
||||
raise ProtocolError("expected ACK, got %r"
|
||||
% (response, ))
|
||||
|
||||
|
@ -233,44 +277,52 @@ class DAC(object):
|
|||
"""Connect to the DAC over TCP."""
|
||||
socket.setdefaulttimeout(2)
|
||||
|
||||
#print "init"
|
||||
self.mylaser = mylaser
|
||||
self.clientkey = r.get("/clientkey")
|
||||
#print "Laser",self.mylaser,"Got clientkey", self.clientkey
|
||||
#print "DAC", self.mylaser, "Handler process, connecting to", gstt.lasersIPS[mylaser]
|
||||
self.clientkey = r.get("/clientkey").decode('ascii')
|
||||
|
||||
#log.info("Tracer "+str(self.mylaser)+" connecting to "+ gstt.lasersIPS[mylaser])
|
||||
#print("DAC", self.mylaser, "Handler process, connecting to", gstt.lasersIPS[mylaser] )
|
||||
self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.connstatus = self.conn.connect_ex((gstt.lasersIPS[mylaser], port))
|
||||
#print "Connection status for", self.mylaser,":", self.connstatus
|
||||
if self.connstatus == 35 or self.connstatus == 64:
|
||||
log.err("Tracer "+ str(self.mylaser)+" ("+ gstt.lasersIPS[mylaser]+"): "+ackstate[str(self.connstatus)])
|
||||
else:
|
||||
print("Tracer "+ str(self.mylaser)+" ("+ gstt.lasersIPS[mylaser]+"): "+ackstate[str(self.connstatus)])
|
||||
|
||||
# ipconn state is -1 at startup (see gstt) and modified here
|
||||
r.set('/lack/'+str(self.mylaser), self.connstatus)
|
||||
gstt.lstt_ipconn[self.mylaser] = self.connstatus
|
||||
|
||||
self.buf = ""
|
||||
self.buf = b''
|
||||
# Upper case PL is the Point List number
|
||||
self.PL = PL
|
||||
|
||||
# Lower case pl is the actual point list coordinates
|
||||
self.pl = ast.literal_eval(r.get(self.clientkey + str(self.mylaser)))
|
||||
|
||||
|
||||
#pdb.set_trace()
|
||||
self.pl = ast.literal_eval(r.get(self.clientkey + str(self.mylaser)).decode('ascii'))
|
||||
if r.get('/EDH/'+str(self.mylaser)) == None:
|
||||
#print "Laser",self.mylaser,"NO EDH !! Computing one..."
|
||||
#print("Laser",self.mylaser,"NO EDH !! Computing one...")
|
||||
homographyp.newEDH(self.mylaser)
|
||||
else:
|
||||
gstt.EDH[self.mylaser] = np.array(ast.literal_eval(r.get('/EDH/'+str(self.mylaser))))
|
||||
#print "Laser",self.mylaser,"found its EDH in redis"
|
||||
|
||||
gstt.EDH[self.mylaser] = np.array(ast.literal_eval(r.get('/EDH/'+str(self.mylaser)).decode('ascii')))
|
||||
#print("Laser",self.mylaser,"found its EDH in redis")
|
||||
#print gstt.EDH[self.mylaser]
|
||||
|
||||
self.xyrgb = self.xyrgb_prev = (0,0,0,0,0)
|
||||
self.intensity = 65280
|
||||
self.newstream = self.OnePoint()
|
||||
|
||||
if gstt.debug >0:
|
||||
print "Init laser",self.mylaser,"asked for ckey", self.clientkey+str(self.mylaser)
|
||||
print("Tracer",self.mylaser,"init asked for ckey", self.clientkey+str(self.mylaser))
|
||||
if self.connstatus != 0:
|
||||
#print ""
|
||||
print "Connection ERROR",self.connstatus,"with laser", str(mylaser),":",str(gstt.lasersIPS[mylaser])
|
||||
#print "first 10 points in PL",self.PL, self.GetPoints(10)
|
||||
#print(""
|
||||
log.err("Connection ERROR " +str(self.connstatus)+" with laser "+str(mylaser)+" : "+str(gstt.lasersIPS[mylaser]))
|
||||
#print("first 10 points in PL",self.PL, self.GetPoints(10)
|
||||
else:
|
||||
print "Connection status for", self.mylaser,":", self.connstatus
|
||||
print("Connection status for DAC "+str(self.mylaser)+" : "+ str(self.connstatus))
|
||||
|
||||
|
||||
# Reference points
|
||||
|
@ -281,24 +333,24 @@ class DAC(object):
|
|||
|
||||
|
||||
def begin(self, lwm, rate):
|
||||
cmd = struct.pack("<cHI", "b", lwm, rate)
|
||||
#print "Begin newdac : Laser ", str(self.mylaser), " PL : ", str(self.PL)
|
||||
|
||||
cmd = struct.pack("<cHI", b'b', lwm, rate)
|
||||
print("Tracer", str(self.mylaser), "begin with PL : ", str(self.PL))
|
||||
self.conn.sendall(cmd)
|
||||
return self.readresp("b")
|
||||
|
||||
def update(self, lwm, rate):
|
||||
cmd = struct.pack("<cHI", "u", lwm, rate)
|
||||
print(("update", lwm, rate))
|
||||
cmd = struct.pack("<cHI", b'u', lwm, rate)
|
||||
self.conn.sendall(cmd)
|
||||
return self.readresp("u")
|
||||
|
||||
def encode_point(self, point):
|
||||
return pack_point(*point)
|
||||
return pack_point(self.mylaser, self.intensity, *point)
|
||||
|
||||
def write(self, points):
|
||||
epoints = map(self.encode_point, points)
|
||||
cmd = struct.pack("<cH", "d", len(epoints))
|
||||
self.conn.sendall(cmd + "".join(epoints))
|
||||
epoints = list(map(self.encode_point, points))
|
||||
cmd = struct.pack("<cH", b'd', len(epoints))
|
||||
self.conn.sendall(cmd + b''.join(epoints))
|
||||
return self.readresp("d")
|
||||
|
||||
def prepare(self):
|
||||
|
@ -326,7 +378,7 @@ class DAC(object):
|
|||
|
||||
def play_stream(self):
|
||||
|
||||
#print "laser", self.mylaser, "Pb : ",self.last_status.playback_state
|
||||
#print("laser", self.mylaser, "Pb : ",self.last_status.playback_state)
|
||||
|
||||
# error if etherdream is already playing state (from other source)
|
||||
if self.last_status.playback_state == 2:
|
||||
|
@ -340,40 +392,41 @@ class DAC(object):
|
|||
|
||||
while True:
|
||||
|
||||
#print "laser", self.mylaser, "Pb : ",self.last_status.playback_state
|
||||
#print("laser", self.mylaser, "Pb : ",self.last_status.playback_state)
|
||||
|
||||
order = int(r.get('/order/'+str(self.mylaser)))
|
||||
order = int(r.get('/order/'+str(self.mylaser)).decode('ascii'))
|
||||
#print("tracer", str(self.mylaser),"order", order, type(order)
|
||||
|
||||
if order == 0:
|
||||
|
||||
# USER point list
|
||||
self.pl = ast.literal_eval(r.get(self.clientkey+str(self.mylaser)))
|
||||
#print "laser", self.mylaser, " order 0 : pl : ",len(self.pl)
|
||||
self.pl = ast.literal_eval(r.get(self.clientkey+str(self.mylaser)).decode('ascii'))
|
||||
#print("Tracer : laser", self.mylaser, " order 0 : pl : ",len(self.pl))
|
||||
|
||||
else:
|
||||
|
||||
# Get the new EDH
|
||||
if order == 1:
|
||||
print "Laser",self.mylaser,"new EDH ORDER in redis"
|
||||
gstt.EDH[self.mylaser]= np.array(ast.literal_eval(r.get('/EDH/'+str(self.mylaser))))
|
||||
print("Tracer",self.mylaser,"new EDH ORDER in redis")
|
||||
gstt.EDH[self.mylaser]= np.array(ast.literal_eval(r.get('/EDH/'+str(self.mylaser)).decode('ascii')))
|
||||
# Back to user point list
|
||||
r.set('/order/'+str(self.mylaser), 0)
|
||||
|
||||
# BLACK point list
|
||||
if order == 2:
|
||||
print "Laser",self.mylaser,"BLACK ORDER in redis"
|
||||
print("Tracer",self.mylaser,"BLACK ORDER in redis")
|
||||
self.pl = black_points
|
||||
|
||||
# GRID point list
|
||||
if order == 3:
|
||||
print "Laser",self.mylaser,"GRID ORDER in redis"
|
||||
print("Tracer",self.mylaser,"GRID ORDER in redis")
|
||||
self.pl = grid_points
|
||||
|
||||
|
||||
# Resampler Change
|
||||
if order == 4:
|
||||
self.resampler = ast.literal_eval(r.get('/resampler/'+str(self.mylaser)))
|
||||
print "tracer resetting lsteps for", self.mylaser, ":",self.resampler
|
||||
self.resampler = ast.literal_eval(r.get('/resampler/'+str(self.mylaser)).decode('ascii'))
|
||||
print("Tracer", self.mylaser," : resetting lsteps for",self.resampler)
|
||||
gstt.stepshortline = self.resampler[0]
|
||||
gstt.stepslongline[0] = self.resampler[1]
|
||||
gstt.stepslongline[1] = self.resampler[2]
|
||||
|
@ -383,11 +436,33 @@ class DAC(object):
|
|||
|
||||
# Client Key change
|
||||
if order == 5:
|
||||
print "Laser",self.mylaser,"new clientkey",
|
||||
print("Tracer", self.mylaser, "new clientkey")
|
||||
self.clientkey = r.get('/clientkey')
|
||||
# Back to user point list order
|
||||
r.set('/order/'+str(self.mylaser), 0)
|
||||
|
||||
# Intensity change
|
||||
if order == 6:
|
||||
self.intensity = int(r.get('/intensity/' + str(self.mylaser)).decode('ascii')) << 8
|
||||
print("Tracer" , self.mylaser, "new Intensity", self.intensity)
|
||||
gstt.intensity[self.mylaser] = self.intensity
|
||||
r.set('/order/'+str(self.mylaser), "0")
|
||||
|
||||
# kpps change
|
||||
if order == 7:
|
||||
gstt.kpps[self.mylaser] = int(r.get('/kpps/' + str(self.mylaser)).decode('ascii'))
|
||||
print("Tracer",self.mylaser,"new kpps", gstt.kpps[self.mylaser])
|
||||
self.update(0, gstt.kpps[self.mylaser])
|
||||
r.set('/order/'+str(self.mylaser), "0")
|
||||
|
||||
# color balance change
|
||||
if order == 8:
|
||||
gstt.red[self.mylaser] = int(r.get('/red/' + str(self.mylaser)).decode('ascii'))
|
||||
gstt.green[self.mylaser] = int(r.get('/green/' + str(self.mylaser)).decode('ascii'))
|
||||
gstt.blue[self.mylaser] = int(r.get('/blue/' + str(self.mylaser)).decode('ascii'))
|
||||
print("Tracer",self.mylaser,"new color balance", gstt.red[self.mylaser], gstt.green[self.mylaser], gstt.blue[self.mylaser])
|
||||
r.set('/order/'+str(self.mylaser), "0")
|
||||
|
||||
|
||||
|
||||
r.set('/lstt/'+str(self.mylaser), self.last_status.playback_state)
|
||||
|
@ -403,15 +478,15 @@ class DAC(object):
|
|||
time.sleep(0.001)
|
||||
cap += 150
|
||||
|
||||
# print "Writing %d points" % (cap, )
|
||||
# print("Writing %d points" % (cap, ))
|
||||
#t0 = time.time()
|
||||
#print points
|
||||
self.write(points)
|
||||
#t1 = time.time()
|
||||
# print "Took %f" % (t1 - t0, )
|
||||
# print("Took %f" % (t1 - t0, )
|
||||
|
||||
if not started:
|
||||
print "starting laser", self.mylaser, "with", gstt.kpps[self.mylaser],"kpps"
|
||||
print("Tracer", self.mylaser, "starting with", gstt.kpps[self.mylaser],"kpps")
|
||||
self.begin(0, gstt.kpps[self.mylaser])
|
||||
started = 1
|
||||
|
||||
|
@ -426,24 +501,24 @@ def find_dac():
|
|||
data, addr = s.recvfrom(1024)
|
||||
bp = BroadcastPacket(data)
|
||||
|
||||
print "Packet from %s: " % (addr, )
|
||||
print(("Packet from %s: " % (addr, )))
|
||||
bp.dump()
|
||||
|
||||
|
||||
'''
|
||||
#Laser order bit 0 = 0
|
||||
if not order & (1 << (self.mylaser*2)):
|
||||
#print "laser",mylaser,"bit 0 : 0"
|
||||
#print("laser",mylaser,"bit 0 : 0")
|
||||
|
||||
# Laser bit 0 = 0 and bit 1 = 0 : USER PL
|
||||
if not order & (1 << (1+self.mylaser*2)):
|
||||
#print "laser",mylaser,"bit 1 : 0"
|
||||
#print("laser",mylaser,"bit 1 : 0")
|
||||
self.pl = ast.literal_eval(r.get('/pl/'+str(self.mylaser)))
|
||||
|
||||
else:
|
||||
# Laser bit 0 = 0 and bit 1 = 1 : New EDH
|
||||
#print "laser",mylaser,"bit 1 : 1"
|
||||
print "Laser",self.mylaser,"new EDH ORDER in redis"
|
||||
#print("laser",mylaser,"bit 1 : 1" )
|
||||
print("Laser",self.mylaser,"new EDH ORDER in redis"
|
||||
gstt.EDH[self.mylaser]= np.array(ast.literal_eval(r.get('/EDH/'+str(self.mylaser))))
|
||||
# Back to USER PL
|
||||
order = r.get('/order')
|
||||
|
@ -453,15 +528,15 @@ def find_dac():
|
|||
else:
|
||||
|
||||
# Laser bit 0 = 1
|
||||
print "laser",mylaser,"bit 0 : 1"
|
||||
print("laser",mylaser,"bit 0 : 1")
|
||||
|
||||
# Laser bit 0 = 1 and bit 1 = 0 : Black PL
|
||||
if not order & (1 << (1+self.mylaser*2)):
|
||||
#print "laser",mylaser,"bit 1 : 0"
|
||||
#print("laser",mylaser,"bit 1 : 0")
|
||||
self.pl = black_points
|
||||
|
||||
else:
|
||||
# Laser bit 0 = 1 and bit 1 = 1 : GRID PL
|
||||
#print "laser",mylaser,"bit 1 : 1"
|
||||
#print("laser",mylaser,"bit 1 : 1" )
|
||||
self.pl = grid_points
|
||||
'''
|
434
main.py
434
main.py
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/python2.7
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
'''
|
||||
LJ Laser Server v0.8.1
|
||||
LJ Laser Server v0.8.2
|
||||
|
||||
Inspiration for new WebUI icon menu :
|
||||
https://codepen.io/AlbertFeynman/pen/mjXeMV
|
||||
|
@ -11,74 +11,97 @@ Laser server + webUI servers (ws + OSC)
|
|||
|
||||
- get point list to draw : /pl/lasernumber
|
||||
- for report /lstt/lasernumber /lack/lasernumber /cap/lasernumber
|
||||
- A nice ws debug tool : websocat
|
||||
- a nice ws debug tool : websocat
|
||||
- a "plugin" is a generator that send points to LJ. Plugins if they have an open OSC port can be checked and restart if in the same computer.
|
||||
|
||||
Todo :
|
||||
|
||||
- If no plugin ping is not received, restart the plugin.
|
||||
- upgrade to python3
|
||||
|
||||
|
||||
All used ports:
|
||||
|
||||
8002 OSC incoming
|
||||
9001 WS communication with WebGUI
|
||||
9001 Websocket communication with WebGUI
|
||||
Plugins OSC Ports (see LJ.conf)
|
||||
|
||||
'''
|
||||
#import pdb
|
||||
|
||||
|
||||
print ""
|
||||
print ""
|
||||
print "LJ Laser Server"
|
||||
print "v0.8.2"
|
||||
print ""
|
||||
from libs3 import log
|
||||
print("")
|
||||
print("")
|
||||
log.infog("LJ Laser Server")
|
||||
log.infog("v0.8.2")
|
||||
print("")
|
||||
print("-h will display help")
|
||||
print("")
|
||||
|
||||
import redis
|
||||
import os
|
||||
ljpath = r'%s' % os.getcwd().replace('\\','/')
|
||||
|
||||
from libs import gstt, settings
|
||||
|
||||
import sys
|
||||
|
||||
#sys.path.append('libs3/')
|
||||
|
||||
from libs3 import gstt, settings
|
||||
gstt.ljpath= ljpath
|
||||
|
||||
log.info("Reading " + gstt.ConfigName + " setup file...")
|
||||
settings.Read()
|
||||
|
||||
# Arguments may alter .conf file so import settings first then cli
|
||||
from libs import cli
|
||||
from libs3 import cli
|
||||
|
||||
settings.Write()
|
||||
|
||||
from multiprocessing import Process, Queue, TimeoutError
|
||||
from multiprocessing import Process, set_start_method
|
||||
import random, ast
|
||||
|
||||
from libs import plugins, tracer, homographyp, commands, font1
|
||||
from libs3 import plugins
|
||||
|
||||
from libs3 import tracer3 as tracer
|
||||
from libs3 import homographyp, commands, font1
|
||||
#from webui import build
|
||||
|
||||
#import subprocess
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
#import midi
|
||||
|
||||
from OSC import OSCServer, OSCClient, OSCMessage
|
||||
from libs3 import OSC3
|
||||
from websocket_server import WebsocketServer
|
||||
#import socket
|
||||
import types, thread, time
|
||||
import types, _thread, time
|
||||
|
||||
|
||||
|
||||
r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0)
|
||||
# r = redis.StrictRedis(host=gstt.LjayServerIP , port=6379, db=0, password='-+F816Y+-')
|
||||
args =[0,0]
|
||||
|
||||
|
||||
def dac_process(number, pl):
|
||||
|
||||
import sys
|
||||
from libs3 import gstt
|
||||
|
||||
print("Starting dac process", number)
|
||||
|
||||
while True:
|
||||
try:
|
||||
d = tracer.DAC(number,pl)
|
||||
d.play_stream()
|
||||
|
||||
except Exception as e:
|
||||
|
||||
import sys, traceback
|
||||
if gstt.debug == 2:
|
||||
print '\n---------------------'
|
||||
print 'Exception: %s' % e
|
||||
print '- - - - - - - - - - -'
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
if gstt.debug > 0:
|
||||
log.err('\n---------------------')
|
||||
log.err('Exception: %s' % e)
|
||||
log.err('- - - - - - - - - - -')
|
||||
traceback.print_tb(sys.exc_info()[2])
|
||||
print "\n"
|
||||
print("\n")
|
||||
pass
|
||||
|
||||
except KeyboardInterrupt:
|
||||
|
@ -87,24 +110,24 @@ def dac_process(number, pl):
|
|||
|
||||
|
||||
#
|
||||
# webUI server
|
||||
# Servers init variables
|
||||
#
|
||||
|
||||
print "Laser client number :",gstt.SceneNumber
|
||||
print("Start Scene number :",gstt.SceneNumber)
|
||||
|
||||
print("WebUI connect to :", gstt.wwwIP)
|
||||
|
||||
serverIP = gstt.LjayServerIP
|
||||
print "Redis IP :", serverIP
|
||||
print("Redis IP :", serverIP)
|
||||
|
||||
oscserverIP = gstt.oscIPin
|
||||
print "OSCserver IP :", oscserverIP
|
||||
print("OSCserver IP :", oscserverIP)
|
||||
|
||||
nozoscIP = gstt.nozoscip
|
||||
print "Nozosc IP :", nozoscIP
|
||||
print("Nozosc IP :", nozoscIP)
|
||||
|
||||
debug = gstt.debug
|
||||
print "Debug :", debug
|
||||
|
||||
lasernumber = gstt.LaserNumber -1
|
||||
print "Lasers requested :", gstt.LaserNumber
|
||||
print("Debug :", debug)
|
||||
|
||||
|
||||
# Websocket listening port
|
||||
|
@ -115,7 +138,7 @@ wsPORT = 9001
|
|||
#oscIPin = "192.168.1.10"s
|
||||
oscserverIPin = serverIP
|
||||
|
||||
print "oscserverIPin", oscserverIPin
|
||||
print("oscserverIPin", oscserverIPin)
|
||||
oscserverPORTin = 8002
|
||||
|
||||
# OSC Client : to send OSC message to an IP port 8001
|
||||
|
@ -132,12 +155,29 @@ NozoscPORTout = plugins.Port("nozoid")
|
|||
planetIPout = nozoscIP
|
||||
planetPORTout = plugins.Port("planet")
|
||||
|
||||
'''
|
||||
# Bank0 OSC Client : to send OSC message to bank0 inport 8010
|
||||
bank0IPout = nozoscIP
|
||||
bank0PORTout = plugins.Port("bank0")
|
||||
'''
|
||||
|
||||
|
||||
oscserver = OSCServer( (oscserverIPin, oscserverPORTin) )
|
||||
#
|
||||
# DACs available checks ?
|
||||
#
|
||||
|
||||
|
||||
import socket
|
||||
|
||||
#retry = 1
|
||||
#delay = 1
|
||||
|
||||
|
||||
#
|
||||
# OSC
|
||||
#
|
||||
|
||||
oscserver = OSC3.OSCServer( (oscserverIPin, oscserverPORTin) )
|
||||
oscserver.timeout = 0
|
||||
OSCRunning = True
|
||||
|
||||
|
@ -153,8 +193,8 @@ def handler(path, tags, args, source):
|
|||
|
||||
oscpath = path.split("/")
|
||||
if gstt.debug > 0:
|
||||
print ""
|
||||
print "OSC handler in main said : path", path," oscpath ", oscpath," args", args
|
||||
print("")
|
||||
print("OSC handler in main said : path", path," oscpath ", oscpath," args", args)
|
||||
|
||||
if oscpath[1] != "pong":
|
||||
sendWSall(path + " " + str(args[0]))
|
||||
|
@ -172,10 +212,12 @@ def osc_frame():
|
|||
|
||||
def PingAll():
|
||||
|
||||
print ("Pinging all plugins...")
|
||||
for plugin in gstt.plugins.keys():
|
||||
if gstt.debug > 0:
|
||||
print("Pinging all plugins...")
|
||||
|
||||
print("pinging", plugin)
|
||||
for plugin in list(gstt.plugins.keys()):
|
||||
if gstt.debug > 0:
|
||||
print("pinging", plugin)
|
||||
#sendWSall("/"+ plugin + "/start 0")
|
||||
plugins.Ping(plugin)
|
||||
|
||||
|
@ -192,49 +234,59 @@ def osc_thread():
|
|||
osc_frame()
|
||||
for laserid in range(0,gstt.LaserNumber): # Laser not used -> led is not lit
|
||||
|
||||
lstt = r.get('/lstt/'+ str(laserid))
|
||||
#print "laserid", laserid,"lstt",lstt
|
||||
if lstt == "0": # Dac IDLE state(0) -> led is blue (3)
|
||||
lstate = {'0': 'IDLE', '1': 'PREPARE', '2': "PLAYING", '64': "NOCONNECTION ?" }
|
||||
lstt = r.get('/lstt/'+ str(laserid)).decode('ascii')
|
||||
#print ("laserid", laserid,"lstt",lstt, type(lstt))
|
||||
if gstt.debug >1:
|
||||
print("DAC", laserid, "is in (lstt) :", lstt , lstate[str(lstt)])
|
||||
if lstt == "0": # Dac IDLE state(0) -> led is blue (3)
|
||||
sendWSall("/lstt/" + str(laserid) + " 3")
|
||||
if lstt == "1": # Dac PREPARE state (1) -> led is cyan (2)
|
||||
|
||||
if lstt == "1": # Dac PREPARE state (1) -> led is cyan (2)
|
||||
sendWSall("/lstt/" + str(laserid) + " 2")
|
||||
if lstt == "2": # Dac PLAYING (2) -> led is green (1)
|
||||
|
||||
if lstt == "2": # Dac PLAYING (2) -> led is green (1)
|
||||
sendWSall("/lstt/" + str(laserid) + " 1")
|
||||
|
||||
|
||||
lack= r.get('/lack/'+str(laserid))
|
||||
ackstate = {'61': 'ACK', '46': 'FULL', '49': "INVALID", '21': 'STOP', '64': "NOCONNECTION ?", '35': "NOCONNECTION ?" , '97': 'ACK', '70': 'FULL', '73': "INVALID", '33': 'STOP', '100': "NOCONNECTION", '48': "NOCONNECTION", 'a': 'ACK', 'F': 'FULL', 'I': "INVALID", '!': 'STOP', 'd': "NOCONNECTION", '0': "NOCONNECTION"}
|
||||
lack= r.get('/lack/'+str(laserid)).decode('ascii')
|
||||
|
||||
if gstt.debug >1:
|
||||
print "laserid", laserid, "lack", lack
|
||||
if lack == 'a': # Dac sent ACK ("a") -> led is green (1)
|
||||
print("DAC", laserid, "answered (lack):", lack, chr(int(lack)), ackstate[str(lack)])
|
||||
|
||||
if chr(int(lack)) == 'a': # Dac sent ACK ("a") -> led is green (1)
|
||||
sendWSall("/lack/" + str(laserid) +" 1")
|
||||
if lack == 'F': # Dac sent FULL ("F") -> led is orange (5)
|
||||
|
||||
if chr(int(lack)) == 'F': # Dac sent FULL ("F") -> led is orange (5)
|
||||
sendWSall("/lack/" + str(laserid) +" 5")
|
||||
if lack == 'I': # Dac sent INVALID ("I") -> led is yellow (4)
|
||||
|
||||
if chr(int(lack)) == 'I': # Dac sent INVALID ("I") -> led is yellow (4)
|
||||
sendWSall("/lack/" + str(laserid)+" 4")
|
||||
#print lack
|
||||
|
||||
if lack == "64" or lack =="35": # no connection to dac -> leds are red (6)
|
||||
sendWSall("/lack/" + str(laserid) + " 0")
|
||||
sendWSall("/lstt/" + str(laserid) + " 0")
|
||||
if lack == "64" or lack =="35": # no connection to dac -> leds are red (6)
|
||||
sendWSall("/lack/" + str(laserid) + " 6")
|
||||
sendWSall("/lstt/" + str(laserid) + " 6")
|
||||
#sendWSall("/lstt/" + str(laserid) + " 0")
|
||||
sendWSall("/points/" + str(laserid) + " 0")
|
||||
sendWSall("/points/" + str(laserid) + " 6")
|
||||
|
||||
else:
|
||||
# last number of points sent to etherdream buffer
|
||||
sendWSall("/points/" + str(laserid) + " " + str(r.get('/cap/'+str(laserid))))
|
||||
sendWSall("/points/" + str(laserid) + " " + str(r.get('/cap/'+str(laserid)).decode('ascii')))
|
||||
|
||||
#print "Sending simu frame from",'/pl/'+str(gstt.SceneNumber)+'/'+str(gstt.Laser)
|
||||
#print r.get('/pl/'+str(gstt.SceneNumber)+'/'+str(gstt.Laser))
|
||||
sendWSall("/simul" +" "+ r.get('/pl/'+str(gstt.SceneNumber)+'/'+str(gstt.Laser)))
|
||||
sendWSall("/simul" +" "+ str(r.get('/pl/'+str(gstt.SceneNumber)+'/'+str(gstt.Laser)).decode('ascii')))
|
||||
|
||||
|
||||
except Exception as e:
|
||||
import sys, traceback
|
||||
print '\n---------------------'
|
||||
print 'Exception: %s' % e
|
||||
print '- - - - - - - - - - -'
|
||||
print('\n---------------------')
|
||||
print('Exception: %s' % e)
|
||||
print('- - - - - - - - - - -')
|
||||
traceback.print_tb(sys.exc_info()[2])
|
||||
print "\n"
|
||||
print("\n")
|
||||
|
||||
#
|
||||
# Websocket part
|
||||
|
@ -244,13 +296,21 @@ def osc_thread():
|
|||
def new_client(client, wserver):
|
||||
|
||||
print("New WS client connected and was given id %d" % client['id'])
|
||||
sendWSall("/status Hello %d" % client['id'])
|
||||
sendWSall("/status Hello " + str(client['id']))
|
||||
|
||||
for laserid in range(0,gstt.LaserNumber):
|
||||
|
||||
sendWSall("/ip/" + str(laserid) + " " + str(gstt.lasersIPS[laserid]))
|
||||
sendWSall("/kpps/" + str(laserid)+ " " + str(gstt.kpps[laserid]))
|
||||
sendWSall("/laser"+str(laserid)+"/start 1")
|
||||
#sendWSall("/laser"+str(laserid)+"/start 1")
|
||||
sendWSall("/laser "+str(laserid))
|
||||
#print("/laser "+str(laserid))
|
||||
sendWSall("/lack/" + str(laserid) + " 6")
|
||||
#print("/lack/" + str(laserid) + " 6")
|
||||
sendWSall("/lstt/" + str(laserid) + " 6")
|
||||
#print("/lstt/" + str(laserid) + " 6")
|
||||
sendWSall("/points/" + str(laserid) + " 0")
|
||||
#print("/points/" + str(laserid) + " 0")
|
||||
|
||||
if gstt.swapX[laserid] == 1:
|
||||
sendWSall("/swap/X/" + str(laserid)+ " 1")
|
||||
|
@ -270,33 +330,33 @@ def client_left(client, wserver):
|
|||
# Called for each WS received message.
|
||||
def message_received(client, wserver, message):
|
||||
|
||||
if len(message) > 200:
|
||||
message = message[:200]+'..'
|
||||
#if len(message) > 200:
|
||||
# message = message[:200]+'..'
|
||||
|
||||
#if gstt.debug >0:
|
||||
# print ("")
|
||||
# print("WS Client(%d) said: %s" % (client['id'], message))
|
||||
|
||||
print("")
|
||||
|
||||
oscpath = message.split(" ")
|
||||
#print "WS Client", client['id'], "said :", message, "splitted in an oscpath :", oscpath
|
||||
if gstt.debug > 0:
|
||||
print "WS Client", client['id'], "said :", message, "splitted in an oscpath :", oscpath
|
||||
print("WS Client", client['id'], "said :", message, "splitted in an oscpath :", oscpath)
|
||||
|
||||
PingAll()
|
||||
message4plugin = False
|
||||
|
||||
# WS received Message is for a plugin ?
|
||||
|
||||
for plugin in gstt.plugins.keys():
|
||||
for plugin in list(gstt.plugins.keys()):
|
||||
|
||||
if oscpath[0].find(plugin) != -1:
|
||||
|
||||
message4plugin = True
|
||||
if plugins.Send(plugin,oscpath):
|
||||
print "message sent correctly to", plugin
|
||||
#print(oscpath)
|
||||
if plugins.Send(plugin, oscpath):
|
||||
print("plugins sent incoming WS correctly to", plugin)
|
||||
else:
|
||||
print"plugin was offline"
|
||||
print("plugins detected", plugin, "offline.")
|
||||
|
||||
|
||||
# WS received message is an LJ command
|
||||
|
@ -307,15 +367,12 @@ def message_received(client, wserver, message):
|
|||
args[0] = "noargs"
|
||||
#print "noargs command"
|
||||
|
||||
|
||||
elif len(oscpath) > 1:
|
||||
args[0] = str(oscpath[1])
|
||||
#print "arg",oscpath[1]
|
||||
|
||||
commands.handler(oscpath[0].split("/"),args)
|
||||
|
||||
print ""
|
||||
|
||||
|
||||
# if needed a loop back : WS Client -> server -> WS Client
|
||||
#sendWSall("ws"+message)
|
||||
|
@ -337,116 +394,169 @@ midi.InConfig()
|
|||
midi.OutConfig()
|
||||
'''
|
||||
|
||||
# Creating a startup point list for each client : 0,1,2,...
|
||||
# Creating a startup point list for each laser : 0,1,2,...
|
||||
|
||||
print ""
|
||||
for clientid in range(0,gstt.MaxScenes+1):
|
||||
print "Creating startup point lists for client",clientid,"..."
|
||||
digit_points = font1.DigitsDots(clientid,65280)
|
||||
print("")
|
||||
log.info("Creating startup point lists...")
|
||||
|
||||
|
||||
if r.set("/clientkey","/pl/"+str(gstt.SceneNumber)+"/")==True:
|
||||
print("sent clientkey : /pl/"+str(gstt.SceneNumber)+"/")
|
||||
|
||||
#pdb.set_trace()
|
||||
for sceneid in range(0,gstt.MaxScenes+1):
|
||||
print("Scene "+ str(sceneid))
|
||||
#digit_points = font1.DigitsDots(sceneid,65280)
|
||||
|
||||
# Order all lasers to show the laser client number at startup -> tell all 4 laser process to USER PLs
|
||||
for laserid in range(0,gstt.LaserNumber):
|
||||
|
||||
if r.set('/pl/'+str(clientid)+'/'+str(laserid), str(digit_points)) == True:
|
||||
print "/pl/"+str(clientid)+"/"+str(laserid)+" ", ast.literal_eval(r.get('/pl/'+str(clientid)+'/'+str(laserid)))
|
||||
digit_points = font1.DigitsDots(laserid,65280)
|
||||
if r.set('/pl/'+str(sceneid)+'/'+str(laserid), str(digit_points)) == True:
|
||||
pass
|
||||
#print( ast.literal_eval(r.get('/pl/'+str(sceneid)+'/'+str(laserid)).decode('ascii')))
|
||||
#print("/pl/"+str(sceneid)+"/"+str(laserid)+" "+str(ast.literal_eval(r.get('/pl/'+str(sceneid)+'/'+str(laserid)).decode('ascii'))))
|
||||
|
||||
r.set('/order/'+str(laserid), 0)
|
||||
|
||||
if r.set("/clientkey","/pl/"+str(gstt.SceneNumber)+"/")==True:
|
||||
print "sent clientkey : /pl/"+str(gstt.SceneNumber)+"/"
|
||||
#
|
||||
# Starts one DAC process per requested Laser
|
||||
#
|
||||
|
||||
print ""
|
||||
print "Etherdream connection check is NOT DISPLAYED"
|
||||
def fff(name):
|
||||
print()
|
||||
print('HELLO', name ) #indent
|
||||
print()
|
||||
|
||||
# Launch one process (a newdacp instance) by etherdream
|
||||
if __name__ == '__main__':
|
||||
|
||||
print ""
|
||||
dac_worker0= Process(target=dac_process,args=(0,0))
|
||||
print "Launching Laser 0 Process..."
|
||||
dac_worker0.start()
|
||||
# Bug in 3.8.4 MacOS default multiprocessing start method is spawn. Spawn doesn't work properly
|
||||
set_start_method('fork')
|
||||
|
||||
if lasernumber >0:
|
||||
dac_worker1= Process(target=dac_process,args=(1,0))
|
||||
print "Launching Laser 1 Process..."
|
||||
dac_worker1.start()
|
||||
print("")
|
||||
if gstt.LaserNumber == -1:
|
||||
log.infog("Autodetected DACs mode")
|
||||
commands.DAChecks()
|
||||
print("dacs", gstt.dacs)
|
||||
|
||||
if lasernumber >1:
|
||||
dac_worker2= Process(target=dac_process,args=(2,0))
|
||||
print "Launching Laser 2 Process..."
|
||||
dac_worker2.start()
|
||||
else:
|
||||
log.infog("Resquested DACs mode")
|
||||
|
||||
if lasernumber >2:
|
||||
dac_worker3= Process(target=dac_process,args=(3,0))
|
||||
print "Launching Laser 3 Process..."
|
||||
dac_worker3.start()
|
||||
lasernumber = gstt.LaserNumber -1
|
||||
print("LaserNumber = ", gstt.LaserNumber)
|
||||
|
||||
|
||||
# Main loop do nothing. Maybe do the webui server ?
|
||||
try:
|
||||
#while True:
|
||||
log.info("Starting "+str(gstt.LaserNumber) + " DACs process...")
|
||||
|
||||
# Websocket startup
|
||||
wserver = WebsocketServer(wsPORT,host=serverIP)
|
||||
plugins.Init(wserver)
|
||||
# Launch one process (a newdacp instance) by etherdream
|
||||
dac_worker0= Process(target=dac_process, args=(0,0,))
|
||||
dac_worker0.start()
|
||||
print("Tracer 0 : name", dac_worker0.name , "pid", dac_worker0.pid )
|
||||
|
||||
# Launch OSC thread listening to oscserver
|
||||
print ""
|
||||
print "Launching OSC server..."
|
||||
print "at", oscserverIPin, "port",str(oscserverPORTin)
|
||||
print "Will update webUI dac status every second"
|
||||
oscserver.addMsgHandler( "/noteon", commands.NoteOn )
|
||||
# Default OSC handler for all OSC incoming message
|
||||
oscserver.addMsgHandler("default", handler)
|
||||
thread.start_new_thread(osc_thread, ())
|
||||
|
||||
|
||||
|
||||
#print wserver
|
||||
print ""
|
||||
print "Launching webUI Websocket server..."
|
||||
print "at", serverIP, "port",wsPORT
|
||||
wserver.set_fn_new_client(new_client)
|
||||
wserver.set_fn_client_left(client_left)
|
||||
wserver.set_fn_message_received(message_received)
|
||||
print ""
|
||||
print "Resetting all Homographies.."
|
||||
for laserid in range(0,gstt.LaserNumber):
|
||||
homographyp.newEDH(laserid)
|
||||
print ""
|
||||
print "WS server running forever..."
|
||||
wserver.run_forever()
|
||||
|
||||
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
# Gently stop on CTRL C
|
||||
|
||||
finally:
|
||||
|
||||
dac_worker0.join()
|
||||
if lasernumber >0:
|
||||
dac_worker1.join()
|
||||
dac_worker1= Process(target=dac_process, args=(1,0,))
|
||||
print("Tracer 1 : name", dac_worker1.name , "pid", dac_worker1.pid )
|
||||
dac_worker1.start()
|
||||
|
||||
if lasernumber >1:
|
||||
dac_worker2.join()
|
||||
dac_worker2= Process(target=dac_process, args=(2,0,))
|
||||
dac_worker2.start()
|
||||
print("Tracer 2 : name", dac_worker2.name , "pid", dac_worker2.pid )
|
||||
|
||||
if lasernumber >2:
|
||||
dac_worker3.join()
|
||||
dac_worker3= Process(target=dac_process, args=(3,0,))
|
||||
print("Tracer 3 : name", dac_worker3.name , "pid", dac_worker3.pid )
|
||||
dac_worker3.start()
|
||||
print("")
|
||||
#def Run():
|
||||
|
||||
#
|
||||
# Main loop do nothing. Maybe do the webui server ?
|
||||
#
|
||||
|
||||
try:
|
||||
#while True:
|
||||
|
||||
# Websocket startup
|
||||
wserver = WebsocketServer(wsPORT,host=serverIP)
|
||||
plugins.Init(wserver)
|
||||
|
||||
log.info("Starting servers...")
|
||||
# Launch OSC thread listening to oscserver
|
||||
print("Launching OSC server...")
|
||||
print("at", oscserverIPin, "port",str(oscserverPORTin))
|
||||
#print("Will update webUI dac status every second")
|
||||
oscserver.addMsgHandler( "/noteon", commands.NoteOn)
|
||||
oscserver.addMsgHandler( "/scim", commands.Scim)
|
||||
oscserver.addMsgHandler( "/line1", commands.Line1)
|
||||
oscserver.addMsgHandler( "/forwardui", commands.ForwardUI)
|
||||
# Default OSC handler for all OSC incoming message
|
||||
oscserver.addMsgHandler("default", handler)
|
||||
_thread.start_new_thread(osc_thread, ())
|
||||
|
||||
#print wserver
|
||||
print("Launching webUI Websocket server...")
|
||||
print("at", serverIP, "port",wsPORT)
|
||||
wserver.set_fn_new_client(new_client)
|
||||
wserver.set_fn_client_left(client_left)
|
||||
wserver.set_fn_message_received(message_received)
|
||||
print("")
|
||||
log.info("Resetting all Homographies...")
|
||||
for laserid in range(0,gstt.LaserNumber):
|
||||
homographyp.newEDH(laserid)
|
||||
|
||||
# plugins autostart
|
||||
print("")
|
||||
log.info("Plugins startup...")
|
||||
|
||||
if gstt.autostart != "":
|
||||
|
||||
for pluginname in gstt.autostart.split(","):
|
||||
print("Autostarting", pluginname, "...")
|
||||
plugins.Start(pluginname)
|
||||
|
||||
print("")
|
||||
log.infog("LJ server running...")
|
||||
|
||||
wserver.run_forever()
|
||||
|
||||
|
||||
for laserid in range(0,lasernumber+1):
|
||||
print "Laser",laserid,"feedbacks reset."
|
||||
r.set('/lack/'+str(laserid),64)
|
||||
r.set('/lstt/'+str(laserid),64)
|
||||
r.set('/cap/'+str(laserid),0)
|
||||
except Exception:
|
||||
log.err("Exception")
|
||||
traceback.print_exc()
|
||||
|
||||
print "Fin de LJ."
|
||||
except Restart(moment):
|
||||
print("Autokill asked at", moment)
|
||||
|
||||
# Gently stop on CTRL C
|
||||
|
||||
finally:
|
||||
|
||||
dac_worker0.join()
|
||||
if lasernumber >0:
|
||||
dac_worker1.join()
|
||||
if lasernumber >1:
|
||||
dac_worker2.join()
|
||||
if lasernumber >2:
|
||||
dac_worker3.join()
|
||||
|
||||
|
||||
'''
|
||||
Some code previously used, for reference :
|
||||
for laserid in range(0,lasernumber+1):
|
||||
print("Laser",laserid,"feedbacks resetting...")
|
||||
r.set('/lack/'+str(laserid),64)
|
||||
r.set('/lstt/'+str(laserid),64)
|
||||
r.set('/cap/'+str(laserid),0)
|
||||
|
||||
random_points = [(300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 0), (500.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280), (500.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280)]
|
||||
'''
|
||||
print("Fin de LJ.")
|
||||
|
||||
#if __name__ == "__main__":
|
||||
# Run()
|
||||
|
||||
'''
|
||||
Some code previously used, for reference :
|
||||
|
||||
random_points = [(300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 0), (500.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280), (500.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 400.0+random.randint(-100, 100), 65280), (300.0+random.randint(-100, 100), 200.0+random.randint(-100, 100), 65280)]
|
||||
'''
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,750 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
|
||||
'''
|
||||
LJ v0.8.1
|
||||
|
||||
IdiotIA for THSF 10
|
||||
|
||||
Include IdiotIA and Starfields
|
||||
|
||||
/pose/ljclient
|
||||
|
||||
LICENCE : CC
|
||||
Sam Neurohack, Loloster,
|
||||
|
||||
'''
|
||||
|
||||
|
||||
import math
|
||||
|
||||
import numpy as np
|
||||
import pdb
|
||||
from datetime import datetime
|
||||
from random import randrange
|
||||
import redis
|
||||
import sys
|
||||
|
||||
import time,traceback
|
||||
import os
|
||||
ljpath = r'%s' % os.getcwd().replace('\\','/')
|
||||
# import from shell
|
||||
#sys.path.append('../../libs')
|
||||
#import from LJ
|
||||
sys.path.append(ljpath +'/libs/')
|
||||
print (ljpath+'/libs')
|
||||
import lj23
|
||||
from OSC3 import OSCServer, OSCClient, OSCMessage
|
||||
|
||||
import argparse
|
||||
|
||||
# 0.25 : each frame will be repeated 4 times.
|
||||
animspeed = 0.25
|
||||
|
||||
screen_size = [700,700]
|
||||
xy_center = [screen_size[0]/2,screen_size[1]/2]
|
||||
|
||||
message = "LO"
|
||||
OSCinPort = 8011
|
||||
oscrun = True
|
||||
ljclient = 0
|
||||
|
||||
idiotiaDisplay = [True,True,False,False]
|
||||
#idiotiaDisplay = [False,False,False,False]
|
||||
liveDisplay = [False,False,False,False]
|
||||
|
||||
fieldsDisplay = [False,False,True,True]
|
||||
#fieldsDisplay = [True,True,True,True]
|
||||
currentIdiotia = 0
|
||||
|
||||
print ("")
|
||||
print ("Arguments parsing if needed...")
|
||||
argsparser = argparse.ArgumentParser(description="Pose bank 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("-m","--myIP",help="Local IP (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("-v","--verbose",help="Verbosity level (0 by default)",type=int)
|
||||
argsparser.add_argument("-a","--anim",help="IdiotIA anim (0 by default)",type=int)
|
||||
argsparser.add_argument("-L","--Lasers",help="Number of lasers connected (4 by default).",type=int)
|
||||
|
||||
args = argsparser.parse_args()
|
||||
|
||||
|
||||
if args.verbose:
|
||||
debug = args.verbose
|
||||
else:
|
||||
debug = 0
|
||||
|
||||
if args.client:
|
||||
ljclient = args.client
|
||||
else:
|
||||
ljclient = 0
|
||||
|
||||
if args.anim:
|
||||
currentIdiotia = args.anim
|
||||
else:
|
||||
currentIdiotia = 0
|
||||
|
||||
# Redis Computer IP
|
||||
if args.redisIP != None:
|
||||
redisIP = args.redisIP
|
||||
else:
|
||||
redisIP = '127.0.0.1'
|
||||
|
||||
# myIP
|
||||
if args.myIP != None:
|
||||
myIP = args.myIP
|
||||
else:
|
||||
myIP = '127.0.0.1'
|
||||
|
||||
# Lasers = number of laser connected
|
||||
if args.Lasers != None:
|
||||
LaserNumber = args.Lasers
|
||||
else:
|
||||
LaserNumber = 4
|
||||
|
||||
|
||||
lj23.Config(redisIP,ljclient,"pose")
|
||||
|
||||
|
||||
|
||||
def hex2rgb(hexcode):
|
||||
return tuple(map(ord,hexcode[1:].decode('hex')))
|
||||
|
||||
|
||||
def rgb2hex(rgb):
|
||||
return int('0x%02x%02x%02x' % tuple(rgb),0)
|
||||
|
||||
|
||||
# IdiotIA
|
||||
import json
|
||||
#CurrentPose = 1
|
||||
|
||||
# Get frame number for pose path describe in PoseDir
|
||||
def lengthPOSE(pose_dir):
|
||||
|
||||
#if debug > 0:
|
||||
# print("Check directory",'poses/' + pose_dir)
|
||||
if os.path.exists('poses/' + pose_dir):
|
||||
numfiles = sum(1 for f in os.listdir('poses/' + pose_dir) if os.path.isfile(os.path.join('poses/' + pose_dir + '/', f)) and f[0] != '.')
|
||||
return numfiles
|
||||
else:
|
||||
if debug > 0:
|
||||
print("but it doesn't even exist!")
|
||||
return 0
|
||||
|
||||
|
||||
def prepareIdiotIA(currentAnim):
|
||||
|
||||
WebStatus("Checking anims...")
|
||||
print()
|
||||
print("Reading available IdiotIA anims...")
|
||||
# anim format (name, xpos, ypos, resize, currentframe, totalframe, count, speed)
|
||||
# 0 1 2 3 4 5 6 7
|
||||
# total frames is fetched from directory by lengthPOSE()
|
||||
|
||||
anims[0] = ['boredhh' , xy_center[0] - 100, xy_center[1] + 30, 550, 0, 0, 0, animspeed]
|
||||
anims[1] = ['belka4' , xy_center[0] - 70, xy_center[1] + 380, 680, 0, 0, 0, animspeed]
|
||||
anims[2] = ['belka3' , xy_center[0] - 100, xy_center[1] + 360, 700, 0, 0, 0, animspeed]
|
||||
anims[3] = ['hhhead' , xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[4] = ['hhhead2', xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[5] = ['hhhead4', xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
anims[6] = ['hhred' , xy_center[0] - 250, xy_center[1] + 220, 550, 0, 0, 0, animspeed]
|
||||
anims[7] = ['hhred2' , xy_center[0] - 200, xy_center[1] + 200, 550, 0, 0, 0, animspeed]
|
||||
anims[8] = ['lady1' , xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[9] = ['lady1' , xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
anims[10] = ['lady2' , xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
anims[11] = ['lady3' , xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[12] = ['lady4' , xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[13] = ['mila6' , xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
anims[14] = ['mila5' , xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
anims[15] = ['idiotia1', xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[16] = ['idiotia1', xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[17] = ['belka4', xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
anims[18] = ['belka3', xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
|
||||
#for laseranims in anims:
|
||||
|
||||
for anim in anims:
|
||||
#print(anim)
|
||||
anim[5] = lengthPOSE(anim[0])
|
||||
WebStatus("Checking "+ anim[0] +"...")
|
||||
if debug > 0:
|
||||
print('poses/' + anim[0], "length :", anim[5], "frames")
|
||||
|
||||
print("Current IdiotIA anim is",anims[currentIdiotia][0],"("+str(currentIdiotia)+")")
|
||||
|
||||
|
||||
# get absolute face position points
|
||||
def getFACE(pose_json,pose_points, people):
|
||||
|
||||
dots = []
|
||||
for dot in pose_points:
|
||||
|
||||
if len(pose_json['people'][people]['face_keypoints_2d']) != 0:
|
||||
#print "people 0"
|
||||
if pose_json['people'][people]['face_keypoints_2d'][dot * 3] != -1 and pose_json['people'][people]['face_keypoints_2d'][(dot * 3)+1] != -1:
|
||||
dots.append((pose_json['people'][people]['face_keypoints_2d'][dot * 3], pose_json['people'][people]['face_keypoints_2d'][(dot * 3)+1]))
|
||||
|
||||
return dots
|
||||
|
||||
|
||||
# Face keypoints
|
||||
def face(pose_json, people):
|
||||
pose_points = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def browL(pose_json, people):
|
||||
pose_points = [26,25,24,23,22]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def browR(pose_json, people):
|
||||
pose_points = [21,20,19,18,17]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def eyeR(pose_json, people):
|
||||
pose_points = [36,37,38,39,40,41,36]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def eyeL(pose_json, people):
|
||||
pose_points = [42,43,44,45,46,47,42]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def pupR(pose_json, people):
|
||||
pose_points = [68,68]
|
||||
print(getFACE(pose_json,pose_points, people))
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def pupL(pose_json, people):
|
||||
pose_points = [69,69]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
|
||||
def nose(pose_json, people):
|
||||
pose_points = [27,28,29,30]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def mouth(pose_json, people):
|
||||
pose_points = [48,59,58,57,56,55,54,53,52,51,50,49,48,60,67,66,65,64,63,62,61,60]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
|
||||
|
||||
# display the currentIdiotia animation on all lasers according to display flag
|
||||
def IdiotIA():
|
||||
|
||||
# All laser loop
|
||||
for laser in range(LaserNumber):
|
||||
# for anim in anims[laseranims]:
|
||||
|
||||
# if display flag is True, send the face points.
|
||||
if idiotiaDisplay[laser]:
|
||||
|
||||
anim = anims[currentIdiotia]
|
||||
#print(anim)
|
||||
|
||||
PL = laser
|
||||
#print PL, anim
|
||||
|
||||
dots = []
|
||||
|
||||
# increase current frame [4] of speed [7] frames
|
||||
#print(anim[4],anim[7],anim[4]+anim[7])
|
||||
|
||||
anim[4] = anim[4]+anim[7]
|
||||
|
||||
# compare to total frame [5]
|
||||
if anim[4] >= anim[5]:
|
||||
anim[4] = 0
|
||||
|
||||
posename = 'poses/' + anim[0] + '/' + anim[0] +'-'+str("%05d"%int(anim[4]))+'.json'
|
||||
posefile = open(posename , 'r')
|
||||
posedatas = posefile.read()
|
||||
pose_json = json.loads(posedatas)
|
||||
|
||||
if debug>0:
|
||||
WebStatus("Frame : "+str("%05d"%int(anim[4])))
|
||||
|
||||
# Draw Face
|
||||
|
||||
for people in range(len(pose_json['people'])):
|
||||
|
||||
#lj23.rPolyLineOneColor(face(pose_json, people), c = white, PL = laser closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj23.rPolyLineOneColor(browL(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj23.rPolyLineOneColor(browR(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj23.rPolyLineOneColor(eyeR(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
#lj23.rPolyLineOneColor(pupR(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj23.rPolyLineOneColor(eyeL(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
#lj23.rPolyLineOneColor(pupL(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj23.rPolyLineOneColor(nose(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj23.rPolyLineOneColor(mouth(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
|
||||
lj23.DrawPL(PL)
|
||||
|
||||
|
||||
# Init Starfields
|
||||
def prepareSTARFIELD():
|
||||
global star, stars0, stars1, stars2, starfieldcount, starspeed, displayedstars, displayedstars, num_stars, max_depth
|
||||
|
||||
WebStatus("Init starfields...")
|
||||
stars0=[]
|
||||
stars1=[]
|
||||
stars2=[]
|
||||
#stars3=[]
|
||||
num_stars = 50
|
||||
max_depth = 20
|
||||
stars = []
|
||||
starfieldcount = 0
|
||||
displayedstars = 5
|
||||
starspeed = 0.05
|
||||
|
||||
for i in range(num_stars):
|
||||
# A star is represented as a list with this format: [X,Y,Z]
|
||||
star = [randrange(-25,25), randrange(-25,25), randrange(1, max_depth)]
|
||||
stars0.append(star)
|
||||
star = [randrange(-25,25), randrange(-25,25), randrange(1, max_depth)]
|
||||
stars1.append(star)
|
||||
star = [randrange(-25,25), randrange(-25,25), randrange(1, max_depth)]
|
||||
stars2.append(star)
|
||||
|
||||
|
||||
# Todo : Currently compute all starfields even if field display flag is False.
|
||||
|
||||
def Starfield(hori=0,verti=0):
|
||||
global star, stars0, stars1, stars2, starfieldcount, starspeed, displayedstars, displayedstars, num_stars, max_depth
|
||||
|
||||
starfieldcount += 1
|
||||
#print starfieldcount
|
||||
starpoints = []
|
||||
#print displayedstars, 'stars displayed'
|
||||
|
||||
# Increase number of
|
||||
if displayedstars < num_stars and starfieldcount % 15 == 0:
|
||||
displayedstars += 1
|
||||
|
||||
#if displayedstars == num_stars and starfieldcount % 10 == 0:
|
||||
# starspeed += 0.005
|
||||
|
||||
#print starspeed
|
||||
|
||||
for starnumber in range(0,displayedstars):
|
||||
|
||||
# The Z component is decreased on each frame.
|
||||
stars0[starnumber][2] -= starspeed * 3
|
||||
stars1[starnumber][2] -= starspeed * 3
|
||||
stars2[starnumber][2] -= starspeed * 3
|
||||
|
||||
# If the star has past the screen (I mean Z<=0) then we
|
||||
# reposition it far away from the screen (Z=max_depth)
|
||||
# with random X and Y coordinates.
|
||||
if stars0[starnumber][2] <= 0:
|
||||
stars0[starnumber][0] = randrange(-25,25)
|
||||
stars0[starnumber][1] = randrange(-25,25)
|
||||
stars0[starnumber][2] = max_depth
|
||||
|
||||
if stars1[starnumber][2] <= 0:
|
||||
stars1[starnumber][0] = randrange(-25,25)
|
||||
stars1[starnumber][1] = randrange(-25,25)
|
||||
stars1[starnumber][2] = max_depth
|
||||
|
||||
if stars2[starnumber][2] <= 0:
|
||||
stars2[starnumber][0] = randrange(-25,25)
|
||||
stars2[starnumber][1] = randrange(-25,25)
|
||||
stars2[starnumber][2] = max_depth
|
||||
|
||||
|
||||
# Convert the 3D coordinates to 2D using perspective projection.
|
||||
k0 = 128.0 / stars0[starnumber][2]
|
||||
k1 = 128.0 / stars1[starnumber][2]
|
||||
k2 = 128.0 / stars2[starnumber][2]
|
||||
|
||||
# Move Starfield origin.
|
||||
# if stars xpos/ypos is same sign (i.e left stars xpos is <0) than (joystick or code) acceleration (hori and verti moves the star field origin)
|
||||
if np.sign(stars0[starnumber][0]) == np.sign(hori):
|
||||
x0 = int(stars0[starnumber][0] * k0 + xy_center[0] + (hori*600))
|
||||
else:
|
||||
x0 = int(stars0[starnumber][0] * k0 + xy_center[0] + (hori*500))
|
||||
|
||||
if np.sign(stars0[starnumber][1]) == np.sign(verti):
|
||||
y0 = int(stars0[starnumber][1] * k0 + xy_center[1] + (verti*600))
|
||||
else:
|
||||
y0 = int(stars0[starnumber][1] * k0 + xy_center[1] + (verti*500))
|
||||
|
||||
|
||||
if np.sign(stars1[starnumber][0]) == np.sign(hori):
|
||||
x1 = int(stars1[starnumber][0] * k1 + xy_center[0] + (hori*600))
|
||||
else:
|
||||
x1 = int(stars1[starnumber][0] * k1 + xy_center[0] + (hori*300))
|
||||
|
||||
if np.sign(stars1[starnumber][1]) == np.sign(verti):
|
||||
y1 = int(stars1[starnumber][1] * k1 + xy_center[1] + (verti*600))
|
||||
else:
|
||||
y1 = int(stars1[starnumber][1] * k1 + xy_center[1] + (verti*300))
|
||||
|
||||
|
||||
if np.sign(stars2[starnumber][0]) == np.sign(hori):
|
||||
x2 = int(stars2[starnumber][0] * k2 + xy_center[0] + (hori*600))
|
||||
else:
|
||||
x2 = int(stars2[starnumber][0] * k2 + xy_center[0] + (hori*300))
|
||||
|
||||
if np.sign(stars2[starnumber][1]) == np.sign(verti):
|
||||
y2 = int(stars2[starnumber][1] * k2 + xy_center[1] + (verti*600))
|
||||
else:
|
||||
y2 = int(stars2[starnumber][1] * k2 + xy_center[1] + (verti*300))
|
||||
|
||||
|
||||
# Add star to pointlist PL 0 if field display flag is true
|
||||
if fieldsDisplay[0] and 0 <= x0 < screen_size[0] - 2 and 0 <= y0 < screen_size[1] - 2:
|
||||
lj23.PolyLineOneColor([(x0,y0),((x0+1),(y0+1))], c = white, PL = 0, closed = False)
|
||||
|
||||
# Add star to pointlist PL 1 if field display flag is true
|
||||
if fieldsDisplay[1] and 0 <= x1 < screen_size[0] - 2 and 0 <= y1 < screen_size[1] - 2:
|
||||
lj23.PolyLineOneColor([(x1,y1),((x1+1),(y1+1))], c = white, PL = 1, closed = False)
|
||||
|
||||
# Add star to pointlist PL 2 if field display flag is true
|
||||
if fieldsDisplay[2] and 0 <= x2 < screen_size[0] - 2 and 0 <= y2 < screen_size[1] - 2:
|
||||
lj23.PolyLineOneColor([(x2,y2),((x2+1),(y2+1))], c= white, PL = 2, closed = False)
|
||||
|
||||
'''
|
||||
if starfieldcount < 200:
|
||||
|
||||
if 0 <= x3 < screen_size[0] - 2 and 0 <= y3 < screen_size[1] - 2:
|
||||
fwork.PolyLineOneColor([(x3,y3),((x3+2),(y3+2))], c=colorify.rgb2hex([255,255,255]), PL = 3, closed = False)
|
||||
'''
|
||||
|
||||
# Laser 3 Display a word.
|
||||
if fieldsDisplay[3]:
|
||||
lj23.Text(message, white, PL = 3, xpos = 300, ypos = 300, resize = 1, rotx =0, roty =0 , rotz=0)
|
||||
|
||||
|
||||
|
||||
# If field display is True for each laser
|
||||
for laser in range(LaserNumber):
|
||||
|
||||
# Actually send the field point list.
|
||||
if fieldsDisplay[laser]:
|
||||
lj23.DrawPL(laser)
|
||||
|
||||
|
||||
# display the Realtime open pose face according to flag.
|
||||
def LiveFace():
|
||||
|
||||
# All laser loop
|
||||
for laser in range(LaserNumber):
|
||||
# for anim in anims[laseranims]:
|
||||
|
||||
# if display flag is True, send the face points.
|
||||
if liveDisplay[laser]:
|
||||
pass
|
||||
|
||||
|
||||
#
|
||||
# OSC
|
||||
#
|
||||
|
||||
oscserver = OSCServer( (myIP, OSCinPort) )
|
||||
oscserver.timeout = 0
|
||||
#oscrun = True
|
||||
|
||||
# this method of reporting timeouts only works by convention
|
||||
# that before calling handle_request() field .timed_out is
|
||||
# set to False
|
||||
def handle_timeout(self):
|
||||
self.timed_out = True
|
||||
|
||||
# funny python's way to add a method to an instance of a class
|
||||
import types
|
||||
oscserver.handle_timeout = types.MethodType(handle_timeout, oscserver)
|
||||
|
||||
# default handler
|
||||
def OSChandler(path, tags, args, source):
|
||||
|
||||
oscaddress = ''.join(path.split("/"))
|
||||
print("Default OSC Handler : msg from Client : " + str(source[0]),)
|
||||
print("OSC address", path, "with",)
|
||||
if len(args) > 0:
|
||||
print("args", args)
|
||||
else:
|
||||
print("noargs")
|
||||
#oscIPout = str(source[0])
|
||||
#osclient.connect((oscIPout, oscPORTout))
|
||||
|
||||
|
||||
|
||||
# RAW OSC Frame available ?
|
||||
def OSCframe():
|
||||
# clear timed_out flag
|
||||
#print "oscframe"
|
||||
oscserver.timed_out = False
|
||||
# handle all pending requests then return
|
||||
while not oscserver.timed_out:
|
||||
oscserver.handle_request()
|
||||
|
||||
|
||||
# Stop osc server
|
||||
def OSCstop():
|
||||
|
||||
oscserver.close()
|
||||
|
||||
|
||||
# /pose/idiotia/lasernumber 1
|
||||
def OSCidiotia(address, value):
|
||||
|
||||
|
||||
laser = int(address[14:])
|
||||
if debug > 0:
|
||||
print("pose idiotia got ",address,value)
|
||||
print("laser", laser, value)
|
||||
|
||||
if value == "1" or value == 1:
|
||||
|
||||
idiotiaDisplay[laser] = True
|
||||
liveDisplay[laser] = False
|
||||
fieldsDisplay[laser] = False
|
||||
print(idiotiaDisplay,liveDisplay,fieldsDisplay)
|
||||
|
||||
else:
|
||||
|
||||
idiotiaDisplay[laser] = False
|
||||
print(idiotiaDisplay,liveDisplay,fieldsDisplay)
|
||||
|
||||
UpdatePoseUI()
|
||||
|
||||
# /pose/anim/animnumber 1
|
||||
def OSCanim(address, value):
|
||||
global currentIdiotia
|
||||
|
||||
anim = int(address[11:])
|
||||
|
||||
if debug > 0:
|
||||
print("pose anim got :", address, type(value), value)
|
||||
print("anim", anim)
|
||||
|
||||
if value == "1" or value == 1:
|
||||
currentIdiotia = anim
|
||||
UpdatePoseUI()
|
||||
WebStatus("Running "+ anims[currentIdiotia][0]+"...")
|
||||
|
||||
|
||||
|
||||
# /pose/speed/speed value
|
||||
# value : 1 slower / 2 stop / 3 play / 4 faster
|
||||
def OSCspeed(address, value):
|
||||
global anims
|
||||
|
||||
speedflag = int(address[12:])
|
||||
|
||||
if debug > 0:
|
||||
print("pose speed got :", address, type(value), value)
|
||||
print("speed", speedflag)
|
||||
|
||||
if value == "1" or value == 1:
|
||||
# slower
|
||||
if speedflag == 1:
|
||||
anims[currentIdiotia][7] = 0.1
|
||||
UpdateSpeedUI()
|
||||
WebStatus("Pose speed is 0.1")
|
||||
|
||||
# stop
|
||||
if speedflag == 2:
|
||||
anims[currentIdiotia][7] = 0
|
||||
UpdateSpeedUI()
|
||||
WebStatus("Pose speed is stop")
|
||||
|
||||
# play
|
||||
if speedflag == 3:
|
||||
anims[currentIdiotia][7] = 0.25
|
||||
UpdateSpeedUI()
|
||||
WebStatus("Pose speed is 0.25")
|
||||
|
||||
# faster
|
||||
if speedflag == 4:
|
||||
anims[currentIdiotia][7] = 2
|
||||
UpdateSpeedUI()
|
||||
WebStatus("Pose speed is 2")
|
||||
|
||||
|
||||
|
||||
|
||||
# /pose/live/lasernumber value
|
||||
def OSClive(address, value):
|
||||
|
||||
print("live",address,value)
|
||||
laser = int(address[11:])
|
||||
#print("laser", laser, value)
|
||||
|
||||
if value == "1" or value == 1:
|
||||
idiotiaDisplay[laser] = False
|
||||
liveDisplay[laser] = True
|
||||
fieldsDisplay[laser] = False
|
||||
UpdatePoseUI()
|
||||
|
||||
# /pose/field/lasernumber value
|
||||
def OSCfield(address, value):
|
||||
|
||||
if debug >0:
|
||||
print("Pose field got", address, "with value", type(value), value)
|
||||
laser = int(address[12:])
|
||||
#print("laser", laser, value)
|
||||
|
||||
if value == "1" or value == 1:
|
||||
print("field",laser,"true")
|
||||
idiotiaDisplay[laser] = False
|
||||
liveDisplay[laser] = False
|
||||
fieldsDisplay[laser] = True
|
||||
UpdatePoseUI()
|
||||
|
||||
|
||||
# /pose/ljclient
|
||||
def OSCljclient(value):
|
||||
print("Pose bank got /pose/ljclient with value", value)
|
||||
ljclient = value
|
||||
lj23.LjClient(ljclient)
|
||||
|
||||
'''
|
||||
# /pose/ping value
|
||||
def OSCping(value):
|
||||
lj23.OSCping()
|
||||
'''
|
||||
'''
|
||||
# Starfield, idiotia
|
||||
def OSCrun(value):
|
||||
# Will receive message address, and message data flattened in s, x, y
|
||||
print("Pose bank got /run with value", value)
|
||||
doit = value
|
||||
'''
|
||||
# /quit dummyvalue
|
||||
def quit(value):
|
||||
# don't do this at home (or it'll quit blender)
|
||||
global oscrun
|
||||
|
||||
oscrun = False
|
||||
print("Stopped by /quit.")
|
||||
lj23.ClosePlugin()
|
||||
|
||||
|
||||
|
||||
def WebStatus(message):
|
||||
lj23.SendLJ("/status",message)
|
||||
|
||||
|
||||
# Update Pose webUI
|
||||
def UpdatePoseUI():
|
||||
|
||||
#WebStatus("Updating Pose UI...")
|
||||
for laser in range(LaserNumber):
|
||||
|
||||
if idiotiaDisplay[laser]:
|
||||
lj23.SendLJ("/pose/idiotia/" + str(laser) + " 1")
|
||||
else:
|
||||
lj23.SendLJ("/pose/idiotia/" + str(laser) + " 0")
|
||||
|
||||
if liveDisplay[laser]:
|
||||
lj23.SendLJ("/pose/live/" + str(laser) + " 1")
|
||||
else:
|
||||
lj23.SendLJ("/pose/live/" + str(laser) + " 0")
|
||||
|
||||
if fieldsDisplay[laser]:
|
||||
lj23.SendLJ("/pose/field/" + str(laser) + " 1")
|
||||
else:
|
||||
lj23.SendLJ("/pose/field/" + str(laser) + " 0")
|
||||
|
||||
|
||||
for anim in range(19):
|
||||
if anim == currentIdiotia:
|
||||
lj23.SendLJ("/pose/anim/" + str(anim) + " 1")
|
||||
else:
|
||||
lj23.SendLJ("/pose/anim/" + str(anim) + " 0")
|
||||
|
||||
def UpdateSpeedUI():
|
||||
|
||||
lj23.SendLJ("/pose/speed/1 0")
|
||||
lj23.SendLJ("/pose/speed/2 0")
|
||||
lj23.SendLJ("/pose/speed/3 0")
|
||||
lj23.SendLJ("/pose/speed/4 0")
|
||||
|
||||
|
||||
|
||||
print('Loading Pose bank...')
|
||||
WebStatus("Loading Pose bank...")
|
||||
lj23.SendLJ("/pose/start", 1)
|
||||
# OSC Server callbacks
|
||||
print("Starting OSC server at", myIP, ":", OSCinPort, "...")
|
||||
osc_startup()
|
||||
osc_udp_server(myIP, OSCinPort, "InPort")
|
||||
|
||||
#osc_method("/pose/run*", OSCrun)
|
||||
osc_method("/ping", lj23.OSCping)
|
||||
osc_method("/quit*", quit)
|
||||
osc_method("/pose/ljclient", OSCljclient)
|
||||
osc_method("/pose/idiotia/*", OSCidiotia, argscheme=OSCARG_ADDRESS + OSCARG_DATAUNPACK)
|
||||
osc_method("/pose/field/*", OSCfield,argscheme=OSCARG_ADDRESS + OSCARG_DATAUNPACK)
|
||||
osc_method("/pose/live/*", OSClive, argscheme=OSCARG_ADDRESS + OSCARG_DATAUNPACK)
|
||||
osc_method("/pose/anim/*", OSCanim, argscheme=OSCARG_ADDRESS + OSCARG_DATAUNPACK)
|
||||
osc_method("/pose/speed/*", OSCspeed, argscheme=OSCARG_ADDRESS + OSCARG_DATAUNPACK)
|
||||
|
||||
anims =[[]]*19
|
||||
|
||||
|
||||
prepareIdiotIA(0)
|
||||
prepareSTARFIELD()
|
||||
|
||||
#doit = Starfield
|
||||
#doit = IdiotIA
|
||||
|
||||
white = lj23.rgb2int(255,255,255)
|
||||
red = lj23.rgb2int(255,0,0)
|
||||
blue = lj23.rgb2int(0,0,255)
|
||||
green = lj23.rgb2int(0,255,0)
|
||||
|
||||
print("Updating Pose UI...")
|
||||
UpdatePoseUI()
|
||||
|
||||
WebStatus("Running "+ anims[currentIdiotia][0]+"...")
|
||||
#WebStatus("Pose bank running.")
|
||||
#print("Pose bank running")
|
||||
print("Running "+ anims[currentIdiotia][0]+" on " + str(LaserNumber) +" lasers.")
|
||||
|
||||
def Run():
|
||||
|
||||
try:
|
||||
while lj23.oscrun:
|
||||
|
||||
OSCframe()
|
||||
# If you want an idea
|
||||
# t0 = time.time()
|
||||
Starfield(hori=0,verti=0)
|
||||
IdiotIA()
|
||||
#LiveFace()
|
||||
time.sleep(0.002)
|
||||
#t1 = time.time()
|
||||
# looptime = t1 - t0
|
||||
# 25 frames/sec -> 1 frame is 0.04 sec long
|
||||
# if looptime is 0.01 sec
|
||||
# 0.04/0.01 = 4 loops with the same anim
|
||||
# so speedanim is 1 / 4 = 0.25
|
||||
# speedanim = 1 / (0.04 / looptime)
|
||||
|
||||
|
||||
#print("Took %f" % (t1 - t0, ))
|
||||
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
except Exception as e:
|
||||
import sys, traceback
|
||||
print ('\n---------------------')
|
||||
print ('Exception: %s' % e)
|
||||
print ('- - - - - - - - - - -')
|
||||
traceback.print_tb(sys.exc_info()[2])
|
||||
print ("\n")
|
||||
|
||||
# Gently stop on CTRL C
|
||||
|
||||
finally:
|
||||
|
||||
lj23.ClosePlugin()
|
||||
OSCstop()
|
||||
|
||||
Run()
|
|
@ -1,845 +0,0 @@
|
|||
#!/usr/bin/python2.7
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
|
||||
'''
|
||||
LJ v0.8.1
|
||||
|
||||
IdiotIA for THSF 10
|
||||
|
||||
Include IdiotIA and Starfields
|
||||
|
||||
/pose/ljclient
|
||||
|
||||
LICENCE : CC
|
||||
Sam Neurohack, Loloster,
|
||||
|
||||
'''
|
||||
|
||||
|
||||
import math
|
||||
|
||||
import numpy as np
|
||||
import pdb
|
||||
from datetime import datetime
|
||||
from random import randrange
|
||||
import redis
|
||||
import sys
|
||||
import ast
|
||||
import os
|
||||
|
||||
import time,traceback
|
||||
|
||||
|
||||
ljpath = r'%s' % os.getcwd().replace('\\','/')
|
||||
|
||||
# import from shell
|
||||
|
||||
sys.path.append(ljpath +'/../../libs/')
|
||||
print(ljpath +'/../../libs/')
|
||||
#import from LJ
|
||||
sys.path.append(ljpath +'/libs/')
|
||||
print (ljpath +'/libs/')
|
||||
|
||||
|
||||
is_py2 = sys.version[0] == '2'
|
||||
if is_py2:
|
||||
from OSC import OSCServer, OSCClient, OSCMessage
|
||||
else:
|
||||
from OSC3 import OSCServer, OSCClient, OSCMessage
|
||||
|
||||
import lj23 as lj3
|
||||
|
||||
'''
|
||||
from osc4py3.as_eventloop import *
|
||||
from osc4py3 import oscbuildparse
|
||||
#from osc4py3 import oscmethod as osm
|
||||
from osc4py3.oscmethod import *
|
||||
'''
|
||||
|
||||
import argparse
|
||||
|
||||
# 0.25 : each frame will be repeated 4 times.
|
||||
animspeed = 0.1
|
||||
|
||||
screen_size = [700,700]
|
||||
xy_center = [screen_size[0]/2,screen_size[1]/2]
|
||||
|
||||
message = "TEAMLASER"
|
||||
OSCinPort = 8011
|
||||
|
||||
ljclient = 0
|
||||
|
||||
#liveDisplay = [False,False,False,False]
|
||||
|
||||
liveDisplay = [True, True, True, True]
|
||||
#fieldsDisplay = [True,True,True,True]
|
||||
idiotiaDisplay = [False, False, False, False]
|
||||
fieldsDisplay = [False, False, False, False]
|
||||
|
||||
|
||||
|
||||
'''
|
||||
fieldsDisplay = [False,False,True,True]
|
||||
'''
|
||||
|
||||
#idiotiaDisplay = [True,True,False,False]
|
||||
|
||||
currentIdiotia = 0
|
||||
|
||||
print ("")
|
||||
print ("Arguments parsing if needed...")
|
||||
argsparser = argparse.ArgumentParser(description="Pose bank 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("-m","--myIP",help="Local IP (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("-v","--verbose",help="Verbosity level (0 by default)",type=int)
|
||||
argsparser.add_argument("-a","--anim",help="IdiotIA anim (0 by default)",type=int)
|
||||
argsparser.add_argument("-L","--Lasers",help="Number of lasers connected (4 by default).",type=int)
|
||||
|
||||
args = argsparser.parse_args()
|
||||
|
||||
|
||||
if args.verbose:
|
||||
debug = args.verbose
|
||||
else:
|
||||
debug = 0
|
||||
|
||||
if args.client:
|
||||
ljclient = args.client
|
||||
else:
|
||||
ljclient = 0
|
||||
|
||||
if args.anim:
|
||||
currentIdiotia = args.anim
|
||||
else:
|
||||
currentIdiotia = 0
|
||||
|
||||
# Redis Computer IP
|
||||
if args.redisIP != None:
|
||||
redisIP = args.redisIP
|
||||
else:
|
||||
redisIP = '127.0.0.1'
|
||||
|
||||
# myIP
|
||||
if args.myIP != None:
|
||||
myIP = args.myIP
|
||||
else:
|
||||
myIP = '127.0.0.1'
|
||||
|
||||
# Lasers = number of laser connected
|
||||
if args.Lasers != None:
|
||||
LaserNumber = args.Lasers
|
||||
else:
|
||||
LaserNumber = 1
|
||||
|
||||
|
||||
r = lj3.Config(redisIP,ljclient,"pose")
|
||||
|
||||
|
||||
#
|
||||
# OSC
|
||||
#
|
||||
|
||||
oscserver = OSCServer( (myIP, OSCinPort) )
|
||||
oscserver.timeout = 0
|
||||
#oscrun = True
|
||||
|
||||
# this method of reporting timeouts only works by convention
|
||||
# that before calling handle_request() field .timed_out is
|
||||
# set to False
|
||||
def handle_timeout(self):
|
||||
self.timed_out = True
|
||||
|
||||
# funny python's way to add a method to an instance of a class
|
||||
import types
|
||||
oscserver.handle_timeout = types.MethodType(handle_timeout, oscserver)
|
||||
|
||||
|
||||
|
||||
def hex2rgb(hexcode):
|
||||
return tuple(map(ord,hexcode[1:].decode('hex')))
|
||||
|
||||
|
||||
def rgb2hex(rgb):
|
||||
return int('0x%02x%02x%02x' % tuple(rgb),0)
|
||||
|
||||
|
||||
# IdiotIA
|
||||
import json
|
||||
#CurrentPose = 1
|
||||
|
||||
# Get frame number for pose path describe in PoseDir
|
||||
def lengthPOSE(pose_dir):
|
||||
|
||||
if debug > 0:
|
||||
print("Checking directory",'plugins/VJing/poses/' + pose_dir)
|
||||
if os.path.exists('plugins/VJing/poses/' + pose_dir):
|
||||
|
||||
numfiles = sum(1 for f in os.listdir('plugins/VJing/poses/' + pose_dir) if os.path.isfile(os.path.join('plugins/VJing/poses/' + pose_dir + '/', f)) and f[0] != '.')
|
||||
if debug > 0:
|
||||
print(numfiles, 'frames')
|
||||
return numfiles
|
||||
else:
|
||||
if debug > 0:
|
||||
print("but it doesn't even exist!")
|
||||
return 0
|
||||
|
||||
|
||||
def prepareIdiotIA(currentAnim):
|
||||
|
||||
WebStatus("Checking anims...")
|
||||
print()
|
||||
print("Reading available IdiotIA anims...")
|
||||
# anim format (name, xpos, ypos, resize, currentframe, totalframe, count, speed)
|
||||
# 0 1 2 3 4 5 6 7
|
||||
# total frames is fetched from directory by lengthPOSE()
|
||||
|
||||
anims[0] = ['boredhh' , xy_center[0] - 100, xy_center[1] + 30, 550, 0, 0, 0, animspeed]
|
||||
anims[1] = ['belka4' , xy_center[0] - 70, xy_center[1] + 380, 680, 0, 0, 0, animspeed]
|
||||
anims[2] = ['belka3' , xy_center[0] - 100, xy_center[1] + 360, 700, 0, 0, 0, animspeed]
|
||||
anims[3] = ['hhhead' , xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[4] = ['hhhead2', xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[5] = ['hhhead4', xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
anims[6] = ['hhred' , xy_center[0] - 250, xy_center[1] + 220, 550, 0, 0, 0, animspeed]
|
||||
anims[7] = ['hhred2' , xy_center[0] - 200, xy_center[1] + 200, 550, 0, 0, 0, animspeed]
|
||||
anims[8] = ['lady1' , xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[9] = ['lady1' , xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
anims[10] = ['lady2' , xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
anims[11] = ['lady3' , xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[12] = ['lady4' , xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[13] = ['mila6' , xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
anims[14] = ['mila5' , xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
anims[15] = ['idiotia1', xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[16] = ['idiotia1', xy_center[0] - 100, xy_center[1] + 300, 600, 0, 0, 0, animspeed]
|
||||
anims[17] = ['belka4', xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
anims[18] = ['belka3', xy_center[0] - 100, xy_center[1] + 280, 600, 0, 0, 0, animspeed]
|
||||
|
||||
#for laseranims in anims:
|
||||
|
||||
for anim in anims:
|
||||
#print(anim)
|
||||
anim[5] = lengthPOSE(anim[0])
|
||||
WebStatus("Checking "+ anim[0] +"...")
|
||||
if debug > 0:
|
||||
print('plugins/VJing/poses/' + anim[0], "length :", anim[5], "frames")
|
||||
|
||||
print("Current IdiotIA anim is",anims[currentIdiotia][0],"("+str(currentIdiotia)+")")
|
||||
|
||||
|
||||
'''
|
||||
pose_keypoints_2d
|
||||
face_keypoints_2d
|
||||
hand_left_keypoints_2d
|
||||
hand_right_keypoints_2d
|
||||
pose_keypoints_3d
|
||||
face_keypoints_3d
|
||||
hand_left_keypoints_3d
|
||||
hand_right_keypoints_3d
|
||||
|
||||
"/0/face_keypoints_2d"
|
||||
"[-0.0946419, -0.521328, 0.675269, -0.0883931, -0.413923, 0.69358, -0.0758954, -0.302815, 0.73599, -0.059232, -0.191707, 0.640398, -0.0384026, -0.0917102, 0.683398, -0.00507569, -0.00652742, 0.643006, 0.0428318, 0.0601374, 0.558626, 0.0844904, 0.108284, 0.576597, 0.142813, 0.108284, 0.621916, 0.178223, 0.0749518, 0.546389, 0.207384, 0.0193979, 0.556877, 0.22613, -0.0361562, 0.660514, 0.244876, -0.102821, 0.713871, 0.267789, -0.1843, 0.706604, 0.290701, -0.265779, 0.680418, 0.307364, -0.347258, 0.617497, 0.31153, -0.428738, 0.53877, -0.0446514, -0.547253, 0.784288, -0.00715858, -0.569474, 0.873856, 0.0303342, -0.558364, 0.835336, 0.0740758, -0.543549, 0.827985, 0.111569, -0.525031, 0.809191, 0.213632, -0.543549, 0.819012, 0.242794, -0.569474, 0.884373, 0.265706, -0.5954, 0.842317, 0.292784, -0.613918, 0.804365, 0.313613, -0.625028, 0.740405, 0.163642, -0.443552, 0.805348, 0.169891, -0.362073, 0.837128, 0.169891, -0.280594, 0.839031, 0.174057, -0.213929, 0.68711, 0.111569, -0.162078, 0.725528, 0.134481, -0.154671, 0.837339, 0.159476, -0.150968, 0.887387, 0.178223, -0.158375, 0.835752, 0.196969, -0.180597, 0.698174, 0.00950491, -0.432441, 0.864517, 0.0345001, -0.458366, 0.859197, 0.0636612, -0.46207, 0.867471, 0.0907393, -0.432441, 0.852409, 0.0636612, -0.417627, 0.876186, 0.0324172, -0.413923, 0.834265, 0.21155, -0.454663, 0.875569, 0.232379, -0.491699, 0.816674, 0.26154, -0.50281, 0.878064, 0.282369, -0.476884, 0.839634, 0.263623, -0.450959, 0.912212, 0.24071, -0.450959, 0.896937, 0.0719929, -0.047267, 0.761505, 0.101154, -0.065785, 0.864081, 0.130315, -0.0694886, 0.910774, 0.159476, -0.065785, 0.895222, 0.17614, -0.0731922, 0.846551, 0.194886, -0.0731922, 0.74389, 0.209467, -0.0731922, 0.573107, 0.194886, -0.0213418, 0.677465, 0.17614, 0.0156941, 0.755373, 0.15531, 0.0231014, 0.765641, 0.124066, 0.0231014, 0.863117, 0.0928223, -0.00282377, 0.823042, 0.0928223, -0.0398598, 0.743914, 0.128232, -0.0361562, 0.932259, 0.157393, -0.0361562, 0.877732, 0.17614, -0.0398598, 0.853163, 0.196969, -0.0620813, 0.645926, 0.17614, -0.0398598, 0.80738, 0.157393, -0.0324526, 0.872388, 0.128232, -0.0361562, 0.924673, 0.0511636, -0.450959, 0.801577, 0.244876, -0.480588, 0.915322]"
|
||||
|
||||
"/peopleCount"
|
||||
"2"
|
||||
'''
|
||||
|
||||
def bodyREDIS(people):
|
||||
|
||||
dots = []
|
||||
pose = []
|
||||
redispose = []
|
||||
|
||||
pose_points = [10,9,8,1,11,12,13]
|
||||
print ("people body", people)
|
||||
|
||||
print ("/"+str(people)+"/pose_keypoints_2d")
|
||||
#pose = np.array(ast.literal_eval(r.get("/"+str(people)+"/pose_keypoints_2d")))
|
||||
redispose = r.get("/"+str(people)+"/pose_keypoints_2d")
|
||||
#print ("redispose",redispose)
|
||||
poseast = ast.literal_eval(redispose)
|
||||
#print ("poseast",poseast)
|
||||
#print (poseast[0])
|
||||
pose = np.array(poseast)
|
||||
#print (np.array((ast.literal_eval(strg))))
|
||||
#print pose
|
||||
#print(pose[0], pose[1])
|
||||
#print("len pose", len(pose))
|
||||
'''
|
||||
for dot in range(len(pose)/3):
|
||||
#print dot
|
||||
dots.append(((pose[dot * 3], pose[(dot * 3)+1])))
|
||||
#print((pose[dot * 3], pose[(dot * 3)+1]))
|
||||
'''
|
||||
for dot in range(len(pose_points)):
|
||||
bodypoint = pose_points[dot]
|
||||
if pose[bodypoint * 3] != -1 and pose[(bodypoint * 3)+1] != -1:
|
||||
|
||||
dots.append(((pose[bodypoint * 3], pose[(bodypoint * 3)+1])))
|
||||
#print((pose[dot * 3], pose[(dot * 3)+1]))
|
||||
#print "body point ", pose_points[dot],dot, (pose[bodypoint * 3], pose[(bodypoint * 3)+1])
|
||||
print dots
|
||||
return dots
|
||||
|
||||
# display the Realtime open pose face according to flag.
|
||||
def LivePose():
|
||||
|
||||
|
||||
laser = 0
|
||||
# Old style : if display flag is True for given laser, send the face points.
|
||||
# New style : should send the people points in a PL, then use the PL's dest object to describe
|
||||
# what to do with it
|
||||
|
||||
if liveDisplay[0]:
|
||||
peoplenumber = int(r.get("/peopleCount"))
|
||||
print peoplenumber
|
||||
for currentnumber in range(peoplenumber):
|
||||
PL = 0
|
||||
#print PL, anim
|
||||
# Draw Pose
|
||||
|
||||
x_offset = 26 * (- (0.9*peoplenumber) + 3*currentnumber)
|
||||
for people in range(peoplenumber):
|
||||
|
||||
print("people", people)
|
||||
x_offset = 26 * (- (0.9*peoplenumber) + 3*currentnumber)
|
||||
print x_offset
|
||||
lj3.rPolyLineOneColor(bodyREDIS(people), c= white, PL = PL, closed = False, xpos = xy_center[0]+ x_offset, ypos = xy_center[1], resize = 250)
|
||||
|
||||
lj3.DrawPL(PL)
|
||||
|
||||
|
||||
|
||||
# get relative (-1 0 1) body position points. a position -1, -1 means doesn't exist
|
||||
def getBODY(pose_json,pose_points, people):
|
||||
|
||||
dots = []
|
||||
for dot in pose_points:
|
||||
#print pose_points
|
||||
if len(pose_json['people'][people]['pose_keypoints_2d']) != 0:
|
||||
#print "people 0"
|
||||
if pose_json['people'][people]['pose_keypoints_2d'][dot * 3] != -1 and pose_json['people'][people]['pose_keypoints_2d'][(dot * 3)+1] != -1:
|
||||
dots.append((pose_json['people'][people]['pose_keypoints_2d'][dot * 3], pose_json['people'][people]['pose_keypoints_2d'][(dot * 3)+1]))
|
||||
|
||||
|
||||
return dots
|
||||
|
||||
# get absolute face position points
|
||||
def getFACE(pose_json,pose_points, people):
|
||||
|
||||
dots = []
|
||||
for dot in pose_points:
|
||||
|
||||
if len(pose_json['people'][people]['face_keypoints_2d']) != 0:
|
||||
#print "people 0"
|
||||
if pose_json['people'][people]['face_keypoints_2d'][dot * 3] != -1 and pose_json['people'][people]['face_keypoints_2d'][(dot * 3)+1] != -1:
|
||||
dots.append((pose_json['people'][people]['face_keypoints_2d'][dot * 3], pose_json['people'][people]['face_keypoints_2d'][(dot * 3)+1]))
|
||||
|
||||
return dots
|
||||
|
||||
|
||||
|
||||
# Body parts
|
||||
def bodyCOCO(pose_json, people):
|
||||
pose_points = [10,9,8,1,11,12,13]
|
||||
return getBODY(pose_json,pose_points, people)
|
||||
|
||||
def armCOCO(pose_json, people):
|
||||
pose_points = [7,6,5,1,2,3,4]
|
||||
return getBODY(pose_json,pose_points, people)
|
||||
|
||||
def headCOCO(pose_json, people):
|
||||
pose_points = [1,0]
|
||||
return getBODY(pose_json,pose_points, people)
|
||||
|
||||
|
||||
# Face keypoints
|
||||
def face(pose_json, people):
|
||||
pose_points = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def browL(pose_json, people):
|
||||
pose_points = [26,25,24,23,22]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def browR(pose_json, people):
|
||||
pose_points = [21,20,19,18,17]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def eyeR(pose_json, people):
|
||||
pose_points = [36,37,38,39,40,41,36]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def eyeL(pose_json, people):
|
||||
pose_points = [42,43,44,45,46,47,42]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def pupR(pose_json, people):
|
||||
pose_points = [68,68]
|
||||
print(getFACE(pose_json,pose_points, people))
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def pupL(pose_json, people):
|
||||
pose_points = [69,69]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
|
||||
def nose(pose_json, people):
|
||||
pose_points = [27,28,29,30]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def mouth(pose_json, people):
|
||||
pose_points = [48,59,58,57,56,55,54,53,52,51,50,49,48,60,67,66,65,64,63,62,61,60]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
|
||||
|
||||
|
||||
# display the currentIdiotia animation on all lasers according to display flag
|
||||
def IdiotIA():
|
||||
|
||||
# All laser loop
|
||||
for laser in range(LaserNumber):
|
||||
# for anim in anims[laseranims]:
|
||||
|
||||
# if display flag is True, send the face points.
|
||||
if idiotiaDisplay[laser]:
|
||||
|
||||
anim = anims[currentIdiotia]
|
||||
#print(anim)
|
||||
PL = laser
|
||||
dots = []
|
||||
|
||||
# increase current frame [4] of speed [7] frames
|
||||
# print(anim[4],anim[7],anim[4]+anim[7])
|
||||
# print("frame", anim[4])
|
||||
anim[4] = anim[4]+anim[7]
|
||||
# print("animspeed",anim[7], "newframe", anim[4], "maximum frame", anim[5] )
|
||||
# compare to total frame [5]
|
||||
if anim[4] >= anim[5]:
|
||||
anim[4] = 0
|
||||
|
||||
posename = 'plugins/VJing/poses/' + anim[0] + '/' + anim[0] +'-'+str("%05d"%int(anim[4]))+'.json'
|
||||
# print(posename)
|
||||
posefile = open(posename , 'r')
|
||||
posedatas = posefile.read()
|
||||
pose_json = json.loads(posedatas)
|
||||
#WebStatus("Frame : "+str("%05d"%int(anim[4])))
|
||||
|
||||
# Draw Face
|
||||
|
||||
for people in range(len(pose_json['people'])):
|
||||
|
||||
#lj3.rPolyLineOneColor(face(pose_json, people), c = white, PL = laser closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(browL(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(browR(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(eyeR(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
#lj3.rPolyLineOneColor(pupR(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(eyeL(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
#lj3.rPolyLineOneColor(pupL(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(nose(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(mouth(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
|
||||
lj3.DrawPL(PL)
|
||||
|
||||
|
||||
# Init Starfields
|
||||
def prepareSTARFIELD():
|
||||
global star, stars0, stars1, stars2, starfieldcount, starspeed, displayedstars, displayedstars, num_stars, max_depth
|
||||
|
||||
WebStatus("Init starfields...")
|
||||
stars0=[]
|
||||
stars1=[]
|
||||
stars2=[]
|
||||
#stars3=[]
|
||||
num_stars = 50
|
||||
max_depth = 20
|
||||
stars = []
|
||||
starfieldcount = 0
|
||||
displayedstars = 5
|
||||
starspeed = 0.05
|
||||
|
||||
for i in range(num_stars):
|
||||
# A star is represented as a list with this format: [X,Y,Z]
|
||||
star = [randrange(-25,25), randrange(-25,25), randrange(1, max_depth)]
|
||||
stars0.append(star)
|
||||
star = [randrange(-25,25), randrange(-25,25), randrange(1, max_depth)]
|
||||
stars1.append(star)
|
||||
star = [randrange(-25,25), randrange(-25,25), randrange(1, max_depth)]
|
||||
stars2.append(star)
|
||||
|
||||
|
||||
# Todo : Currently compute all starfields even if field display flag is False.
|
||||
|
||||
def Starfield(hori=0,verti=0):
|
||||
global star, stars0, stars1, stars2, starfieldcount, starspeed, displayedstars, displayedstars, num_stars, max_depth
|
||||
|
||||
starfieldcount += 1
|
||||
#print starfieldcount
|
||||
starpoints = []
|
||||
#print displayedstars, 'stars displayed'
|
||||
|
||||
# Increase number of
|
||||
if displayedstars < num_stars and starfieldcount % 15 == 0:
|
||||
displayedstars += 1
|
||||
|
||||
#if displayedstars == num_stars and starfieldcount % 10 == 0:
|
||||
# starspeed += 0.005
|
||||
|
||||
#print starspeed
|
||||
|
||||
for starnumber in range(0,displayedstars):
|
||||
|
||||
# The Z component is decreased on each frame.
|
||||
stars0[starnumber][2] -= starspeed * 3
|
||||
stars1[starnumber][2] -= starspeed * 3
|
||||
stars2[starnumber][2] -= starspeed * 3
|
||||
|
||||
# If the star has past the screen (I mean Z<=0) then we
|
||||
# reposition it far away from the screen (Z=max_depth)
|
||||
# with random X and Y coordinates.
|
||||
if stars0[starnumber][2] <= 0:
|
||||
stars0[starnumber][0] = randrange(-25,25)
|
||||
stars0[starnumber][1] = randrange(-25,25)
|
||||
stars0[starnumber][2] = max_depth
|
||||
|
||||
if stars1[starnumber][2] <= 0:
|
||||
stars1[starnumber][0] = randrange(-25,25)
|
||||
stars1[starnumber][1] = randrange(-25,25)
|
||||
stars1[starnumber][2] = max_depth
|
||||
|
||||
if stars2[starnumber][2] <= 0:
|
||||
stars2[starnumber][0] = randrange(-25,25)
|
||||
stars2[starnumber][1] = randrange(-25,25)
|
||||
stars2[starnumber][2] = max_depth
|
||||
|
||||
|
||||
# Convert the 3D coordinates to 2D using perspective projection.
|
||||
k0 = 128.0 / stars0[starnumber][2]
|
||||
k1 = 128.0 / stars1[starnumber][2]
|
||||
k2 = 128.0 / stars2[starnumber][2]
|
||||
|
||||
# Move Starfield origin.
|
||||
# if stars xpos/ypos is same sign (i.e left stars xpos is <0) than (joystick or code) acceleration (hori and verti moves the star field origin)
|
||||
if np.sign(stars0[starnumber][0]) == np.sign(hori):
|
||||
x0 = int(stars0[starnumber][0] * k0 + xy_center[0] + (hori*600))
|
||||
else:
|
||||
x0 = int(stars0[starnumber][0] * k0 + xy_center[0] + (hori*500))
|
||||
|
||||
if np.sign(stars0[starnumber][1]) == np.sign(verti):
|
||||
y0 = int(stars0[starnumber][1] * k0 + xy_center[1] + (verti*600))
|
||||
else:
|
||||
y0 = int(stars0[starnumber][1] * k0 + xy_center[1] + (verti*500))
|
||||
|
||||
|
||||
if np.sign(stars1[starnumber][0]) == np.sign(hori):
|
||||
x1 = int(stars1[starnumber][0] * k1 + xy_center[0] + (hori*600))
|
||||
else:
|
||||
x1 = int(stars1[starnumber][0] * k1 + xy_center[0] + (hori*300))
|
||||
|
||||
if np.sign(stars1[starnumber][1]) == np.sign(verti):
|
||||
y1 = int(stars1[starnumber][1] * k1 + xy_center[1] + (verti*600))
|
||||
else:
|
||||
y1 = int(stars1[starnumber][1] * k1 + xy_center[1] + (verti*300))
|
||||
|
||||
|
||||
if np.sign(stars2[starnumber][0]) == np.sign(hori):
|
||||
x2 = int(stars2[starnumber][0] * k2 + xy_center[0] + (hori*600))
|
||||
else:
|
||||
x2 = int(stars2[starnumber][0] * k2 + xy_center[0] + (hori*300))
|
||||
|
||||
if np.sign(stars2[starnumber][1]) == np.sign(verti):
|
||||
y2 = int(stars2[starnumber][1] * k2 + xy_center[1] + (verti*600))
|
||||
else:
|
||||
y2 = int(stars2[starnumber][1] * k2 + xy_center[1] + (verti*300))
|
||||
|
||||
|
||||
# Add star to pointlist PL 0 if field display flag is true
|
||||
if fieldsDisplay[0] and 0 <= x0 < screen_size[0] - 2 and 0 <= y0 < screen_size[1] - 2:
|
||||
lj3.PolyLineOneColor([(x0,y0),((x0+1),(y0+1))], c = white, PL = 0, closed = False)
|
||||
|
||||
# Add star to pointlist PL 1 if field display flag is true
|
||||
if fieldsDisplay[1] and 0 <= x1 < screen_size[0] - 2 and 0 <= y1 < screen_size[1] - 2:
|
||||
lj3.PolyLineOneColor([(x1,y1),((x1+1),(y1+1))], c = white, PL = 1, closed = False)
|
||||
|
||||
# Add star to pointlist PL 2 if field display flag is true
|
||||
if fieldsDisplay[2] and 0 <= x2 < screen_size[0] - 2 and 0 <= y2 < screen_size[1] - 2:
|
||||
lj3.PolyLineOneColor([(x2,y2),((x2+1),(y2+1))], c= white, PL = 2, closed = False)
|
||||
|
||||
'''
|
||||
if starfieldcount < 200:
|
||||
|
||||
if 0 <= x3 < screen_size[0] - 2 and 0 <= y3 < screen_size[1] - 2:
|
||||
fwork.PolyLineOneColor([(x3,y3),((x3+2),(y3+2))], c=colorify.rgb2hex([255,255,255]), PL = 3, closed = False)
|
||||
'''
|
||||
|
||||
# Laser 3 Display a word.
|
||||
if fieldsDisplay[3]:
|
||||
lj3.Text(message, white, PL = 3, xpos = 300, ypos = 300, resize = 1, rotx =0, roty =0 , rotz=0)
|
||||
|
||||
|
||||
|
||||
# If field display is True for each laser
|
||||
for laser in range(LaserNumber):
|
||||
|
||||
# Actually send the field point list.
|
||||
if fieldsDisplay[laser]:
|
||||
lj3.DrawPL(laser)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# display the Realtime open pose face according to flag.
|
||||
def LiveFace():
|
||||
|
||||
# All laser loop
|
||||
for laser in range(LaserNumber):
|
||||
# for anim in anims[laseranims]:
|
||||
print ("laser", laser)
|
||||
|
||||
# if display flag is True, send the face points.
|
||||
if liveDisplay[laser]:
|
||||
|
||||
PL = laser
|
||||
#print PL, anim
|
||||
dots = []
|
||||
pose_json = json.loads(posedatas)
|
||||
|
||||
# Draw Face
|
||||
|
||||
for people in range(len(pose_json['people'])):
|
||||
|
||||
r.get(n)
|
||||
lj3.rPolyLineOneColor(bodyCOCO(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(armCOCO(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(headCOCO(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
|
||||
#lj3.rPolyLineOneColor(face(pose_json, people), c = white, PL = laser closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(browL(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(browR(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(eyeR(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
#lj3.rPolyLineOneColor(pupR(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(eyeL(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
#lj3.rPolyLineOneColor(pupL(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(nose(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
lj3.rPolyLineOneColor(mouth(pose_json, people), c = white, PL = laser, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
|
||||
lj3.DrawPL(PL)
|
||||
|
||||
|
||||
# if display flag is True, send the face points.
|
||||
if liveDisplay[laser]:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
# /pose/idiotia/lasernumber 1
|
||||
def OSCidiotia(path, tags, args, source):
|
||||
|
||||
print("pose idiotia got",path, args)
|
||||
laser = int(args[0])
|
||||
value = int(args[1])
|
||||
|
||||
|
||||
if value == 1:
|
||||
|
||||
print("switch on idiotia for laser", laser, value)
|
||||
idiotiaDisplay[laser] = True
|
||||
liveDisplay[laser] = False
|
||||
fieldsDisplay[laser] = False
|
||||
#print(idiotiaDisplay,liveDisplay,fieldsDisplay)
|
||||
|
||||
else:
|
||||
|
||||
idiotiaDisplay[laser] = False
|
||||
print(idiotiaDisplay,liveDisplay,fieldsDisplay)
|
||||
|
||||
UpdatePoseUI()
|
||||
|
||||
|
||||
|
||||
# /pose/anim
|
||||
def OSCanim(path, tags, args, source):
|
||||
|
||||
print("pose anim got",path, args)
|
||||
anim = int(args[0])
|
||||
state = int(args[1])
|
||||
|
||||
#print(anim, state)
|
||||
|
||||
if state == 1:
|
||||
print("/pose/anim switch to",anim)
|
||||
currentIdiotia = anim
|
||||
UpdatePoseUI()
|
||||
WebStatus("Ruuning "+ anims[currentIdiotia][0]+"...")
|
||||
|
||||
|
||||
# /pose/live/lasernumber value
|
||||
def OSClive(path, tags, args, source):
|
||||
|
||||
print("pose live got",path, args)
|
||||
laser = int(args[0])
|
||||
value = int(args[1])
|
||||
|
||||
|
||||
if value == "1":
|
||||
print("live for laser", laser)
|
||||
idiotiaDisplay[value] = False
|
||||
liveDisplay[value] = True
|
||||
fieldsDisplay[value] = False
|
||||
UpdatePoseUI()
|
||||
|
||||
# /pose/field/lasernumber value
|
||||
def OSCfield(path, tags, args, source):
|
||||
|
||||
print("pose field got",path, args)
|
||||
laser = int(args[0])
|
||||
value = int(args[1])
|
||||
|
||||
|
||||
if value == "1":
|
||||
print("field for laser", laser)
|
||||
idiotiaDisplay[value] = False
|
||||
liveDisplay[value] = False
|
||||
fieldsDisplay[value] = True
|
||||
UpdatePoseUI()
|
||||
|
||||
|
||||
# /pose/ljclient
|
||||
def OSCljclient(path, tags, args, source):
|
||||
|
||||
print("pose got /viewgen/ljclient with value", args[0])
|
||||
lj.WebStatus("viewgen to virtual "+ str(args[0]))
|
||||
ljclient = args[0]
|
||||
lj.LjClient(ljclient)
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
# Starfield, idiotia
|
||||
def OSCrun(value):
|
||||
# Will receive message address, and message data flattened in s, x, y
|
||||
print("Pose bank got /run with value", value)
|
||||
doit = value
|
||||
'''
|
||||
'''
|
||||
# /quit
|
||||
def OSCquit():
|
||||
|
||||
WebStatus("Pose bank stopping")
|
||||
print("Stopping OSC...")
|
||||
lj3.OSCstop()
|
||||
sys.exit()
|
||||
'''
|
||||
|
||||
def WebStatus(message):
|
||||
lj3.SendLJ("/status",message)
|
||||
|
||||
|
||||
# Update Pose webUI
|
||||
def UpdatePoseUI():
|
||||
|
||||
WebStatus("Updating Pose UI...")
|
||||
for laser in range(LaserNumber):
|
||||
|
||||
if idiotiaDisplay[laser]:
|
||||
lj3.SendLJ("/pose/idiotia/" + str(laser) + " 1")
|
||||
else:
|
||||
lj3.SendLJ("/pose/idiotia/" + str(laser) + " 0")
|
||||
|
||||
if liveDisplay[laser]:
|
||||
lj3.SendLJ("/pose/live/" + str(laser) + " 1")
|
||||
else:
|
||||
lj3.SendLJ("/pose/live/" + str(laser) + " 0")
|
||||
|
||||
if fieldsDisplay[laser]:
|
||||
lj3.SendLJ("/pose/field/" + str(laser) + " 1")
|
||||
else:
|
||||
lj3.SendLJ("/pose/field/" + str(laser) + " 0")
|
||||
|
||||
|
||||
for anim in range(19):
|
||||
if anim == currentIdiotia:
|
||||
lj3.SendLJ("/pose/anim/" + str(anim) + " 1")
|
||||
else:
|
||||
lj3.SendLJ("/pose/anim/" + str(anim) + " 0")
|
||||
|
||||
|
||||
|
||||
print('Loading Pose bank...')
|
||||
WebStatus("Loading Pose bank...")
|
||||
|
||||
oscserver.addMsgHandler("/pose/ljclient", OSCljclient)
|
||||
oscserver.addMsgHandler("/pose/idiotia", OSCidiotia)
|
||||
oscserver.addMsgHandler("/pose/field", OSCfield)
|
||||
oscserver.addMsgHandler("/pose/live", OSClive)
|
||||
oscserver.addMsgHandler("/pose/anim", OSCanim)
|
||||
# Add OSC generic plugins commands : 'default", /ping, /quit, /pluginame/obj, /pluginame/var, /pluginame/adddest, /pluginame/deldest
|
||||
lj3.addOSCdefaults(oscserver)
|
||||
|
||||
anims =[[]]*19
|
||||
|
||||
|
||||
prepareIdiotIA(0)
|
||||
prepareSTARFIELD()
|
||||
|
||||
#doit = Starfield
|
||||
#doit = IdiotIA
|
||||
|
||||
white = lj3.rgb2int(255,255,255)
|
||||
red = lj3.rgb2int(255,0,0)
|
||||
blue = lj3.rgb2int(0,0,255)
|
||||
green = lj3.rgb2int(0,255,0)
|
||||
|
||||
print("Updating Pose UI...")
|
||||
UpdatePoseUI()
|
||||
|
||||
WebStatus("Pose "+ anims[currentIdiotia][0]+".")
|
||||
#WebStatus("Pose bank running.")
|
||||
#print("Pose bank running")
|
||||
print("Pose "+ anims[currentIdiotia][0]+" ready on " + str(LaserNumber) +" lasers.")
|
||||
|
||||
def Run():
|
||||
|
||||
try:
|
||||
while lj3.oscrun:
|
||||
|
||||
# If you want an idea
|
||||
# t0 = time.time()
|
||||
lj3.OSCframe()
|
||||
#Starfield(hori=0,verti=0)
|
||||
#IdiotIA()
|
||||
LivePose()
|
||||
#LiveFace()
|
||||
time.sleep(0.002)
|
||||
#t1 = time.time()
|
||||
# looptime = t1 - t0
|
||||
# 25 frames/sec -> 1 frame is 0.04 sec long
|
||||
# if looptime is 0.01 sec
|
||||
# 0.04/0.01 = 4 loops with the same anim
|
||||
# so speedanim is 1 / 4 = 0.25
|
||||
# speedanim = 1 / (0.04 / looptime)
|
||||
|
||||
|
||||
#print("Took %f" % (t1 - t0, ))
|
||||
|
||||
#except KeyboardInterrupt:
|
||||
# pass
|
||||
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
|
||||
# Gently stop on CTRL C
|
||||
|
||||
finally:
|
||||
|
||||
WebStatus("Pose bank Exit")
|
||||
print("Stopping OSC...")
|
||||
lj3.OSCstop()
|
||||
|
||||
print ("Pose bank Stopped.")
|
||||
|
||||
Run()
|
|
@ -1,598 +0,0 @@
|
|||
#!/usr/bin/python2.7
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- mode: Python -*-
|
||||
|
||||
'''
|
||||
Laser Jaying
|
||||
|
||||
LICENCE : CC
|
||||
Sam Neurohack, Loloster,
|
||||
|
||||
Openpose json files animations
|
||||
|
||||
Set for amiral castle :
|
||||
|
||||
Curve 0 : Mapping
|
||||
Curve 1 : Pose align on Laser 0 for the moment
|
||||
Curve 2 : Faces
|
||||
Curve 3 : Dancers
|
||||
|
||||
'''
|
||||
|
||||
|
||||
import math
|
||||
import gstt
|
||||
from globalVars import *
|
||||
import bhoroscp
|
||||
import colorify
|
||||
import numpy as np
|
||||
import pdb
|
||||
import time
|
||||
from datetime import datetime
|
||||
import settings
|
||||
|
||||
|
||||
# For Mapping()
|
||||
# dedicated settings handler is in settings.py
|
||||
import pygame
|
||||
|
||||
f_sine = 0
|
||||
|
||||
|
||||
|
||||
# Curve 0
|
||||
# Edit shape mode / Run Mode
|
||||
|
||||
def MappingConf(section):
|
||||
global mouse_prev, sections
|
||||
|
||||
print ""
|
||||
print "For Mapping(), reading Architecture Points"
|
||||
gstt.EditStep = 0
|
||||
gstt.CurrentWindow = -1
|
||||
gstt.CurrentCorner = 0
|
||||
gstt.CurrentSection = section
|
||||
mouse_prev = ((405, 325), (0, 0, 0))
|
||||
|
||||
# Get all shapes points (="corners") for the given section of the conf file -> gstt.Windows
|
||||
gstt.Windows = []
|
||||
sections = settings.MappingSections()
|
||||
|
||||
print ""
|
||||
#print "Sections : ", sections
|
||||
print "Reading Section : ", sections[gstt.CurrentSection]
|
||||
|
||||
gstt.Laser = settings.MappingRead([sections[gstt.CurrentSection],'laser'])
|
||||
print "Laser : ", gstt.Laser
|
||||
gstt.simuPL = gstt.Laser
|
||||
|
||||
for Window in xrange(settings.Mapping(sections[gstt.CurrentSection])-1):
|
||||
print "Reading option : ", str(Window)
|
||||
shape = [sections[gstt.CurrentSection], str(Window)]
|
||||
WindowPoints = settings.MappingRead(shape)
|
||||
gstt.Windows.append(WindowPoints)
|
||||
|
||||
print "Section points : " ,gstt.Windows
|
||||
|
||||
|
||||
|
||||
|
||||
# section 0 is "General", then first screen shapes in section 1
|
||||
# Todo : Should search automatically first screen in settings file sections.
|
||||
# MappingConf(1) should be call only if curve 0 is selected
|
||||
|
||||
|
||||
def Mapping(fwork, keystates, keystates_prev):
|
||||
global mouse_prev, sections
|
||||
|
||||
PL = gstt.Laser
|
||||
dots = []
|
||||
|
||||
#switch to edit mode Key E ?
|
||||
if keystates[pygame.K_e] and not keystates_prev[pygame.K_e] and gstt.EditStep == 0:
|
||||
print "Switching to Edit Mode"
|
||||
gstt.EditStep = 1
|
||||
gstt.CurrentWindow = 0
|
||||
gstt.CurrentCorner = 0
|
||||
|
||||
# Back to normal if ENTER key is pressed ?
|
||||
if keystates[pygame.K_RETURN] and gstt.EditStep == 1:
|
||||
|
||||
print "Switching to Run Mode"
|
||||
gstt.EditStep =0
|
||||
|
||||
|
||||
|
||||
# EDIT MODE : cycle windows if press e key to adjust corner position
|
||||
# Escape edit mode with enter key
|
||||
if gstt.EditStep >0:
|
||||
|
||||
dots = []
|
||||
CurrentWindowPoints = gstt.Windows[gstt.CurrentWindow]
|
||||
|
||||
# Draw all windows points or "corners"
|
||||
for corner in xrange(len(CurrentWindowPoints)):
|
||||
dots.append(proj(int(CurrentWindowPoints[corner][0]),int(CurrentWindowPoints[corner][1]),0))
|
||||
fwork.PolyLineOneColor( dots, c=colorify.rgb2hex(gstt.color), PL = PL, closed = False )
|
||||
|
||||
# Left mouse is clicked, modify current Corner coordinate
|
||||
if gstt.mouse[1][0] == mouse_prev[1][0] and mouse_prev[1][0] == 1:
|
||||
deltax = gstt.mouse[0][0]-mouse_prev[0][0]
|
||||
deltay = gstt.mouse[0][1]-mouse_prev[0][1]
|
||||
CurrentWindowPoints[gstt.CurrentCorner][0] += (deltax *2)
|
||||
CurrentWindowPoints[gstt.CurrentCorner][1] -= (deltay * 2)
|
||||
|
||||
# Change corner if Z key is pressed.
|
||||
if keystates[pygame.K_z] and not keystates_prev[pygame.K_z]:
|
||||
if gstt.CurrentCorner < settings.Mapping(sections[gstt.CurrentSection]) - 1:
|
||||
gstt.CurrentCorner += 1
|
||||
print "Corner : ", gstt.CurrentCorner
|
||||
|
||||
# Press E inside Edit mode : Next window
|
||||
if keystates[pygame.K_e] and not keystates_prev[pygame.K_e]:
|
||||
|
||||
# Save current Window and switch to the next one.
|
||||
if gstt.CurrentWindow < settings.Mapping(sections[gstt.CurrentSection]) -1:
|
||||
print "saving "
|
||||
settings.MappingWrite(sections,str(gstt.CurrentWindow),CurrentWindowPoints)
|
||||
gstt.CurrentWindow += 1
|
||||
gstt.CurrentCorner = -1
|
||||
if gstt.CurrentWindow == settings.Mapping(sections[gstt.CurrentSection]) -1:
|
||||
gstt.EditStep == 0
|
||||
gstt.CurrentWindow = 0
|
||||
print "Now Editing window ", gstt.CurrentWindow
|
||||
|
||||
mouse_prev = gstt.mouse
|
||||
gstt.PL[PL] = fwork.LinesPL(PL)
|
||||
|
||||
# Press A : Next section ?
|
||||
if keystates[pygame.K_a] and not keystates_prev[pygame.K_a]:
|
||||
|
||||
print "current section : ", gstt.CurrentSection
|
||||
if gstt.CurrentSection < len(sections)-1:
|
||||
gstt.CurrentSection += 1
|
||||
print "Next section name is ", sections[gstt.CurrentSection]
|
||||
if "screen" in sections[gstt.CurrentSection]:
|
||||
print ""
|
||||
print "switching to section ", gstt.CurrentSection, " ", sections[gstt.CurrentSection]
|
||||
MappingConf(gstt.CurrentSection)
|
||||
else:
|
||||
gstt.CurrentSection = -1
|
||||
|
||||
|
||||
# RUN MODE
|
||||
if gstt.EditStep == 0:
|
||||
|
||||
# Add all windows to PL for display
|
||||
for Window in gstt.Windows:
|
||||
|
||||
dots = []
|
||||
for corner in xrange(len(Window)):
|
||||
#print "Editing : ", WindowPoints[corner]
|
||||
#print Window[corner][0]
|
||||
dots.append(proj(int(Window[corner][0]),int(Window[corner][1]),0))
|
||||
|
||||
fwork.PolyLineOneColor( dots, c=colorify.rgb2hex(gstt.color), PL = PL, closed = False )
|
||||
|
||||
gstt.PL[PL] = fwork.LinesPL(PL)
|
||||
|
||||
|
||||
|
||||
# Curve 1 : generic pose animations
|
||||
import json
|
||||
gstt.CurrentPose = 1
|
||||
'''
|
||||
# get absolute body position points
|
||||
def getCOCO(pose_json,pose_points):
|
||||
|
||||
dots = []
|
||||
for dot in pose_points:
|
||||
if len(pose_json['part_candidates'][0][str(dot)]) != 0:
|
||||
dots.append((pose_json['part_candidates'][0][str(dot)][0], pose_json['part_candidates'][0][str(dot)][1]))
|
||||
return dots
|
||||
|
||||
|
||||
# get relative (-1 0 1) body position points. a position -1, -1 means doesn't exist
|
||||
def getBODY(pose_json,pose_points):
|
||||
|
||||
dots = []
|
||||
for dot in pose_points:
|
||||
#print pose_points
|
||||
if len(pose_json['people'][0]['pose_keypoints_2d']) != 0:
|
||||
#print "people 0"
|
||||
if pose_json['people'][0]['pose_keypoints_2d'][dot * 3] != -1 and pose_json['people'][0]['pose_keypoints_2d'][(dot * 3)+1] != -1:
|
||||
dots.append((pose_json['people'][0]['pose_keypoints_2d'][dot * 3], pose_json['people'][0]['pose_keypoints_2d'][(dot * 3)+1]))
|
||||
|
||||
#if len(pose_json['people']) != 1:
|
||||
#print "people1"
|
||||
#print "people 1", pose_json['people'][1]['pose_keypoints_2d']
|
||||
#print len(pose_json['people'])
|
||||
|
||||
return dots
|
||||
|
||||
|
||||
# get absolute face position points
|
||||
def getFACE(pose_json,pose_points):
|
||||
|
||||
dots = []
|
||||
for dot in pose_points:
|
||||
|
||||
if len(pose_json['people'][0]['face_keypoints_2d']) != 0:
|
||||
print "people 0"
|
||||
if pose_json['people'][0]['face_keypoints_2d'][dot * 3] != -1 and pose_json['people'][0]['face_keypoints_2d'][(dot * 3)+1] != -1:
|
||||
dots.append((pose_json['people'][0]['face_keypoints_2d'][dot * 3], pose_json['people'][0]['face_keypoints_2d'][(dot * 3)+1]))
|
||||
|
||||
if len(pose_json['people']) != 1:
|
||||
print "people 1"
|
||||
#print "people 1", pose_json['people'][1]['face_keypoints_2d']
|
||||
return dots
|
||||
|
||||
|
||||
# Body parts
|
||||
def bodyCOCO(pose_json):
|
||||
pose_points = [10,9,8,1,11,12,13]
|
||||
return getBODY(pose_json,pose_points)
|
||||
|
||||
def armCOCO(pose_json):
|
||||
pose_points = [7,6,5,1,2,3,4]
|
||||
return getBODY(pose_json,pose_points)
|
||||
|
||||
def headCOCO(pose_json):
|
||||
pose_points = [1,0]
|
||||
return getBODY(pose_json,pose_points)
|
||||
|
||||
|
||||
# Face keypoints
|
||||
def face(pose_json):
|
||||
pose_points = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
|
||||
return getFACE(pose_json,pose_points)
|
||||
|
||||
def browL(pose_json):
|
||||
pose_points = [26,25,24,23,22]
|
||||
return getFACE(pose_json,pose_points)
|
||||
|
||||
def browR(pose_json):
|
||||
pose_points = [21,20,19,18,17]
|
||||
return getFACE(pose_json,pose_points)
|
||||
|
||||
def eyeR(pose_json):
|
||||
pose_points = [36,37,38,39,40,41,36]
|
||||
return getFACE(pose_json,pose_points)
|
||||
|
||||
def eyeL(pose_json):
|
||||
pose_points = [42,43,44,45,46,47,42]
|
||||
return getFACE(pose_json,pose_points)
|
||||
|
||||
def nose(pose_json):
|
||||
pose_points = [27,28,29,30]
|
||||
return getFACE(pose_json,pose_points)
|
||||
|
||||
def mouth(pose_json):
|
||||
pose_points = [48,59,58,57,56,55,54,53,52,51,50,49,48,60,67,66,65,64,63,62,61,60]
|
||||
return getFACE(pose_json,pose_points)
|
||||
|
||||
|
||||
# best order face : face browL browr eyeR eyeL nose mouth
|
||||
'''
|
||||
|
||||
|
||||
# get absolute body position points
|
||||
def getCOCO(pose_json,pose_points, people):
|
||||
|
||||
dots = []
|
||||
for dot in pose_points:
|
||||
if len(pose_json['part_candidates'][people][str(dot)]) != 0:
|
||||
dots.append((pose_json['part_candidates'][people][str(dot)][0], pose_json['part_candidates'][people][str(dot)][1]))
|
||||
return dots
|
||||
|
||||
|
||||
# get relative (-1 0 1) body position points. a position -1, -1 means doesn't exist
|
||||
def getBODY(pose_json,pose_points, people):
|
||||
|
||||
dots = []
|
||||
for dot in pose_points:
|
||||
#print pose_points
|
||||
if len(pose_json['people'][people]['pose_keypoints_2d']) != 0:
|
||||
#print "people 0"
|
||||
if pose_json['people'][people]['pose_keypoints_2d'][dot * 3] != -1 and pose_json['people'][people]['pose_keypoints_2d'][(dot * 3)+1] != -1:
|
||||
dots.append((pose_json['people'][people]['pose_keypoints_2d'][dot * 3], pose_json['people'][people]['pose_keypoints_2d'][(dot * 3)+1]))
|
||||
|
||||
|
||||
return dots
|
||||
|
||||
|
||||
# get absolute face position points
|
||||
def getFACE(pose_json,pose_points, people):
|
||||
|
||||
dots = []
|
||||
for dot in pose_points:
|
||||
|
||||
if len(pose_json['people'][people]['face_keypoints_2d']) != 0:
|
||||
#print "people 0"
|
||||
if pose_json['people'][people]['face_keypoints_2d'][dot * 3] != -1 and pose_json['people'][people]['face_keypoints_2d'][(dot * 3)+1] != -1:
|
||||
dots.append((pose_json['people'][people]['face_keypoints_2d'][dot * 3], pose_json['people'][people]['face_keypoints_2d'][(dot * 3)+1]))
|
||||
'''
|
||||
if len(pose_json['people']) > 1:
|
||||
print len(pose_json['people'])
|
||||
print "people 1 face ", pose_json['people'][1]['face_keypoints_2d']
|
||||
'''
|
||||
|
||||
return dots
|
||||
|
||||
|
||||
# Body parts
|
||||
def bodyCOCO(pose_json, people):
|
||||
pose_points = [10,9,8,1,11,12,13]
|
||||
return getBODY(pose_json,pose_points, people)
|
||||
|
||||
def armCOCO(pose_json, people):
|
||||
pose_points = [7,6,5,1,2,3,4]
|
||||
return getBODY(pose_json,pose_points, people)
|
||||
|
||||
def headCOCO(pose_json, people):
|
||||
pose_points = [1,0]
|
||||
return getBODY(pose_json,pose_points, people)
|
||||
|
||||
|
||||
# Face keypoints
|
||||
def face(pose_json, people):
|
||||
pose_points = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def browL(pose_json, people):
|
||||
pose_points = [26,25,24,23,22]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def browR(pose_json, people):
|
||||
pose_points = [21,20,19,18,17]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def eyeR(pose_json, people):
|
||||
pose_points = [36,37,38,39,40,41,36]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def eyeL(pose_json, people):
|
||||
pose_points = [42,43,44,45,46,47,42]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def nose(pose_json, people):
|
||||
pose_points = [27,28,29,30]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
def mouth(pose_json, people):
|
||||
pose_points = [48,59,58,57,56,55,54,53,52,51,50,49,48,60,67,66,65,64,63,62,61,60]
|
||||
return getFACE(pose_json,pose_points, people)
|
||||
|
||||
import os
|
||||
|
||||
|
||||
# Get frame number for pose path describe in gstt.PoseDir
|
||||
def lengthPOSE(pose_dir):
|
||||
|
||||
|
||||
if gstt.debug > 0:
|
||||
print "Check directory ",'poses/' + pose_dir + '/'
|
||||
numfiles = sum(1 for f in os.listdir('poses/' + pose_dir + '/') if os.path.isfile(os.path.join('poses/' + pose_dir + '/', f)) and f[0] != '.')
|
||||
if gstt.debug > 0:
|
||||
print "Pose : ", pose_dir, numfiles, "images"
|
||||
return numfiles
|
||||
|
||||
|
||||
def preparePOSE():
|
||||
|
||||
# anim format (name, xpos,ypos, resize, currentframe, totalframe, count, speed)
|
||||
# total frames is fetched from directory file count
|
||||
|
||||
anims1 = [['sky',50,100,300,0,0,0,1],['2dancer1', 400,100, 300,0,0,0,1],['1dancer', 400,100, 300,0,0,0,1],['window1',100,100,300,0,0,0,1]]
|
||||
anims2 = [['window1', 400,200, 300,0,0,0,1],['2dancer1',100,200,300,0,0,0,1]]
|
||||
|
||||
for anim in anims1:
|
||||
anim[5]= lengthPOSE(anim[0])
|
||||
gstt.anims0 = anims1
|
||||
|
||||
|
||||
# display n pose animations on Laser 0
|
||||
def Pose(fwork):
|
||||
|
||||
for anim in gstt.anims0:
|
||||
PL = 0
|
||||
dots = []
|
||||
print anim, anim[5]
|
||||
# repeat anim[7] time the same frame
|
||||
anim[6] +=1
|
||||
if anim[6] == anim[7]:
|
||||
|
||||
anim[6] = 0
|
||||
# increase current frame and compare to total frame
|
||||
anim[4] += 1
|
||||
if anim[4] == anim[5]:
|
||||
anim[4] = 0
|
||||
|
||||
|
||||
posename = 'poses/' + anim[0] + '/' + anim[0] +'-'+str("%05d"%anim[4])+'.json'
|
||||
posefile = open(posename , 'r')
|
||||
posedatas = posefile.read()
|
||||
pose_json = json.loads(posedatas)
|
||||
|
||||
for people in range(len(pose_json['people'])):
|
||||
|
||||
fwork.rPolyLineOneColor(bodyCOCO(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(armCOCO(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(headCOCO(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
|
||||
# Face
|
||||
'''
|
||||
#fwork.rPolyLineOneColor(face(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(browL(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(browR(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(eyeR(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(eyeL(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(nose(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(mouth(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
'''
|
||||
|
||||
gstt.PL[PL] = fwork.LinesPL(PL)
|
||||
time.sleep(0.02)
|
||||
|
||||
|
||||
# decrease current frame
|
||||
if gstt.keystates[pygame.K_w]: # and not gstt.keystates_prev[pygame.K_w]:
|
||||
gstt.CurrentPose -= 1
|
||||
if gstt.CurrentPose < 2:
|
||||
gstt.CurrentPose = gstt.numfiles -1
|
||||
#time.sleep(0.033)
|
||||
print "Frame : ",gstt.CurrentPose
|
||||
|
||||
# increaser current frame
|
||||
if gstt.keystates[pygame.K_x]: # and not gstt.keystates_prev[pygame.K_x]:
|
||||
gstt.CurrentPose += 1
|
||||
if gstt.CurrentPose > gstt.numfiles -1:
|
||||
gstt.CurrentPose = 1
|
||||
#time.sleep(0.033)
|
||||
print "Frame : ",gstt.CurrentPose
|
||||
|
||||
|
||||
|
||||
# Curve 2 Faces
|
||||
import json
|
||||
gstt.CurrentPose = 1
|
||||
|
||||
def prepareFACES():
|
||||
|
||||
|
||||
# anim format (name, xpos,ypos, resize, currentframe, totalframe, count, speed)
|
||||
# total frame is fetched from directory file count
|
||||
|
||||
gstt.anims[0] = [['detroit1', 300,300, 100,0,0,0,1]]
|
||||
gstt.anims[1] = [['detroit1', 400,200, 200,0,0,0,1]]
|
||||
gstt.anims[2] = [['detroit1', 500,200, 300,0,0,0,1]]
|
||||
|
||||
'''
|
||||
# read anims number of frames from disk.
|
||||
for anim in range(len(gstt.anims0)):
|
||||
gstt.anims0[anim][5]= lengthPOSE(gstt.anims0[anim][0])
|
||||
for anim in range(len(gstt.anims1)):
|
||||
gstt.anims1[anim][5]= lengthPOSE(gstt.anims1[anim][0])
|
||||
for anim in range(len(gstt.anims2)):
|
||||
gstt.anims2[anim][5]= lengthPOSE(gstt.anims2[anim][0])
|
||||
'''
|
||||
|
||||
for laseranims in range(3):
|
||||
print laseranims
|
||||
for anim in range(len(gstt.anims[laseranims])):
|
||||
gstt.anims[laseranims][anim][5]= lengthPOSE(gstt.anims[laseranims][anim][0])
|
||||
|
||||
# display the face animation describe in gstt.PoseDir
|
||||
def Faces(fwork):
|
||||
|
||||
for laseranims in range(3):
|
||||
for anim in gstt.anims[laseranims]:
|
||||
PL = laseranims
|
||||
#print PL, anim
|
||||
dots = []
|
||||
#print anim, anim[5]
|
||||
# repeat anim[7] time the same frame
|
||||
anim[6] +=1
|
||||
if anim[6] == anim[7]:
|
||||
|
||||
anim[6] = 0
|
||||
# increase current frame and compare to total frame
|
||||
anim[4] += 1
|
||||
if anim[4] == anim[5]:
|
||||
anim[4] = 0
|
||||
|
||||
|
||||
posename = 'poses/' + anim[0] + '/' + anim[0] +'-'+str("%05d"%anim[4])+'.json'
|
||||
posefile = open(posename , 'r')
|
||||
posedatas = posefile.read()
|
||||
pose_json = json.loads(posedatas)
|
||||
|
||||
# Face
|
||||
|
||||
for people in range(len(pose_json['people'])):
|
||||
|
||||
#fwork.rPolyLineOneColor(face(pose), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(browL(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(browR(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(eyeR(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(eyeL(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(nose(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(mouth(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
|
||||
gstt.PL[PL] = fwork.LinesPL(PL)
|
||||
time.sleep(0.02)
|
||||
|
||||
# Curve 3
|
||||
# Dancers
|
||||
import json
|
||||
gstt.CurrentPose = 1
|
||||
|
||||
def prepareDANCERS():
|
||||
|
||||
# anim format (name, xpos,ypos, resize, currentframe, totalframe, count, speed)
|
||||
# total frame is fetched from directory file count
|
||||
|
||||
gstt.anims[0] = [['1dancer',500,200,300,0,0,0,10]]
|
||||
gstt.anims[1] = [['2dancer1',500,200,300,0,0,0,10]]
|
||||
gstt.anims[2] = [['window1',500,200,300,0,0,0,10]]
|
||||
#gstt.anims[1] = [['2dancer1',100,200,300,0,0,0,10]]
|
||||
#gstt.anims[2] = [['window1',400,200, 300,0,0,0,10]]
|
||||
# read anims number of frames from disk.
|
||||
print gstt.anims
|
||||
|
||||
for laseranims in range(3):
|
||||
print laseranims
|
||||
for anim in range(len(gstt.anims[laseranims])):
|
||||
gstt.anims[laseranims][anim][5]= lengthPOSE(gstt.anims[laseranims][anim][0])
|
||||
|
||||
# display the pose animation describe in gstt.PoseDir
|
||||
def Dancers(fwork):
|
||||
|
||||
for laseranims in range(3):
|
||||
for anim in gstt.anims[laseranims]:
|
||||
PL = laseranims
|
||||
#print PL, anim
|
||||
dots = []
|
||||
#print anim, anim[5]
|
||||
# repeat anim[7] time the same frame
|
||||
anim[6] +=1
|
||||
if anim[6] == anim[7]:
|
||||
|
||||
anim[6] = 0
|
||||
# increase current frame and compare to total frame
|
||||
anim[4] += 1
|
||||
if anim[4] == anim[5]:
|
||||
anim[4] = 0
|
||||
|
||||
|
||||
#bhorosc.sendresol("/layer1/clip1/connect",1)
|
||||
#bhorosc.sendresol("/layer1/clip1/connect",0)
|
||||
|
||||
posename = 'poses/' + anim[0] + '/' + anim[0] +'-'+str("%05d"%anim[4])+'.json'
|
||||
posefile = open(posename , 'r')
|
||||
posedatas = posefile.read()
|
||||
pose_json = json.loads(posedatas)
|
||||
|
||||
|
||||
for people in range(len(pose_json['people'])):
|
||||
fwork.rPolyLineOneColor(bodyCOCO(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(armCOCO(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
|
||||
fwork.rPolyLineOneColor(browL(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(browR(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(eyeR(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(eyeL(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(nose(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(mouth(pose_json, people), c=colorify.rgb2hex(gstt.color), PL = laseranims, closed = False,xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
|
||||
|
||||
gstt.PL[PL] = fwork.LinesPL(PL)
|
||||
|
||||
'''
|
||||
fwork.rPolyLineOneColor(bodyCOCO(pose_json), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(armCOCO(pose_json), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
fwork.rPolyLineOneColor(headCOCO(pose_json), c=colorify.rgb2hex(gstt.color), PL = 0, closed = False, xpos = anim[1], ypos = anim[2], resize = anim[3])
|
||||
|
||||
|
||||
gstt.PL[PL] = fwork.LinesPL(PL)
|
||||
'''
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0148643,-0.15941,0.500901,0.0638024,0.728958,0.19945,-0.328304,0.788883,0.145804,-1,-1,0,-1,-1,0,0.345657,0.636286,0.0545305,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0587263,-0.273802,0.0737868,0.143515,-0.399022,0.793463,-0.288503,-0.235708,0.538172,0.333401,-0.301069,0.611769],"face_keypoints_2d":[-0.289045,-0.346686,0.806199,-0.285659,-0.226228,0.754247,-0.265344,-0.099748,0.857491,-0.245029,0.0267324,0.821296,-0.217943,0.141167,0.822941,-0.180699,0.243556,0.854031,-0.126526,0.339922,0.873669,-0.0689674,0.424242,0.850003,0.00890613,0.442311,0.85961,0.0901654,0.424242,0.904688,0.154496,0.345945,0.799773,0.208669,0.249579,0.797371,0.252684,0.141167,0.893008,0.279771,0.0146867,0.834693,0.303471,-0.105771,0.898608,0.313629,-0.244297,0.823152,0.327172,-0.370777,0.752754,-0.234872,-0.437029,0.862404,-0.2044,-0.491235,0.882747,-0.153613,-0.521349,0.868892,-0.102826,-0.527372,0.896606,-0.0520384,-0.491235,0.888597,0.0495358,-0.491235,0.81811,0.0935512,-0.533395,0.898624,0.144338,-0.539418,0.925263,0.198511,-0.533395,0.919783,0.242527,-0.485212,0.840425,0.00213444,-0.388846,0.895443,0.00552034,-0.298503,0.938861,0.00552034,-0.220205,0.872246,0.00552034,-0.141908,0.881353,-0.0452668,-0.0575879,0.950002,-0.0215662,-0.051565,0.955559,0.00552034,-0.0455421,0.915301,0.0359925,-0.0575879,0.967199,0.063079,-0.0636107,0.882903,-0.180699,-0.352709,0.916656,-0.153613,-0.388846,0.93621,-0.112983,-0.394869,0.86072,-0.0791248,-0.346686,0.904916,-0.116369,-0.340663,0.877038,-0.153613,-0.340663,0.945708,0.0901654,-0.352709,0.913797,0.120638,-0.394869,0.919425,0.164653,-0.400892,0.896582,0.195125,-0.388846,0.943091,0.168039,-0.346686,0.931992,0.124023,-0.346686,0.91015,-0.075739,0.10503,0.858349,-0.0452668,0.0749154,0.907224,-0.0181804,0.044801,0.958071,0.00890613,0.0508239,0.911711,0.0359925,0.044801,0.948243,0.080008,0.0628697,0.841089,0.117252,0.0990069,0.921018,0.0833938,0.14719,0.867122,0.0427642,0.183327,0.910024,0.00890613,0.18935,0.964708,-0.0181804,0.183327,0.97441,-0.0486526,0.159236,0.898616,-0.0621958,0.10503,0.850011,-0.0181804,0.0990069,0.920474,0.00890613,0.0990069,0.891335,0.0393783,0.092984,0.89465,0.0935512,0.0990069,0.874071,0.0393783,0.0990069,0.890809,0.00890613,0.10503,0.892964,-0.0181804,0.0990069,0.914852,-0.129912,-0.382823,0.849292,0.144338,-0.388846,0.97461],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0148731,-0.159382,0.481484,0.0607741,0.728913,0.200987,-0.328323,0.788893,0.138893,-1,-1,0,-1,-1,0,0.348723,0.636288,0.0555054,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0586175,-0.257478,0.0824673,0.143452,-0.393796,0.79817,-0.288458,-0.235741,0.533096,0.333458,-0.306421,0.621488],"face_keypoints_2d":[-0.289092,-0.349403,0.817312,-0.282318,-0.216858,0.757776,-0.265384,-0.102388,0.8586,-0.241676,0.0301571,0.836842,-0.214581,0.138603,0.822241,-0.180712,0.247048,0.844807,-0.126522,0.343445,0.861467,-0.0689456,0.421767,0.85582,0.00895238,0.439841,0.856564,0.0902373,0.421767,0.914149,0.154588,0.343445,0.800325,0.208778,0.253073,0.791145,0.252807,0.138603,0.891364,0.279902,0.0181075,0.837825,0.30361,-0.108412,0.89734,0.313771,-0.240957,0.804212,0.327318,-0.367477,0.755409,-0.234902,-0.439774,0.861279,-0.20442,-0.493997,0.885442,-0.153617,-0.524121,0.857937,-0.102814,-0.524121,0.88737,-0.0520112,-0.493997,0.897447,0.0495949,-0.493997,0.82938,0.0936241,-0.536171,0.892745,0.144427,-0.542195,0.925947,0.198617,-0.536171,0.911893,0.242646,-0.481948,0.830484,0.00217867,-0.391576,0.887533,0.00556552,-0.301205,0.936539,0.00556552,-0.210833,0.880418,0.00556552,-0.138536,0.857668,-0.0452375,-0.0602143,0.960338,-0.0215294,-0.0541896,0.944356,0.00556552,-0.0481649,0.902171,0.0360475,-0.0541896,0.967314,0.0597554,-0.0662391,0.887087,-0.180712,-0.355428,0.923763,-0.153617,-0.391576,0.934856,-0.112975,-0.391576,0.864746,-0.0757193,-0.349403,0.921526,-0.116362,-0.343378,0.874749,-0.153617,-0.343378,0.93705,0.0902373,-0.355428,0.933832,0.117332,-0.397601,0.930239,0.164748,-0.403626,0.905575,0.19523,-0.385552,0.934451,0.168135,-0.349403,0.950951,0.120719,-0.349403,0.920924,-0.0757193,0.108479,0.850244,-0.0452375,0.0783552,0.920381,-0.0181426,0.0422066,0.953672,0.00895238,0.0542561,0.899855,0.0360475,0.0422066,0.936657,0.0800766,0.0663056,0.842214,0.117332,0.0964295,0.90938,0.0834635,0.150652,0.863238,0.0428212,0.180776,0.907399,0.00895238,0.186801,0.96411,-0.0181426,0.186801,0.976852,-0.0486243,0.162702,0.901605,-0.0621719,0.108479,0.843034,-0.0181426,0.0964295,0.906643,0.00895238,0.102454,0.880876,0.0394343,0.0964295,0.879302,0.0936241,0.102454,0.859552,0.0394343,0.0964295,0.875445,0.00895238,0.108479,0.883945,-0.0181426,0.102454,0.902515,-0.129909,-0.379527,0.842968,0.14104,-0.391576,0.968887],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.00866997,-0.153941,0.540912,0.076061,0.734361,0.174764,-0.328277,0.79434,0.117262,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0618006,-0.257525,0.066583,0.143538,-0.393731,0.810048,-0.288482,-0.235767,0.53243,0.333414,-0.306583,0.620482],"face_keypoints_2d":[-0.289119,-0.349495,0.810958,-0.282345,-0.229003,0.756956,-0.265411,-0.102486,0.866566,-0.241704,0.0240313,0.823343,-0.217996,0.138499,0.828506,-0.180741,0.240917,0.851053,-0.126553,0.337311,0.866511,-0.0655907,0.421656,0.819489,0.0123055,0.43973,0.845579,0.0902016,0.421656,0.906504,0.154551,0.343336,0.799062,0.212126,0.252967,0.792731,0.252767,0.138499,0.891566,0.279862,0.0240313,0.843306,0.303569,-0.10851,0.899025,0.31373,-0.241052,0.795215,0.327277,-0.361544,0.756557,-0.238317,-0.439864,0.859178,-0.204449,-0.494086,0.89293,-0.153647,-0.524209,0.856174,-0.102845,-0.518185,0.884846,-0.0520436,-0.494086,0.90216,0.0495601,-0.494086,0.825795,0.0935884,-0.536258,0.887853,0.14439,-0.542283,0.926849,0.198579,-0.536258,0.908512,0.23922,-0.488061,0.815789,0.00214505,-0.385643,0.87424,0.00553191,-0.301298,0.924764,0.00553191,-0.210929,0.895698,0.00214505,-0.138633,0.831836,-0.0452699,-0.0603134,0.966912,-0.0215625,-0.0542889,0.928133,0.00553191,-0.0422395,0.889076,0.036013,-0.0542889,0.96231,0.0631074,-0.0603134,0.895665,-0.180741,-0.35552,0.926712,-0.153647,-0.391667,0.931693,-0.109619,-0.391667,0.875538,-0.0757511,-0.349495,0.938925,-0.113006,-0.343471,0.874025,-0.153647,-0.343471,0.935035,0.0902016,-0.349495,0.937042,0.120683,-0.397692,0.928876,0.164711,-0.403717,0.908338,0.195192,-0.385643,0.935088,0.168098,-0.349495,0.955815,0.124069,-0.349495,0.915398,-0.0757511,0.108376,0.854693,-0.0486567,0.0782528,0.906247,-0.0181757,0.0421051,0.958799,0.00891864,0.0541543,0.891388,0.0393997,0.0421051,0.909087,0.083428,0.0662036,0.8464,0.117296,0.0963266,0.894638,0.0868149,0.150548,0.877966,0.0461733,0.180671,0.892006,0.00891864,0.186696,0.947739,-0.0181757,0.186696,0.988053,-0.0486567,0.162598,0.893335,-0.0588171,0.114401,0.843454,-0.0181757,0.102351,0.903246,0.00891864,0.108376,0.876053,0.0427866,0.0963266,0.856296,0.0902016,0.0963266,0.829186,0.0393997,0.0963266,0.849679,0.00891864,0.108376,0.881562,-0.0181757,0.102351,0.903071,-0.12994,-0.379618,0.852615,0.14439,-0.391667,0.96691],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.00863409,-0.153948,0.529183,0.0730438,0.728986,0.177436,-0.328275,0.794334,0.121815,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0617536,-0.262909,0.0666818,0.143545,-0.393768,0.807967,-0.2885,-0.241039,0.53219,0.33343,-0.306459,0.614316],"face_keypoints_2d":[-0.289044,-0.35205,0.824691,-0.282272,-0.219541,0.765345,-0.265342,-0.105101,0.871941,-0.24164,0.0274081,0.843003,-0.214552,0.135825,0.829571,-0.180693,0.244241,0.843541,-0.126518,0.334589,0.860706,-0.0655702,0.418913,0.828944,0.0123069,0.436982,0.8477,0.090184,0.418913,0.917335,0.154517,0.346635,0.795717,0.212079,0.256288,0.787102,0.25271,0.135825,0.88439,0.279798,0.0274081,0.850094,0.303499,-0.105101,0.894947,0.313657,-0.23761,0.785633,0.327201,-0.364097,0.774013,-0.238254,-0.442397,0.862741,-0.204395,-0.490583,0.898622,-0.153605,-0.520698,0.856884,-0.102816,-0.514675,0.885052,-0.0486404,-0.490583,0.901316,0.0461664,-0.496606,0.821392,0.0935699,-0.532745,0.882321,0.144359,-0.544791,0.931348,0.198535,-0.532745,0.904689,0.239166,-0.484559,0.811248,0.00214899,-0.388189,0.868548,0.00553501,-0.297842,0.919294,0.00214899,-0.213518,0.903056,0.00214899,-0.135217,0.834496,-0.0452543,-0.0629391,0.970798,-0.0215527,-0.0508929,0.918541,0.00553501,-0.0388466,0.8815,0.0360086,-0.056916,0.953282,0.0597104,-0.0629391,0.91143,-0.180693,-0.35205,0.937855,-0.153605,-0.394212,0.929746,-0.109588,-0.394212,0.868006,-0.0757281,-0.35205,0.942382,-0.112974,-0.346027,0.864661,-0.153605,-0.340004,0.923325,0.090184,-0.35205,0.953911,0.117272,-0.400235,0.938134,0.164675,-0.400235,0.920223,0.195149,-0.388189,0.926738,0.168061,-0.35205,0.968519,0.120658,-0.35205,0.92262,-0.0757281,0.111732,0.85314,-0.0486404,0.0755932,0.91774,-0.0181668,0.0394543,0.952744,0.00892103,0.0575238,0.890369,0.0360086,0.0394543,0.918542,0.0800261,0.0695701,0.849718,0.117272,0.0996858,0.892188,0.0834121,0.153894,0.858427,0.0427805,0.18401,0.901905,0.00892103,0.18401,0.946804,-0.0181668,0.18401,0.989764,-0.0486404,0.16594,0.902874,-0.0587983,0.111732,0.849887,-0.0181668,0.105709,0.900858,0.00892103,0.111732,0.888921,0.0393946,0.0996858,0.857587,0.0935699,0.0996858,0.828515,0.0393946,0.0996858,0.852929,0.00892103,0.117755,0.898521,-0.0181668,0.105709,0.903876,-0.129903,-0.376143,0.840096,0.140973,-0.394212,0.951099],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.00871623,-0.148588,0.569172,0.0576988,0.734349,0.187343,-0.456959,0.892245,0.0633007,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0618631,-0.257533,0.0671636,0.143546,-0.393634,0.791575,-1,-1,0,0.336423,-0.295672,0.647767],"face_keypoints_2d":[-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.011765,-0.148614,0.571729,0.0576712,0.734339,0.184835,-0.447788,0.886913,0.0687676,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0617794,-0.257509,0.070505,0.14356,-0.393663,0.7861,-1,-1,0,0.336432,-0.295667,0.651987],"face_keypoints_2d":[-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0147738,-0.154089,0.552351,0.0423909,0.745255,0.165567,-0.472305,0.892448,0.0740628,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.055673,-0.262994,0.068975,0.143562,-0.388325,0.78389,-1,-1,0,0.33649,-0.290279,0.603089],"face_keypoints_2d":[-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0147679,-0.154081,0.553844,0.0424023,0.750744,0.159151,-0.469235,0.897788,0.0671036,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0556687,-0.262996,0.0689637,0.143587,-0.38834,0.785216,-1,-1,0,0.336428,-0.29009,0.61977],"face_keypoints_2d":[-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0147965,-0.181079,0.537637,0.0485232,0.761596,0.160742,-0.463082,0.892228,0.0551346,-1,-1,0,-1,-1,0,0.318083,0.810665,0.0534231,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.061764,-0.273847,0.0631221,0.146555,-0.388248,0.7981,-1,-1,0,0.336518,-0.284742,0.65383],"face_keypoints_2d":[-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0147817,-0.181068,0.53297,0.0546145,0.767037,0.155468,-0.469207,0.89231,0.0524822,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0588247,-0.268399,0.0623509,0.146546,-0.388234,0.799272,-1,-1,0,0.336514,-0.28479,0.652666],"face_keypoints_2d":[-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117706,-0.159311,0.557157,0.0515563,0.788844,0.155775,-0.447787,0.881444,0.11066,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0588164,-0.2575,0.0633908,0.146569,-0.38289,0.812702,-1,-1,0,0.336564,-0.290233,0.650792],"face_keypoints_2d":[-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117658,-0.159322,0.558405,0.051576,0.783387,0.15015,-0.456983,0.886935,0.115462,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0588235,-0.257507,0.0637515,0.146549,-0.382863,0.813744,-1,-1,0,0.336576,-0.290246,0.63633],"face_keypoints_2d":[-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117699,-0.153993,0.576266,0.0424085,0.783398,0.176197,-0.3191,0.772509,0.240012,-0.588715,0.919599,0.157129,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.132325,-0.371914,0.758903,0.146597,-0.382856,0.805306,-0.285404,-0.235811,0.595692,0.336621,-0.290115,0.643881],"face_keypoints_2d":[-0.283555,-0.355407,0.719134,-0.272237,-0.229575,0.76636,-0.263749,-0.103742,0.807947,-0.243942,0.02209,0.851747,-0.218476,0.142889,0.789506,-0.176034,0.258655,0.854514,-0.119444,0.349254,0.786922,-0.0600241,0.424754,0.833705,0.0220315,0.454953,0.815594,0.0955987,0.424754,0.88643,0.160677,0.349254,0.880257,0.214438,0.258655,0.834345,0.254051,0.142889,0.848707,0.285176,0.02209,0.808456,0.304982,-0.103742,0.817863,0.31913,-0.229575,0.82912,0.321959,-0.370507,0.74968,-0.224136,-0.45104,0.764502,-0.19584,-0.501373,0.834861,-0.147739,-0.511439,0.832287,-0.102467,-0.506406,0.84475,-0.0543652,-0.491306,0.788298,0.0559856,-0.501373,0.776041,0.109746,-0.521506,0.815161,0.160677,-0.541639,0.898718,0.205949,-0.511439,0.877726,0.248392,-0.46614,0.86494,0.00505447,-0.37554,0.863519,0.00505447,-0.284941,0.858898,0.00505447,-0.194342,0.854294,0.00505447,-0.108776,0.820414,-0.0402176,-0.0534094,0.891923,-0.0175815,-0.0332763,0.884505,0.00505447,-0.0282429,0.873745,0.0333495,-0.0433428,0.819433,0.0588151,-0.0584427,0.83023,-0.178863,-0.350374,0.923208,-0.150568,-0.385607,0.918522,-0.110955,-0.385607,0.943537,-0.0826602,-0.34534,0.900843,-0.110955,-0.340307,0.91984,-0.150568,-0.335274,0.872099,0.0955987,-0.355407,0.912277,0.123894,-0.395673,0.848764,0.163507,-0.400707,0.882168,0.20029,-0.380574,0.871962,0.163507,-0.34534,0.916719,0.132382,-0.34534,0.896495,-0.0854897,0.107656,0.881668,-0.0487061,0.0824895,0.817374,-0.020411,0.0573231,0.956335,0.0107135,0.0623564,0.85269,0.0474972,0.0573231,0.95432,0.0842806,0.0774562,0.818742,0.118235,0.102623,0.888685,0.0927691,0.157989,0.848011,0.053156,0.188189,0.880245,0.0163726,0.203289,0.815311,-0.020411,0.193222,0.893827,-0.0571947,0.168056,0.836507,-0.0600241,0.112689,0.806992,-0.0175815,0.112689,0.878985,0.013543,0.117723,0.836136,0.0503266,0.107656,0.894209,0.0899397,0.107656,0.780141,0.0503266,0.112689,0.876656,0.013543,0.122756,0.841217,-0.0175815,0.112689,0.879042,-0.130762,-0.370507,0.819651,0.140871,-0.380574,0.904342],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117559,-0.153954,0.581856,0.0454271,0.788856,0.17376,-0.322156,0.772573,0.232452,-0.594847,0.930497,0.155606,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.132325,-0.371912,0.757495,0.14659,-0.382863,0.800216,-0.285412,-0.235812,0.601767,0.336543,-0.295579,0.647546],"face_keypoints_2d":[-0.283601,-0.356777,0.717197,-0.272282,-0.225902,0.768905,-0.263793,-0.105094,0.807215,-0.243985,0.020748,0.849048,-0.218517,0.141556,0.784824,-0.176072,0.25733,0.856148,-0.122307,0.347936,0.781884,-0.0600533,0.423441,0.834852,0.0220084,0.453644,0.816765,0.0955811,0.423441,0.88096,0.160665,0.347936,0.873513,0.214429,0.262364,0.834332,0.254045,0.141556,0.843241,0.285172,0.020748,0.809857,0.30498,-0.105094,0.818759,0.319129,-0.230935,0.83579,0.321958,-0.371878,0.752585,-0.224177,-0.447383,0.760363,-0.19305,-0.49772,0.821349,-0.147775,-0.507787,0.828889,-0.0996694,-0.507787,0.846515,-0.0543939,-0.492686,0.783224,0.0559651,-0.502754,0.772038,0.1069,-0.522888,0.81385,0.160665,-0.537989,0.885941,0.20594,-0.512821,0.884969,0.248386,-0.462484,0.86689,0.00503016,-0.376912,0.86048,0.00503016,-0.286306,0.858525,0.00503016,-0.190666,0.860776,0.00503016,-0.110127,0.821252,-0.0402453,-0.0547571,0.883212,-0.0176076,-0.0346224,0.890718,0.00503016,-0.024555,0.880895,0.0333273,-0.0446898,0.816212,0.0616245,-0.0597907,0.822979,-0.178901,-0.34671,0.924886,-0.150604,-0.381946,0.916372,-0.110988,-0.386979,0.94302,-0.082691,-0.34671,0.899472,-0.110988,-0.336643,0.913436,-0.150604,-0.331609,0.865547,0.0955811,-0.351744,0.924691,0.123878,-0.397047,0.855258,0.163494,-0.40208,0.88135,0.200281,-0.376912,0.869375,0.163494,-0.34671,0.921412,0.132367,-0.34671,0.896039,-0.0855208,0.111354,0.880839,-0.0515642,0.0861857,0.823792,-0.0204372,0.0610173,0.958753,0.0106896,0.066051,0.843556,0.0474759,0.0559835,0.953104,0.087092,0.081152,0.817818,0.118219,0.101287,0.878883,0.0927514,0.161691,0.849124,0.0531354,0.186859,0.872218,0.0163491,0.206994,0.814879,-0.0204372,0.191893,0.890009,-0.0572236,0.166724,0.840448,-0.062883,0.116388,0.820856,-0.0204372,0.111354,0.875416,0.0135193,0.121421,0.83227,0.0503057,0.10632,0.877617,0.0927514,0.10632,0.794221,0.0503057,0.111354,0.867251,0.0135193,0.126455,0.846612,-0.0204372,0.116388,0.878568,-0.130796,-0.371878,0.812721,0.140857,-0.381946,0.902194],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117688,-0.153843,0.604259,0.048504,0.767069,0.174603,-0.334434,0.799731,0.199644,-0.591794,0.914163,0.131507,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.132311,-0.371845,0.741301,0.149566,-0.382807,0.801466,-0.282388,-0.235478,0.600158,0.33662,-0.284804,0.659002],"face_keypoints_2d":[-0.282427,-0.35401,0.726135,-0.273928,-0.222983,0.765367,-0.265429,-0.102034,0.811109,-0.242765,0.0239536,0.851912,-0.217268,0.144902,0.793382,-0.174773,0.260811,0.850085,-0.118112,0.351522,0.788378,-0.0557864,0.427115,0.830013,0.0235378,0.457352,0.805696,0.0943629,0.427115,0.887755,0.162355,0.351522,0.886611,0.213349,0.260811,0.843913,0.255844,0.144902,0.857585,0.284174,0.0239536,0.81037,0.306838,-0.102034,0.821283,0.321003,-0.228022,0.824903,0.323836,-0.369129,0.754158,-0.222934,-0.4548,0.789228,-0.191771,-0.500156,0.830888,-0.146442,-0.510235,0.833064,-0.101114,-0.505196,0.846377,-0.0586194,-0.490077,0.80015,0.0575337,-0.500156,0.782792,0.108528,-0.525354,0.812921,0.159522,-0.540472,0.894773,0.207683,-0.510235,0.870557,0.247345,-0.464879,0.855467,0.0065397,-0.374168,0.873097,0.0065397,-0.288496,0.86746,0.0065397,-0.197785,0.841131,0.0065397,-0.107074,0.812911,-0.0387884,-0.0516392,0.890393,-0.0161243,-0.0314811,0.89152,0.0065397,-0.0264416,0.880053,0.0320368,-0.0415602,0.826132,0.0603667,-0.0566787,0.836032,-0.177606,-0.348971,0.920422,-0.152108,-0.384247,0.92464,-0.109613,-0.384247,0.940699,-0.0812835,-0.343931,0.909282,-0.109613,-0.333852,0.916779,-0.152108,-0.333852,0.878233,0.0971959,-0.35401,0.918468,0.122693,-0.399366,0.858402,0.165188,-0.404405,0.88779,0.199184,-0.379208,0.862852,0.165188,-0.343931,0.92587,0.131192,-0.343931,0.891179,-0.0841165,0.114665,0.880741,-0.0529534,0.0894672,0.822626,-0.0189573,0.0592301,0.950295,0.00937271,0.0642697,0.865336,0.0490348,0.0592301,0.959897,0.0830308,0.0793881,0.820552,0.117027,0.104586,0.884761,0.0915298,0.16002,0.845802,0.0518677,0.190258,0.896672,0.0150387,0.205376,0.823638,-0.0189573,0.190258,0.886053,-0.0586194,0.170099,0.84742,-0.0586194,0.114665,0.791025,-0.0189573,0.109625,0.882843,0.0122057,0.119704,0.850487,0.0490348,0.109625,0.904153,0.0886968,0.109625,0.756994,0.0490348,0.109625,0.887425,0.0122057,0.124744,0.850978,-0.0189573,0.114665,0.879781,-0.129444,-0.369129,0.827496,0.142524,-0.379208,0.923257],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117736,-0.153836,0.602801,0.0485088,0.766997,0.177818,-0.33444,0.799724,0.201551,-0.591792,0.914181,0.128081,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.132309,-0.371841,0.740648,0.149563,-0.382807,0.80193,-0.282393,-0.235506,0.601555,0.336616,-0.28481,0.660253],"face_keypoints_2d":[-0.282427,-0.354017,0.722785,-0.273928,-0.22803,0.762255,-0.262596,-0.102043,0.808028,-0.242765,0.0239434,0.853072,-0.217268,0.144891,0.798661,-0.174774,0.260799,0.850557,-0.118114,0.351509,0.789561,-0.0586213,0.427102,0.832415,0.0235353,0.457339,0.80453,0.0943598,0.427102,0.887243,0.162351,0.351509,0.886452,0.213345,0.260799,0.844214,0.25584,0.144891,0.857537,0.28417,0.0239434,0.810895,0.304,-0.102043,0.821667,0.320998,-0.22803,0.825336,0.323831,-0.369136,0.754086,-0.222934,-0.454807,0.79121,-0.191771,-0.500162,0.828386,-0.146444,-0.510241,0.832824,-0.101116,-0.505202,0.846587,-0.0586213,-0.490083,0.801729,0.057531,-0.500162,0.782833,0.108525,-0.52536,0.812836,0.159518,-0.540478,0.894692,0.207679,-0.510241,0.870311,0.247341,-0.464886,0.855185,0.00653732,-0.374175,0.872393,0.00653732,-0.288504,0.8671,0.00653732,-0.197793,0.84116,0.00653732,-0.107083,0.812772,-0.0387904,-0.0516486,0.890465,-0.0161265,-0.0314907,0.891615,0.00653732,-0.0264513,0.879973,0.0320342,-0.0415697,0.826256,0.0603639,-0.0566881,0.836202,-0.177606,-0.348978,0.919829,-0.149277,-0.384254,0.923663,-0.109615,-0.384254,0.941281,-0.0812852,-0.343938,0.909349,-0.109615,-0.333859,0.918092,-0.149277,-0.333859,0.878157,0.0971928,-0.354017,0.918282,0.125523,-0.399373,0.857735,0.165184,-0.404412,0.887557,0.19918,-0.379215,0.862842,0.165184,-0.343938,0.925543,0.131189,-0.343938,0.891438,-0.0841181,0.109615,0.879556,-0.0529553,0.0894567,0.82167,-0.0189595,0.0592198,0.950652,0.00937033,0.0642593,0.865121,0.049032,0.0592198,0.960038,0.0830278,0.0793778,0.820713,0.117024,0.104575,0.8848,0.0915267,0.160009,0.845752,0.051865,0.190246,0.896813,0.0150362,0.205365,0.823645,-0.0189595,0.190246,0.886818,-0.0586213,0.170088,0.846554,-0.0586213,0.114654,0.789982,-0.0189595,0.109615,0.882284,0.0122032,0.119694,0.850321,0.049032,0.109615,0.90446,0.0886937,0.109615,0.7569,0.049032,0.109615,0.887616,0.0122032,0.124733,0.850809,-0.0189595,0.114654,0.879648,-0.129446,-0.369136,0.828846,0.14252,-0.379215,0.923023],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0147687,-0.153949,0.588822,0.0301107,0.761576,0.177504,-0.349732,0.810606,0.176241,-0.57951,0.903347,0.102059,-1,-1,0,0.333423,0.805222,0.0520652,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.135247,-0.371905,0.749393,0.149568,-0.382758,0.808853,-0.285388,-0.235794,0.582527,0.336527,-0.290164,0.649501],"face_keypoints_2d":[-0.283223,-0.355684,0.711229,-0.271811,-0.228797,0.773082,-0.263251,-0.10191,0.779325,-0.246132,0.0199019,0.836153,-0.217599,0.146789,0.801416,-0.174801,0.263525,0.819359,-0.117736,0.349808,0.82062,-0.0578188,0.425941,0.839726,0.0192182,0.456393,0.795053,0.093402,0.425941,0.893994,0.161879,0.349808,0.887928,0.213237,0.263525,0.843796,0.256036,0.146789,0.855616,0.284568,0.0249774,0.816873,0.304541,-0.10191,0.838841,0.32166,-0.228797,0.821011,0.324513,-0.37091,0.762017,-0.226159,-0.452118,0.771018,-0.194773,-0.497797,0.798265,-0.151975,-0.507948,0.851845,-0.106324,-0.507948,0.858859,-0.0635253,-0.497797,0.821846,0.0648698,-0.502873,0.777226,0.113375,-0.523175,0.830311,0.161879,-0.543477,0.911111,0.207531,-0.513024,0.889104,0.247476,-0.462269,0.859453,0.00495207,-0.375986,0.868278,0.00495207,-0.284627,0.857373,0.00495207,-0.193268,0.855866,0.00495207,-0.106985,0.842174,-0.0406995,-0.0511549,0.91153,-0.0178737,-0.030853,0.891602,0.00495207,-0.0257775,0.879851,0.0334843,-0.0460794,0.836327,0.0591633,-0.0562304,0.851607,-0.177654,-0.345533,0.926151,-0.151975,-0.386137,0.917604,-0.11203,-0.386137,0.94303,-0.0834978,-0.345533,0.905018,-0.11203,-0.335382,0.92412,-0.151975,-0.330306,0.86418,0.0962553,-0.350608,0.928416,0.121934,-0.396288,0.866358,0.164733,-0.401363,0.888613,0.196118,-0.375986,0.856046,0.164733,-0.345533,0.940567,0.130494,-0.340457,0.896144,-0.0834978,0.111261,0.886129,-0.0492591,0.0858831,0.825018,-0.0207269,0.0605057,0.96072,0.0106585,0.0655812,0.868347,0.0477504,0.0605057,0.94936,0.081989,0.0757321,0.832931,0.116228,0.106185,0.901147,0.0905488,0.15694,0.851341,0.0506036,0.192468,0.911831,0.0135118,0.202619,0.823717,-0.0207269,0.192468,0.919947,-0.0549656,0.172166,0.830238,-0.0549656,0.116336,0.787267,-0.0178737,0.111261,0.892341,0.0135118,0.116336,0.860255,0.0477504,0.106185,0.929901,0.0876956,0.106185,0.751593,0.0477504,0.111261,0.913197,0.0135118,0.121412,0.850468,-0.0178737,0.111261,0.886042,-0.132003,-0.37091,0.827571,0.141907,-0.381061,0.944625],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117655,-0.153893,0.596828,0.0301178,0.761653,0.177706,-0.349767,0.810677,0.161857,-0.576485,0.90328,0.0944752,-1,-1,0,0.336479,0.805156,0.0542811,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.132351,-0.371941,0.747954,0.149591,-0.382784,0.809091,-0.2854,-0.240969,0.5856,0.33658,-0.284803,0.643375],"face_keypoints_2d":[-0.284039,-0.360554,0.705915,-0.272675,-0.229158,0.74734,-0.264152,-0.107869,0.779394,-0.244265,0.0184731,0.847708,-0.218696,0.144816,0.816043,-0.176081,0.261051,0.844779,-0.119262,0.346963,0.802433,-0.0596016,0.427822,0.848472,0.0199457,0.458145,0.797384,0.0938112,0.427822,0.885614,0.161994,0.352017,0.881592,0.213132,0.261051,0.853027,0.255747,0.144816,0.851926,0.284156,0.0235269,0.818436,0.304043,-0.102815,0.840348,0.321089,-0.229158,0.825592,0.32393,-0.370661,0.756098,-0.224378,-0.456574,0.77683,-0.195968,-0.497004,0.821555,-0.150513,-0.507111,0.856332,-0.107898,-0.507111,0.861653,-0.0624425,-0.497004,0.830335,0.0654013,-0.502057,0.782136,0.113698,-0.527326,0.833954,0.161994,-0.542487,0.914981,0.20745,-0.512165,0.881841,0.247224,-0.466681,0.852476,0.00574088,-0.375715,0.86434,0.00574088,-0.284748,0.855028,0.00574088,-0.193782,0.859246,0.00574088,-0.107869,0.836236,-0.0397148,-0.0522785,0.898966,-0.016987,-0.0320637,0.895801,0.00574088,-0.02701,0.881555,0.0313097,-0.0421711,0.832245,0.0568784,-0.0573322,0.842625,-0.178923,-0.350447,0.922561,-0.150513,-0.385822,0.925248,-0.110739,-0.385822,0.939909,-0.0823294,-0.345393,0.9026,-0.110739,-0.335285,0.91995,-0.150513,-0.335285,0.876537,0.096652,-0.350447,0.920631,0.122221,-0.39593,0.863665,0.164835,-0.400983,0.888321,0.196086,-0.375715,0.855051,0.164835,-0.345393,0.938651,0.130744,-0.340339,0.893083,-0.0851703,0.10944,0.882035,-0.0510786,0.0841712,0.815679,-0.019828,0.0589027,0.955847,0.0114228,0.0639565,0.867051,0.0483555,0.0589027,0.961946,0.0852882,0.0740639,0.824144,0.116539,0.104386,0.893369,0.09097,0.159977,0.854499,0.0511965,0.190299,0.902721,0.0142637,0.200406,0.823601,-0.019828,0.190299,0.900451,-0.0567605,0.170084,0.843706,-0.0539197,0.114493,0.783046,-0.016987,0.10944,0.884921,0.0114228,0.114493,0.856378,0.0483555,0.104386,0.917008,0.0852882,0.104386,0.754368,0.0483555,0.10944,0.903597,0.0114228,0.119547,0.848604,-0.016987,0.114493,0.880118,-0.130626,-0.370661,0.833376,0.142108,-0.380769,0.944364],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117382,-0.159302,0.564235,0.0209599,0.761618,0.187644,-0.328345,0.799776,0.195855,-0.570329,0.886952,0.135733,-1,-1,0,0.348736,0.799747,0.0596672,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.135271,-0.372011,0.739959,0.14655,-0.388229,0.797756,-0.288433,-0.235554,0.559505,0.336566,-0.284597,0.692459],"face_keypoints_2d":[-0.284328,-0.360646,0.705768,-0.27578,-0.228863,0.755398,-0.264383,-0.107217,0.772215,-0.247287,0.0194976,0.835057,-0.218793,0.146212,0.80531,-0.176053,0.26279,0.820426,-0.119066,0.348956,0.82199,-0.0592301,0.424984,0.832674,0.0205516,0.455396,0.797541,0.0917852,0.424984,0.897528,0.160169,0.348956,0.889104,0.211458,0.26279,0.851577,0.254198,0.146212,0.853342,0.282691,0.0245662,0.821507,0.302637,-0.102148,0.849335,0.319733,-0.228863,0.822608,0.322582,-0.370784,0.762061,-0.227341,-0.456949,0.788578,-0.195999,-0.502567,0.815363,-0.153259,-0.512704,0.840023,-0.107669,-0.507635,0.850439,-0.0649288,-0.497498,0.833344,0.0661411,-0.502567,0.793305,0.111731,-0.532978,0.845844,0.160169,-0.543115,0.924377,0.205759,-0.512704,0.880245,0.24565,-0.467087,0.85664,0.00345552,-0.375852,0.872391,0.00345552,-0.289686,0.862485,0.00345552,-0.198452,0.848614,0.00345552,-0.112286,0.832518,-0.042134,-0.0565312,0.927506,-0.0193393,-0.0362568,0.884517,0.00345552,-0.0311882,0.862893,0.0319489,-0.0514625,0.850426,0.0575931,-0.0565312,0.852165,-0.181752,-0.350509,0.917325,-0.153259,-0.385989,0.917838,-0.113368,-0.385989,0.938075,-0.0848743,-0.345441,0.891689,-0.113368,-0.340372,0.93317,-0.153259,-0.335303,0.879278,0.0946345,-0.355578,0.916901,0.120279,-0.401195,0.867187,0.163019,-0.406264,0.894698,0.194362,-0.380921,0.861794,0.163019,-0.345441,0.935099,0.128827,-0.345441,0.892059,-0.0848743,0.110732,0.88236,-0.0506821,0.0803207,0.824538,-0.0221886,0.0600463,0.951405,0.0091542,0.065115,0.874088,0.0461956,0.0600463,0.948651,0.0803878,0.0701835,0.849917,0.11458,0.105664,0.915026,0.088936,0.156349,0.867285,0.0490451,0.186761,0.909522,0.0148529,0.196898,0.827041,-0.0221886,0.19183,0.928101,-0.0563807,0.166487,0.827108,-0.0535314,0.110732,0.788507,-0.0193393,0.105664,0.902865,0.0120035,0.110732,0.877143,0.0461956,0.105664,0.947825,0.0832372,0.105664,0.764141,0.0461956,0.105664,0.935704,0.0120035,0.115801,0.857698,-0.0193393,0.110732,0.898927,-0.133313,-0.375852,0.840569,0.140224,-0.380921,0.946143],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117029,-0.1541,0.565553,0.024029,0.761562,0.185957,-0.328308,0.79977,0.198438,-0.570285,0.886861,0.145846,-1,-1,0,0.342632,0.794304,0.0628228,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0618765,-0.252137,0.0582146,0.146556,-0.388225,0.797983,-0.285466,-0.235491,0.552897,0.336568,-0.279319,0.686155],"face_keypoints_2d":[-0.28571,-0.341662,0.774259,-0.282326,-0.227314,0.795265,-0.262027,-0.0949097,0.856715,-0.241727,0.0254574,0.805893,-0.218044,0.145824,0.835679,-0.177445,0.248137,0.861752,-0.123313,0.34443,0.877879,-0.062414,0.428687,0.811601,0.0120178,0.446742,0.897976,0.089833,0.434705,0.908319,0.154115,0.350448,0.819084,0.211631,0.260173,0.792894,0.255613,0.151843,0.893427,0.282679,0.019439,0.84027,0.306362,-0.0949097,0.884886,0.316512,-0.233332,0.839362,0.326662,-0.371754,0.75725,-0.234961,-0.443974,0.793081,-0.201128,-0.486103,0.822536,-0.150379,-0.522213,0.904594,-0.103013,-0.522213,0.884853,-0.0590308,-0.486103,0.800984,0.0593835,-0.49814,0.788636,0.106749,-0.528231,0.857802,0.154115,-0.528231,0.860402,0.204864,-0.522213,0.879861,0.248847,-0.468048,0.84242,0.00525129,-0.377772,0.879382,0.00525129,-0.287497,0.901674,0.00525129,-0.197222,0.877183,0.00525129,-0.112965,0.792027,-0.0421144,-0.0467629,0.951586,-0.0184315,-0.0407445,0.932864,0.00863457,-0.0407445,0.887004,0.0357007,-0.0407445,0.940354,0.0593835,-0.0527813,0.846398,-0.180828,-0.359717,0.890089,-0.150379,-0.383791,0.919704,-0.116546,-0.389809,0.869878,-0.0793303,-0.347681,0.843889,-0.11993,-0.335644,0.911753,-0.150379,-0.335644,0.972733,0.0932162,-0.359717,0.906791,0.120282,-0.407864,0.894892,0.164265,-0.413883,0.864758,0.198097,-0.377772,0.92272,0.167648,-0.341662,0.90009,0.123666,-0.335644,0.93128,-0.0827137,0.103696,0.871742,-0.0522642,0.0856409,0.8303,-0.0184315,0.0555491,0.927182,0.0120178,0.0555491,0.924536,0.0424672,0.0495307,0.923936,0.0864496,0.0675858,0.843808,0.116899,0.103696,0.898922,0.089833,0.151843,0.945387,0.052617,0.193971,0.889853,0.0120178,0.19999,0.95771,-0.0218149,0.193971,0.934661,-0.0556476,0.16388,0.842004,-0.048881,0.109714,0.839755,-0.0184315,0.103696,0.911903,0.0120178,0.109714,0.94409,0.0424672,0.103696,0.917409,0.0830665,0.103696,0.775248,0.0424672,0.103696,0.900414,0.0120178,0.109714,0.928181,-0.0184315,0.109714,0.918741,-0.130079,-0.377772,0.891551,0.143965,-0.383791,0.978403],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117776,-0.159323,0.562496,0.0240233,0.76157,0.183013,-0.328343,0.799757,0.19585,-0.570257,0.88689,0.142891,-1,-1,0,0.336509,0.799734,0.0597409,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.061857,-0.252146,0.057946,0.146546,-0.388248,0.800813,-0.28848,-0.235804,0.569104,0.33655,-0.279372,0.690469],"face_keypoints_2d":[-0.288719,-0.342249,0.777526,-0.28192,-0.227352,0.772594,-0.264923,-0.0943123,0.861988,-0.241126,0.0266325,0.811281,-0.21393,0.147578,0.847879,-0.179935,0.250381,0.846862,-0.125543,0.347136,0.874917,-0.0609525,0.425751,0.786671,0.0104371,0.443892,0.901412,0.0920253,0.431798,0.890771,0.153216,0.353184,0.820431,0.214408,0.256428,0.800295,0.255202,0.153625,0.896014,0.282398,0.0205853,0.844578,0.306194,-0.0943123,0.884948,0.316393,-0.233399,0.838261,0.326591,-0.372486,0.756002,-0.237727,-0.445052,0.798482,-0.200332,-0.487383,0.819117,-0.152739,-0.523667,0.89859,-0.101747,-0.517619,0.890147,-0.0575529,-0.487383,0.80827,0.0580302,-0.49343,0.799281,0.109023,-0.523667,0.864915,0.153216,-0.529714,0.863353,0.204209,-0.523667,0.878042,0.248403,-0.469241,0.840963,0.00703764,-0.378533,0.89638,0.00703764,-0.287824,0.918979,0.00703764,-0.197115,0.890404,0.00703764,-0.112454,0.796829,-0.0439549,-0.0459343,0.955977,-0.0201584,-0.0398871,0.937369,0.00703764,-0.0398871,0.891862,0.0342337,-0.0398871,0.94486,0.0614297,-0.0519816,0.856977,-0.183335,-0.360391,0.895364,-0.152739,-0.38458,0.92407,-0.115345,-0.38458,0.862729,-0.0779501,-0.348297,0.862949,-0.118744,-0.336202,0.894925,-0.152739,-0.336202,0.975583,0.0920253,-0.360391,0.906083,0.119221,-0.402722,0.889642,0.163415,-0.408769,0.868197,0.19741,-0.378533,0.924562,0.166814,-0.342249,0.904624,0.122621,-0.336202,0.926166,-0.0813495,0.105247,0.88332,-0.050754,0.0810578,0.832638,-0.0201584,0.0568688,0.939771,0.0104371,0.0568688,0.925664,0.0444322,0.0508215,0.907597,0.0852263,0.0689633,0.864873,0.115822,0.105247,0.904826,0.0886258,0.153625,0.968155,0.0546308,0.195956,0.900584,0.0104371,0.202003,0.951129,-0.0201584,0.195956,0.951218,-0.0541535,0.159672,0.854573,-0.050754,0.111294,0.853618,-0.0201584,0.105247,0.914891,0.0104371,0.105247,0.941368,0.0444322,0.105247,0.901354,0.0852263,0.105247,0.785945,0.0444322,0.105247,0.883546,0.0104371,0.111294,0.929512,-0.0201584,0.111294,0.919822,-0.128943,-0.378533,0.901321,0.143018,-0.38458,0.982826],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0147448,-0.159396,0.558548,0.0240294,0.750755,0.186058,-0.325247,0.794331,0.212822,-0.567259,0.881456,0.177786,-1,-1,0,0.342624,0.799724,0.0615323,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0618792,-0.257542,0.0590669,0.146545,-0.388268,0.80766,-0.28845,-0.235791,0.58424,0.336546,-0.279382,0.706269],"face_keypoints_2d":[-0.28869,-0.342244,0.78365,-0.281892,-0.227352,0.776662,-0.264895,-0.0943197,0.868119,-0.2411,0.0266188,0.812022,-0.213905,0.153604,0.848122,-0.179912,0.250355,0.848554,-0.125523,0.347106,0.875591,-0.0643348,0.425716,0.785601,0.0104505,0.443857,0.904202,0.0920343,0.431763,0.889667,0.153222,0.353153,0.818679,0.21441,0.256402,0.799754,0.255202,0.153604,0.894924,0.282397,0.0205719,0.844757,0.306192,-0.0943197,0.882899,0.31639,-0.233399,0.838869,0.326588,-0.372478,0.755088,-0.2377,-0.445041,0.798823,-0.203707,-0.48737,0.825741,-0.152717,-0.523651,0.901295,-0.101727,-0.517605,0.887556,-0.0609354,-0.48737,0.805749,0.0580411,-0.499464,0.794489,0.109031,-0.529698,0.863214,0.153222,-0.529698,0.859087,0.204212,-0.523651,0.879101,0.248403,-0.469229,0.840077,0.00365186,-0.378525,0.893176,0.00705123,-0.287821,0.916826,0.00705123,-0.197117,0.881412,0.00365186,-0.118507,0.796948,-0.0439388,-0.0459443,0.952314,-0.0201435,-0.0398973,0.941079,0.00705123,-0.0398973,0.893495,0.0342457,-0.0459443,0.947228,0.0614405,-0.0519912,0.855442,-0.183311,-0.360384,0.895238,-0.152717,-0.384572,0.926701,-0.115325,-0.384572,0.864124,-0.0779321,-0.348291,0.859114,-0.118724,-0.336197,0.895723,-0.152717,-0.336197,0.975725,0.0920343,-0.360384,0.908318,0.119229,-0.40876,0.891788,0.16342,-0.40876,0.867489,0.197413,-0.378525,0.922508,0.16682,-0.342244,0.90102,0.122628,-0.336197,0.926759,-0.0813314,0.105229,0.883348,-0.0507374,0.0870881,0.833393,-0.0201435,0.0568535,0.939341,0.0104505,0.0568535,0.925866,0.0444437,0.0508065,0.908307,0.0852356,0.0689473,0.863617,0.11583,0.105229,0.905177,0.088635,0.153604,0.966295,0.0546417,0.195933,0.897752,0.0104505,0.20198,0.949673,-0.0201435,0.195933,0.950834,-0.0541368,0.159651,0.855497,-0.0507374,0.111276,0.853311,-0.0201435,0.105229,0.915597,0.0104505,0.105229,0.946415,0.0410444,0.105229,0.903223,0.0818363,0.105229,0.784229,0.0410444,0.105229,0.886443,0.0104505,0.111276,0.932544,-0.0201435,0.111276,0.919163,-0.128922,-0.378525,0.899812,0.143024,-0.384572,0.981312],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0147473,-0.159429,0.55489,0.0240318,0.756177,0.180276,-0.325265,0.794332,0.213784,-0.570296,0.886946,0.162978,-1,-1,0,0.339567,0.799781,0.052292,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0648227,-0.257525,0.0568164,0.143547,-0.393618,0.809824,-0.288526,-0.241022,0.598807,0.336558,-0.279197,0.680607],"face_keypoints_2d":[-0.288711,-0.338716,0.792775,-0.285311,-0.223829,0.764079,-0.264916,-0.0968484,0.871894,-0.241122,0.0361789,0.818268,-0.213928,0.151066,0.855058,-0.179936,0.25386,0.839177,-0.125549,0.344561,0.871817,-0.0609641,0.429214,0.795835,0.0104191,0.441308,0.896391,0.0919999,0.429214,0.89469,0.153186,0.350607,0.815979,0.214371,0.25386,0.796612,0.255162,0.151066,0.894483,0.282355,0.0180389,0.840439,0.30615,-0.0968484,0.888704,0.316347,-0.235923,0.8329,0.326545,-0.36895,0.74773,-0.237723,-0.44151,0.808894,-0.203731,-0.489884,0.83927,-0.152743,-0.520118,0.894283,-0.101754,-0.520118,0.884331,-0.0609641,-0.489884,0.814034,0.058008,-0.495931,0.796674,0.105597,-0.526164,0.862098,0.149786,-0.532211,0.875295,0.200774,-0.526164,0.881248,0.248363,-0.471744,0.824635,0.00362074,-0.381043,0.881735,0.00701988,-0.290343,0.912697,0.00701988,-0.193596,0.898796,0.00362074,-0.114989,0.795764,-0.0439681,-0.0484748,0.958391,-0.0201737,-0.0424281,0.936707,0.00701988,-0.0424281,0.886622,0.0342135,-0.0424281,0.944393,0.0614071,-0.0545215,0.855209,-0.183335,-0.356857,0.894577,-0.152743,-0.38709,0.934289,-0.118751,-0.38709,0.874253,-0.0779601,-0.344763,0.862499,-0.118751,-0.338716,0.905898,-0.152743,-0.33267,0.976277,0.0919999,-0.362903,0.903077,0.119194,-0.40523,0.893197,0.163383,-0.411277,0.860981,0.197375,-0.381043,0.915504,0.166782,-0.338716,0.907084,0.122593,-0.338716,0.934421,-0.0813593,0.108739,0.875389,-0.0507665,0.0845526,0.834911,-0.0201737,0.0543191,0.938873,0.0104191,0.0543191,0.926085,0.0444111,0.0482725,0.910272,0.0852015,0.0664126,0.856097,0.115794,0.102693,0.901245,0.0886008,0.151066,0.959035,0.0546087,0.193393,0.902154,0.0104191,0.19944,0.950529,-0.0201737,0.193393,0.953894,-0.0541657,0.16316,0.849901,-0.0507665,0.108739,0.853896,-0.0201737,0.102693,0.913598,0.0104191,0.108739,0.946384,0.0410119,0.102693,0.907539,0.0818022,0.102693,0.780368,0.0410119,0.102693,0.888698,0.0104191,0.108739,0.929913,-0.0201737,0.108739,0.916977,-0.132347,-0.381043,0.889106,0.142988,-0.38709,0.978981],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117847,-0.15942,0.559906,0.0270568,0.756161,0.181359,-0.328288,0.799718,0.211964,-0.570293,0.886942,0.163988,-1,-1,0,0.35487,0.794304,0.0593094,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0648498,-0.25753,0.0567458,0.143533,-0.393624,0.811136,-0.288523,-0.235802,0.590532,0.336561,-0.279176,0.681807],"face_keypoints_2d":[-0.288761,-0.342158,0.788955,-0.285361,-0.227251,0.77275,-0.264962,-0.0942005,0.869137,-0.241164,0.032802,0.813565,-0.213966,0.153757,0.851219,-0.179968,0.25052,0.845004,-0.125571,0.347284,0.873251,-0.0609755,0.425905,0.785027,0.0104198,0.444048,0.905146,0.0920147,0.431952,0.883813,0.153211,0.347284,0.826556,0.214407,0.256568,0.802447,0.255204,0.147709,0.894999,0.282403,0.0146588,0.847018,0.306201,-0.0942005,0.875339,0.313001,-0.233298,0.8431,0.3266,-0.372396,0.751936,-0.237764,-0.444969,0.804792,-0.203766,-0.493351,0.831555,-0.15277,-0.52359,0.907554,-0.105173,-0.52359,0.887859,-0.0609755,-0.487303,0.804856,0.0580169,-0.499399,0.791809,0.109014,-0.529637,0.858469,0.153211,-0.535685,0.856914,0.204208,-0.52359,0.88316,0.248405,-0.475208,0.83841,0.00362027,-0.378444,0.892218,0.00702012,-0.287728,0.911007,0.00702012,-0.197012,0.866305,0.00362027,-0.124439,0.797699,-0.0439766,-0.0458186,0.948156,-0.0201781,-0.0397709,0.940741,0.00702012,-0.0397709,0.892031,0.0342183,-0.0458186,0.942876,0.0614166,-0.057914,0.843704,-0.183368,-0.360301,0.896302,-0.15277,-0.384492,0.919841,-0.115372,-0.39054,0.860842,-0.0779745,-0.348205,0.851122,-0.118772,-0.33611,0.896421,-0.15277,-0.33611,0.977777,0.0920147,-0.366349,0.910449,0.119213,-0.408683,0.896792,0.16341,-0.41473,0.869951,0.197408,-0.378444,0.926802,0.16681,-0.342158,0.895569,0.122613,-0.33611,0.926323,-0.0813742,0.105375,0.883852,-0.0507762,0.0811839,0.828209,-0.0201781,0.0569929,0.933596,0.0104198,0.0569929,0.930844,0.0444177,0.0509452,0.912266,0.0852151,0.0630406,0.867169,0.115813,0.105375,0.908278,0.0886149,0.153757,0.970844,0.054617,0.196091,0.895188,0.0104198,0.202139,0.951885,-0.0201781,0.196091,0.948153,-0.0541759,0.159804,0.856076,-0.0507762,0.111423,0.857553,-0.0201781,0.105375,0.924213,0.0104198,0.105375,0.95564,0.0410179,0.105375,0.910356,0.0818154,0.105375,0.784303,0.0410179,0.105375,0.897918,0.0104198,0.111423,0.940434,-0.0201781,0.105375,0.927495,-0.128971,-0.378444,0.900919,0.143011,-0.384492,0.974142],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117248,-0.159419,0.542591,0.0270865,0.739825,0.188765,-0.328339,0.799694,0.212916,-0.57031,0.892307,0.156594,-1,-1,0,0.339545,0.723537,0.103631,0.624473,0.892381,0.120655,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0648831,-0.262958,0.0585008,0.143471,-0.393785,0.821023,-0.291538,-0.241115,0.6076,0.336524,-0.279312,0.682377],"face_keypoints_2d":[-0.291721,-0.339194,0.805954,-0.28489,-0.223761,0.755812,-0.264398,-0.0961757,0.866726,-0.243906,0.0314091,0.823817,-0.213168,0.152918,0.874779,-0.179014,0.250126,0.827816,-0.127783,0.347333,0.858939,-0.0628913,0.426314,0.782974,0.0088315,0.444541,0.900411,0.0908005,0.43239,0.876542,0.152277,0.347333,0.824206,0.213754,0.256201,0.803743,0.254738,0.146843,0.895432,0.282061,0.0192581,0.843652,0.305969,-0.0961757,0.877549,0.3128,-0.235911,0.840853,0.323046,-0.369572,0.741818,-0.240491,-0.448553,0.826706,-0.206337,-0.491081,0.850481,-0.155106,-0.521458,0.893772,-0.107291,-0.521458,0.882593,-0.0628913,-0.491081,0.813412,0.0566467,-0.497157,0.800833,0.104462,-0.527534,0.860849,0.152277,-0.533609,0.869365,0.203508,-0.527534,0.878811,0.244492,-0.472855,0.820684,0.00541615,-0.381723,0.894894,0.00541615,-0.290591,0.920542,0.00541615,-0.199459,0.886742,0.00541615,-0.120478,0.798472,-0.0458145,-0.047572,0.953669,-0.0219068,-0.0414965,0.938622,0.00541615,-0.0414965,0.889329,0.0327392,-0.047572,0.943805,0.0600622,-0.0536474,0.84847,-0.182429,-0.357421,0.897137,-0.155106,-0.387798,0.930042,-0.117537,-0.387798,0.868359,-0.0799682,-0.351345,0.867636,-0.117537,-0.339194,0.894751,-0.155106,-0.333119,0.972962,0.0908005,-0.363496,0.904708,0.118123,-0.406025,0.893348,0.162523,-0.4121,0.861041,0.196677,-0.381723,0.91675,0.165939,-0.339194,0.904572,0.121539,-0.339194,0.933708,-0.0833834,0.104315,0.890149,-0.0526451,0.0800128,0.83598,-0.0219068,0.0557109,0.941029,0.0088315,0.0557109,0.929648,0.0429853,0.0496354,0.909047,0.0839697,0.0617864,0.872523,0.114708,0.104315,0.903298,0.0873851,0.152918,0.973521,0.0566467,0.195447,0.905315,0.0088315,0.201522,0.944237,-0.0219068,0.195447,0.958959,-0.0560605,0.158994,0.863185,-0.0492298,0.11039,0.865307,-0.0219068,0.104315,0.919396,0.0088315,0.104315,0.95642,0.0395699,0.104315,0.906103,0.0805542,0.104315,0.783857,0.0395699,0.104315,0.891613,0.0088315,0.11039,0.93753,-0.0219068,0.11039,0.920087,-0.131199,-0.381723,0.903805,0.142031,-0.387798,0.974746],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117451,-0.159398,0.54172,0.0301123,0.745301,0.184776,-0.3314,0.799757,0.207585,-0.570356,0.892332,0.153611,-1,-1,0,0.342623,0.745246,0.0878821,0.624429,0.892446,0.099563,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0648781,-0.26294,0.0606909,0.143474,-0.399009,0.820819,-0.291543,-0.241006,0.611095,0.336498,-0.27934,0.696075],"face_keypoints_2d":[-0.291728,-0.339152,0.805311,-0.284898,-0.223721,0.760621,-0.264406,-0.0961394,0.86825,-0.243914,0.0314418,0.821814,-0.213177,0.152948,0.871451,-0.179024,0.250153,0.830127,-0.127795,0.347358,0.860255,-0.0629045,0.426336,0.782251,0.00881636,0.444562,0.900859,0.090783,0.432412,0.87449,0.152258,0.347358,0.826383,0.213733,0.256228,0.804679,0.254716,0.146873,0.894784,0.282039,0.0192913,0.84499,0.305946,-0.0961394,0.875876,0.312776,-0.235871,0.842929,0.323022,-0.369528,0.742902,-0.240499,-0.442432,0.822312,-0.206346,-0.491034,0.84722,-0.155117,-0.521411,0.895415,-0.107303,-0.521411,0.885815,-0.0629045,-0.491034,0.81249,0.0566303,-0.497109,0.796603,0.104444,-0.527486,0.860254,0.152258,-0.533561,0.869661,0.203487,-0.527486,0.880537,0.244471,-0.472808,0.820719,0.00198579,-0.381679,0.895486,0.00540113,-0.290549,0.919358,0.00540113,-0.19942,0.882619,0.00540113,-0.120441,0.798313,-0.0458281,-0.047537,0.951648,-0.0219212,-0.0414618,0.939084,0.00540113,-0.0414618,0.890294,0.0327233,-0.047537,0.943324,0.0600455,-0.0596876,0.845109,-0.185855,-0.357377,0.89525,-0.155117,-0.387754,0.929596,-0.117549,-0.387754,0.868608,-0.0799809,-0.351302,0.866527,-0.120964,-0.339152,0.895287,-0.155117,-0.339152,0.973424,0.090783,-0.363453,0.905545,0.118105,-0.40598,0.893864,0.162504,-0.412055,0.862128,0.196657,-0.381679,0.917786,0.165919,-0.345227,0.904115,0.121521,-0.339152,0.933789,-0.0833961,0.104346,0.890465,-0.0526587,0.0800443,0.833471,-0.0219212,0.055743,0.939826,0.00881636,0.055743,0.930393,0.0429691,0.0496677,0.91051,0.0839525,0.0618184,0.874348,0.11469,0.104346,0.90754,0.0873678,0.152948,0.973624,0.0566303,0.195475,0.903459,0.00881636,0.20155,0.945392,-0.0219212,0.195475,0.958077,-0.056074,0.159023,0.862615,-0.0492434,0.110421,0.864523,-0.0219212,0.104346,0.921582,0.00881636,0.104346,0.957899,0.0395539,0.104346,0.906813,0.0805372,0.104346,0.785354,0.0395539,0.104346,0.892699,0.00881636,0.110421,0.939191,-0.0219212,0.104346,0.923097,-0.13121,-0.381679,0.904117,0.142012,-0.387754,0.97562],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.00870681,-0.159349,0.536253,0.0331807,0.745307,0.181361,-0.334461,0.805176,0.192588,-0.573336,0.892392,0.155002,-1,-1,0,0.34874,0.761601,0.0806823,0.624428,0.892442,0.0956165,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0648798,-0.262928,0.0601537,0.143446,-0.399092,0.826484,-0.291557,-0.23568,0.604538,0.336442,-0.27924,0.68564],"face_keypoints_2d":[-0.291796,-0.336447,0.814957,-0.284964,-0.221004,0.753958,-0.267886,-0.0934098,0.865927,-0.243977,0.0341848,0.81953,-0.213236,0.149627,0.871715,-0.17908,0.252918,0.832487,-0.127845,0.350133,0.853797,-0.0595324,0.423045,0.771771,0.00878024,0.447348,0.897971,0.0907556,0.42912,0.865512,0.152237,0.350133,0.837715,0.213718,0.252918,0.812969,0.254706,0.149627,0.901003,0.282031,0.015957,0.861402,0.305941,-0.0994858,0.861607,0.312772,-0.233156,0.859263,0.323019,-0.372903,0.756449,-0.237145,-0.45189,0.834301,-0.202989,-0.494421,0.821318,-0.15517,-0.524801,0.912834,-0.103936,-0.524801,0.894727,-0.0629481,-0.488346,0.804948,0.0565991,-0.500497,0.789672,0.104418,-0.530877,0.858055,0.152237,-0.536953,0.859278,0.203471,-0.524801,0.88957,0.247875,-0.476194,0.837034,0.00194907,-0.378979,0.898723,0.00536466,-0.28784,0.908491,0.00536466,-0.202777,0.853201,0.00194907,-0.123789,0.802524,-0.0458699,-0.0508783,0.940983,-0.0219604,-0.0448024,0.940168,0.00536466,-0.0387264,0.891504,0.0326898,-0.0448024,0.928728,0.0600148,-0.0569542,0.829015,-0.182495,-0.360751,0.895487,-0.15517,-0.385055,0.911337,-0.117598,-0.391131,0.857906,-0.0800262,-0.348599,0.850691,-0.121014,-0.336447,0.887964,-0.15517,-0.336447,0.974922,0.0907556,-0.366827,0.918247,0.118081,-0.415434,0.902991,0.162484,-0.415434,0.873337,0.19664,-0.378979,0.924388,0.1659,-0.342523,0.891059,0.121496,-0.342523,0.923984,-0.0834419,0.107096,0.900114,-0.0527011,0.0767163,0.82729,-0.0219604,0.0524126,0.938223,0.00878024,0.0584885,0.93664,0.0429366,0.0524126,0.906906,0.0839243,0.0645645,0.882959,0.114665,0.10102,0.911781,0.0873399,0.155704,0.971526,0.0565991,0.198235,0.891645,0.00878024,0.204311,0.942202,-0.0219604,0.198235,0.949542,-0.0561167,0.161779,0.868842,-0.0492855,0.107096,0.871008,-0.0219604,0.107096,0.936419,0.00878024,0.107096,0.962059,0.039521,0.107096,0.904768,0.0805086,0.107096,0.787632,0.039521,0.107096,0.896411,0.00878024,0.107096,0.952986,-0.0219604,0.107096,0.944385,-0.131261,-0.378979,0.915173,0.14199,-0.385055,0.969851],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0116875,-0.159398,0.548969,0.0301354,0.739809,0.189231,-0.328342,0.799752,0.204725,-0.570361,0.886997,0.181371,-1,-1,0,0.348744,0.745239,0.0897371,0.624447,0.892363,0.108576,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.135395,-0.377244,0.730942,0.143444,-0.399111,0.829521,-0.294538,-0.235659,0.599887,0.33641,-0.279229,0.688126],"face_keypoints_2d":[-0.289991,-0.353266,0.738762,-0.278577,-0.226367,0.801631,-0.267163,-0.104544,0.791838,-0.247188,0.0223558,0.824468,-0.218653,0.144179,0.77872,-0.178704,0.260927,0.822654,-0.118781,0.347218,0.845514,-0.0588571,0.423358,0.822353,0.0181874,0.448738,0.810342,0.0895249,0.423358,0.905365,0.158009,0.347218,0.897441,0.209372,0.260927,0.854087,0.252174,0.144179,0.862356,0.277856,0.0223558,0.837234,0.29783,-0.104544,0.868902,0.317805,-0.231443,0.815749,0.320658,-0.363418,0.751691,-0.230067,-0.459862,0.813558,-0.198679,-0.505546,0.841712,-0.155876,-0.515698,0.848827,-0.113074,-0.510622,0.848862,-0.0674176,-0.50047,0.838209,0.0638434,-0.510622,0.79837,0.109499,-0.541077,0.848597,0.158009,-0.546153,0.922054,0.203665,-0.520774,0.861007,0.24076,-0.470014,0.826859,0.00106645,-0.378646,0.871467,0.00106645,-0.292355,0.859531,0.00106645,-0.200987,0.842456,0.00106645,-0.114696,0.826054,-0.0445896,-0.0588599,0.951488,-0.0217616,-0.0487079,0.891275,0.00391996,-0.0436319,0.85042,0.0296013,-0.0537838,0.864722,0.0552828,-0.0639358,0.844501,-0.181558,-0.353266,0.919218,-0.155876,-0.388798,0.914867,-0.115927,-0.388798,0.93386,-0.0873921,-0.34819,0.878161,-0.115927,-0.343114,0.939018,-0.155876,-0.338038,0.877491,0.0923784,-0.358342,0.908384,0.11806,-0.409102,0.86691,0.160862,-0.409102,0.895604,0.192251,-0.383722,0.863431,0.160862,-0.34819,0.934337,0.123767,-0.34819,0.889776,-0.0845386,0.103571,0.8688,-0.0531501,0.0731155,0.829295,-0.0246152,0.0578876,0.940185,0.00962687,0.0578876,0.869075,0.0467224,0.0528116,0.931837,0.0838178,0.0680395,0.870729,0.112353,0.0984954,0.915346,0.0895249,0.149255,0.897564,0.0495759,0.184787,0.89663,0.0153339,0.200015,0.828828,-0.0246152,0.189863,0.925645,-0.0560036,0.164483,0.821803,-0.0502966,0.108647,0.814404,-0.0217616,0.103571,0.912629,0.0124804,0.103571,0.880468,0.0438689,0.103571,0.961153,0.0781109,0.103571,0.774214,0.0438689,0.103571,0.952271,0.0124804,0.113723,0.86304,-0.0217616,0.108647,0.903188,-0.135902,-0.378646,0.843813,0.138034,-0.388798,0.9488],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.00869501,-0.159336,0.555741,0.0301363,0.7344,0.192081,-0.334416,0.805189,0.197039,-0.573384,0.892384,0.166264,-1,-1,0,0.348738,0.734373,0.104388,0.624472,0.892286,0.13625,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.135394,-0.377281,0.736138,0.14346,-0.399131,0.82424,-0.294547,-0.235628,0.60238,0.336395,-0.279202,0.666468],"face_keypoints_2d":[-0.289997,-0.353267,0.737166,-0.278583,-0.226366,0.795805,-0.267169,-0.10454,0.792432,-0.247194,0.022361,0.827096,-0.218659,0.144186,0.779901,-0.178709,0.260936,0.81989,-0.118785,0.347229,0.84314,-0.0588603,0.423369,0.824257,0.0181854,0.44875,0.810514,0.0895239,0.423369,0.906826,0.158009,0.347229,0.896623,0.206519,0.260936,0.854704,0.252176,0.144186,0.864419,0.277858,0.022361,0.838509,0.297833,-0.10454,0.871027,0.314954,-0.231442,0.80999,0.320661,-0.368495,0.754136,-0.230073,-0.459864,0.812791,-0.198684,-0.505548,0.839744,-0.155881,-0.515701,0.841644,-0.110224,-0.515701,0.847375,-0.067421,-0.500472,0.837993,0.0609885,-0.510625,0.783491,0.109499,-0.541081,0.837095,0.158009,-0.546157,0.910984,0.203666,-0.520777,0.854972,0.240762,-0.470016,0.823765,0.00106406,-0.383723,0.87857,0.00106406,-0.292354,0.865616,0.00106406,-0.200985,0.843759,0.00106406,-0.114692,0.832093,-0.0445926,-0.0588558,0.955328,-0.0217642,-0.0487037,0.898537,0.00391757,-0.0436276,0.856364,0.0295995,-0.0537797,0.872644,0.0524279,-0.0639318,0.846241,-0.181563,-0.353267,0.913766,-0.155881,-0.388799,0.914281,-0.115931,-0.388799,0.932674,-0.0873957,-0.348191,0.875989,-0.115931,-0.343115,0.940837,-0.155881,-0.338039,0.882779,0.0923775,-0.358343,0.90931,0.118059,-0.409103,0.87053,0.160863,-0.41418,0.898277,0.192252,-0.383723,0.864443,0.160863,-0.348191,0.933164,0.123767,-0.348191,0.889639,-0.0845422,0.103578,0.866614,-0.0531533,0.0731215,0.82955,-0.0246178,0.0578934,0.930059,0.00962472,0.0578934,0.870099,0.0438672,0.0477413,0.916086,0.0809634,0.0629696,0.872661,0.112352,0.0985018,0.920161,0.0895239,0.149262,0.899657,0.0495744,0.184795,0.899613,0.0153319,0.200023,0.829044,-0.0246178,0.189871,0.931872,-0.0560068,0.164491,0.820012,-0.0502996,0.108654,0.810983,-0.0217642,0.103578,0.927288,0.0124784,0.103578,0.887957,0.0438672,0.0985018,0.963065,0.0781099,0.103578,0.770257,0.0438672,0.103578,0.952169,0.0124784,0.11373,0.855995,-0.0217642,0.108654,0.891628,-0.135906,-0.378647,0.847155,0.138034,-0.388799,0.947138],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117124,-0.15941,0.554023,0.0332116,0.734424,0.193461,-0.328344,0.79975,0.20887,-0.573417,0.892373,0.171545,-1,-1,0,0.348728,0.73441,0.100572,0.62447,0.892336,0.129776,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.135401,-0.377286,0.730143,0.143468,-0.399156,0.825391,-0.294539,-0.235658,0.608636,0.336423,-0.279399,0.677162],"face_keypoints_2d":[-0.290002,-0.353332,0.739432,-0.278587,-0.226425,0.796052,-0.267172,-0.104595,0.79032,-0.247196,0.0223124,0.824168,-0.21866,0.144143,0.777666,-0.178708,0.260898,0.817175,-0.118781,0.347194,0.84159,-0.0588541,0.423339,0.824937,0.018195,0.44872,0.810704,0.0895369,0.423339,0.904857,0.158025,0.347194,0.891099,0.206537,0.260898,0.852893,0.252196,0.144143,0.861003,0.277879,0.0223124,0.837835,0.297855,-0.104595,0.870874,0.314977,-0.231502,0.80954,0.317831,-0.368561,0.754758,-0.230074,-0.459934,0.814197,-0.198684,-0.505621,0.837734,-0.155879,-0.515773,0.830951,-0.11022,-0.515773,0.841001,-0.0645614,-0.500545,0.824819,0.0581465,-0.510697,0.781183,0.106659,-0.541155,0.831713,0.158025,-0.546231,0.907692,0.203684,-0.52085,0.856053,0.240781,-0.470087,0.824326,0.00107312,-0.38379,0.885055,0.00107312,-0.297493,0.87503,0.00107312,-0.20612,0.84524,0.00107312,-0.119823,0.834191,-0.0445857,-0.0589081,0.961537,-0.0217564,-0.0487555,0.902644,0.00392663,-0.0436792,0.860078,0.0296098,-0.0538318,0.877461,0.0552928,-0.0639843,0.853857,-0.184416,-0.353332,0.916332,-0.155879,-0.388866,0.918263,-0.115927,-0.388866,0.933003,-0.0873908,-0.348256,0.88199,-0.115927,-0.34318,0.936607,-0.155879,-0.338104,0.88361,0.0923905,-0.358409,0.912112,0.118074,-0.409172,0.871386,0.160879,-0.414248,0.898011,0.192269,-0.38379,0.863512,0.160879,-0.348256,0.933091,0.123781,-0.348256,0.889939,-0.0845371,0.103533,0.877391,-0.050293,0.067999,0.840776,-0.0217564,0.0527701,0.918465,0.00963402,0.0578464,0.873538,0.0438782,0.0476938,0.909562,0.0781221,0.0629227,0.873209,0.112366,0.0984567,0.926786,0.0895369,0.14922,0.886598,0.0495855,0.184753,0.903247,0.0153414,0.199982,0.830358,-0.02461,0.18983,0.932462,-0.0560004,0.164448,0.818771,-0.050293,0.108609,0.803859,-0.0217564,0.103533,0.933472,0.0124878,0.103533,0.896776,0.0438782,0.0984567,0.96261,0.0838296,0.103533,0.769044,0.0438782,0.103533,0.948759,0.0124878,0.113685,0.845489,-0.0217564,0.108609,0.882348,-0.135903,-0.378714,0.845454,0.138049,-0.388866,0.944518],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.00866783,-0.154056,0.564123,0.033215,0.734425,0.192772,-0.328291,0.799728,0.2112,-0.573419,0.892336,0.173786,-1,-1,0,0.354853,0.750717,0.0921132,0.624456,0.892364,0.111296,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0649175,-0.262939,0.0598656,0.143474,-0.404451,0.827955,-0.294551,-0.235681,0.607254,0.336427,-0.284661,0.681398],"face_keypoints_2d":[-0.294851,-0.339548,0.819837,-0.284553,-0.211324,0.741873,-0.267391,-0.0892053,0.858365,-0.243363,0.0390191,0.840156,-0.215904,0.155032,0.901183,-0.174714,0.252726,0.81792,-0.126659,0.350421,0.840304,-0.058009,0.423692,0.786084,0.010641,0.448116,0.885778,0.0895882,0.417586,0.862628,0.154806,0.350421,0.834094,0.213158,0.252726,0.822748,0.250915,0.148926,0.899032,0.281808,0.0145953,0.86262,0.302403,-0.101417,0.854124,0.3127,-0.235747,0.862191,0.322998,-0.376184,0.747926,-0.239931,-0.443349,0.805277,-0.198741,-0.492196,0.818556,-0.157551,-0.528831,0.904205,-0.106064,-0.522726,0.907907,-0.0614414,-0.492196,0.817369,0.0552633,-0.498302,0.796236,0.103318,-0.534937,0.85997,0.151373,-0.541043,0.863411,0.199428,-0.528831,0.887904,0.24405,-0.473878,0.818631,0.00377584,-0.382289,0.91155,0.00377584,-0.290701,0.917341,0.00377584,-0.205218,0.863425,0.00377584,-0.125841,0.805035,-0.0477114,-0.0525697,0.935596,-0.0202515,-0.0464638,0.943111,0.00377584,-0.0403579,0.889551,0.0312358,-0.0464638,0.930277,0.0586958,-0.0647816,0.821701,-0.185011,-0.363972,0.889194,-0.157551,-0.388395,0.911064,-0.116361,-0.388395,0.865514,-0.0820364,-0.35176,0.870498,-0.119794,-0.339548,0.895775,-0.157551,-0.339548,0.973483,0.0895882,-0.370078,0.909698,0.117048,-0.412819,0.896799,0.161671,-0.418925,0.873565,0.195995,-0.382289,0.926367,0.165103,-0.345654,0.895237,0.120481,-0.345654,0.922518,-0.0820364,0.106184,0.914958,-0.0545765,0.0695486,0.829929,-0.023684,0.0512308,0.942362,0.00720835,0.0512308,0.935725,0.0415334,0.0512308,0.881796,0.0827233,0.0573368,0.904117,0.113616,0.100078,0.903166,0.0861557,0.155032,0.979469,0.0552633,0.197773,0.922122,0.010641,0.203879,0.925474,-0.023684,0.197773,0.970044,-0.0545765,0.161137,0.885939,-0.0511439,0.106184,0.877489,-0.0202515,0.100078,0.939072,0.00720835,0.100078,0.937588,0.0415334,0.100078,0.883832,0.0792907,0.100078,0.802251,0.0415334,0.106184,0.873378,0.00720835,0.106184,0.914091,-0.0202515,0.106184,0.928544,-0.133524,-0.382289,0.927011,0.141076,-0.388395,0.972591],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.00863647,-0.159336,0.54703,0.0301484,0.728998,0.191995,-0.33135,0.805153,0.205306,-0.573444,0.892377,0.17066,-1,-1,0,0.351795,0.745286,0.0964189,0.624486,0.892323,0.113824,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0648434,-0.257466,0.064619,0.14345,-0.404428,0.821475,-0.294561,-0.235645,0.605005,0.336413,-0.284572,0.681881],"face_keypoints_2d":[-0.29486,-0.339485,0.818535,-0.284563,-0.211262,0.740267,-0.267401,-0.0891446,0.858345,-0.243374,0.0390786,0.835619,-0.215914,0.15509,0.899537,-0.174724,0.252784,0.818437,-0.12667,0.350478,0.843474,-0.0580206,0.417643,0.786633,0.0106286,0.442066,0.889268,0.0895753,0.417643,0.864758,0.154792,0.350478,0.834035,0.213144,0.252784,0.822605,0.250901,0.148984,0.897213,0.281793,0.0146552,0.863891,0.302388,-0.101356,0.851377,0.312685,-0.235685,0.864915,0.31955,-0.37612,0.748762,-0.239941,-0.437179,0.816967,-0.202184,-0.492132,0.816252,-0.157562,-0.528767,0.912471,-0.106075,-0.528767,0.910023,-0.0614531,-0.492132,0.811492,0.0552508,-0.504344,0.799228,0.103305,-0.534873,0.859892,0.15136,-0.540979,0.860176,0.202847,-0.528767,0.884825,0.244036,-0.473814,0.82047,0.00376379,-0.382226,0.910377,0.00376379,-0.290638,0.907554,0.00376379,-0.205156,0.851588,0.00376379,-0.131886,0.819115,-0.0477232,-0.0525093,0.925597,-0.0202635,-0.0464035,0.940461,0.00376379,-0.0464035,0.892516,0.0312235,-0.0464035,0.92351,0.0586832,-0.070827,0.820417,-0.185022,-0.363909,0.887531,-0.157562,-0.388332,0.906882,-0.116372,-0.394438,0.859713,-0.0820478,-0.351697,0.864409,-0.119805,-0.339485,0.892214,-0.157562,-0.339485,0.972582,0.0895753,-0.370015,0.913706,0.117035,-0.412756,0.897867,0.161657,-0.418862,0.875571,0.195982,-0.382226,0.925057,0.165089,-0.345591,0.896775,0.120467,-0.345591,0.923893,-0.0820478,0.106243,0.915722,-0.0545881,0.069608,0.832916,-0.0236959,0.0512904,0.938791,0.00719631,0.0512904,0.93568,0.0415208,0.0512904,0.877053,0.0827104,0.0573963,0.907071,0.113603,0.100137,0.907431,0.0861428,0.15509,0.978292,0.0552508,0.197831,0.917666,0.0106286,0.203937,0.923675,-0.0236959,0.197831,0.964135,-0.0545881,0.15509,0.887364,-0.0511556,0.106243,0.879811,-0.0202635,0.100137,0.934659,0.00719631,0.100137,0.933922,0.0415208,0.100137,0.876793,0.0827104,0.100137,0.807877,0.0415208,0.106243,0.876577,0.00719631,0.106243,0.916561,-0.0202635,0.106243,0.933347,-0.133535,-0.382226,0.924501,0.141062,-0.388332,0.972195],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0116782,-0.159435,0.557435,0.0301175,0.728988,0.200442,-0.328278,0.799769,0.214901,-0.573398,0.892295,0.182326,-1,-1,0,0.345685,0.745259,0.0944257,0.624482,0.892346,0.107959,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0648459,-0.257526,0.0666271,0.140542,-0.404502,0.837717,-0.29457,-0.235671,0.61227,0.336384,-0.284606,0.670704],"face_keypoints_2d":[-0.294869,-0.339512,0.819158,-0.284572,-0.211293,0.74187,-0.267411,-0.0891796,0.85974,-0.243384,0.0390395,0.835574,-0.215925,0.155047,0.898844,-0.174737,0.252738,0.817824,-0.126684,0.350429,0.842881,-0.058037,0.417591,0.785888,0.01061,0.442014,0.889535,0.0895541,0.417591,0.864361,0.154769,0.350429,0.834219,0.213119,0.252738,0.823868,0.250875,0.148942,0.894591,0.281766,0.0146167,0.867844,0.30236,-0.101391,0.84903,0.309225,-0.235716,0.870046,0.319522,-0.376146,0.753792,-0.236519,-0.443309,0.790598,-0.198763,-0.49826,0.81212,-0.157575,-0.528788,0.912151,-0.10609,-0.528788,0.914553,-0.0649018,-0.492154,0.809759,0.0552306,-0.504365,0.798183,0.103284,-0.534894,0.860093,0.151336,-0.540999,0.859276,0.202822,-0.528788,0.891954,0.24401,-0.479943,0.83054,0.0037452,-0.388358,0.913906,0.0037452,-0.296772,0.897681,0.0037452,-0.217399,0.852468,0.0037452,-0.138025,0.847689,-0.04774,-0.0586513,0.925224,-0.0202811,-0.0464399,0.944794,0.0037452,-0.0464399,0.908499,0.0312041,-0.0464399,0.928588,0.058663,-0.0708626,0.833524,-0.185034,-0.363935,0.886596,-0.157575,-0.394463,0.900059,-0.116387,-0.394463,0.856948,-0.0820635,-0.351724,0.864743,-0.119819,-0.339512,0.891461,-0.157575,-0.339512,0.973541,0.0895541,-0.370041,0.917674,0.117013,-0.418886,0.907603,0.161633,-0.424992,0.87855,0.195957,-0.382252,0.930767,0.165066,-0.345618,0.892859,0.120445,-0.345618,0.924262,-0.0820635,0.106202,0.923323,-0.0511724,0.0634623,0.84802,-0.0237135,0.0512508,0.937113,0.00717759,0.0512508,0.939658,0.0415012,0.0451452,0.876569,0.0826894,0.0573565,0.911965,0.113581,0.100096,0.918015,0.0861217,0.155047,0.975465,0.0552306,0.197787,0.912034,0.01061,0.197787,0.923989,-0.0237135,0.197787,0.965405,-0.0546046,0.155047,0.89143,-0.0511724,0.106202,0.886463,-0.0202811,0.100096,0.929108,0.00717759,0.100096,0.930823,0.0415012,0.100096,0.868586,0.0826894,0.100096,0.81945,0.0415012,0.106202,0.882269,0.00717759,0.106202,0.918725,-0.0202811,0.106202,0.938696,-0.133549,-0.382252,0.92922,0.141039,-0.388358,0.964176],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.00871611,-0.159441,0.557763,0.0301254,0.728979,0.198492,-0.32832,0.799799,0.212705,-0.573387,0.892412,0.163819,-1,-1,0,0.345681,0.745268,0.0920307,0.624488,0.892346,0.107222,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0648516,-0.257528,0.0656352,0.140536,-0.404536,0.836988,-0.294579,-0.235666,0.61752,0.333526,-0.279383,0.660473],"face_keypoints_2d":[-0.294819,-0.336525,0.81637,-0.28457,-0.214986,0.742784,-0.267489,-0.087369,0.856998,-0.243576,0.0402477,0.832771,-0.216246,0.15571,0.899197,-0.175251,0.252942,0.818715,-0.127424,0.350174,0.837402,-0.0556833,0.417021,0.793987,0.00922501,0.441329,0.870662,0.0877981,0.417021,0.84926,0.156123,0.350174,0.829774,0.214198,0.252942,0.827182,0.251777,0.149633,0.888219,0.279107,0.0159398,0.872994,0.30302,-0.0995229,0.852056,0.309853,-0.239294,0.861004,0.323518,-0.379064,0.768711,-0.236743,-0.445911,0.77518,-0.199165,-0.500604,0.808782,-0.15817,-0.524912,0.909748,-0.106927,-0.524912,0.923023,-0.0625159,-0.494527,0.803472,0.0536358,-0.506681,0.80981,0.104879,-0.530989,0.858112,0.152707,-0.543143,0.83834,0.200534,-0.530989,0.881009,0.244944,-0.476296,0.858036,0.00239241,-0.385141,0.92433,0.00239241,-0.293986,0.888725,0.00239241,-0.221063,0.866968,0.00239241,-0.135985,0.867788,-0.0488509,-0.0569841,0.913974,-0.0215211,-0.0448301,0.946539,0.00580871,-0.0448301,0.919996,0.0297223,-0.050907,0.921459,0.0570521,-0.075215,0.850054,-0.1855,-0.372987,0.903573,-0.15817,-0.397295,0.877986,-0.113759,-0.397295,0.834416,-0.0830131,-0.360833,0.861926,-0.117175,-0.336525,0.87386,-0.15817,-0.336525,0.970198,0.0877981,-0.372987,0.932726,0.115128,-0.421603,0.920045,0.162955,-0.421603,0.903444,0.193701,-0.385141,0.933146,0.166371,-0.348679,0.879943,0.118544,-0.342602,0.895273,-0.0795969,0.107095,0.932468,-0.0522671,0.0645556,0.866817,-0.0215211,0.0524017,0.932324,0.00580871,0.0524017,0.9346,0.0433872,0.0463247,0.858534,0.0809656,0.0584787,0.937416,0.111712,0.101017,0.920772,0.0843819,0.15571,0.984758,0.0536358,0.198249,0.926568,0.00922501,0.198249,0.918193,-0.0249373,0.198249,0.971006,-0.0556833,0.15571,0.902127,-0.0522671,0.107095,0.892673,-0.0215211,0.101017,0.913297,0.00922501,0.101017,0.913825,0.0433872,0.0949405,0.851097,0.0843819,0.101017,0.839299,0.0433872,0.107095,0.878367,0.00922501,0.107095,0.913127,-0.0215211,0.107095,0.938845,-0.134257,-0.379064,0.930343,0.139042,-0.385141,0.957524],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117141,-0.16476,0.57055,0.0332104,0.728932,0.20049,-0.322157,0.794307,0.217542,-0.573355,0.892419,0.180222,-1,-1,0,0.345684,0.756186,0.0826503,0.624473,0.89238,0.103197,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0648484,-0.262972,0.0616908,0.14055,-0.404606,0.846346,-0.294581,-0.235688,0.616003,0.333503,-0.279276,0.651122],"face_keypoints_2d":[-0.29482,-0.33648,0.816929,-0.284571,-0.214945,0.741252,-0.267491,-0.0873331,0.8558,-0.243578,0.0402787,0.833741,-0.216249,0.155737,0.900263,-0.175256,0.252965,0.817187,-0.127431,0.350193,0.832154,-0.055693,0.417037,0.797376,0.00921273,0.441344,0.865147,0.0877829,0.417037,0.846665,0.156105,0.350193,0.826058,0.214178,0.252965,0.825962,0.251755,0.14966,0.884341,0.279084,0.00989497,0.875267,0.302997,-0.0994866,0.847801,0.309829,-0.239252,0.864982,0.323493,-0.379017,0.771437,-0.236746,-0.451938,0.766753,-0.195753,-0.506629,0.811381,-0.158176,-0.524859,0.908972,-0.106934,-0.524859,0.925218,-0.0625252,-0.494475,0.798446,0.053622,-0.512706,0.815801,0.104863,-0.530936,0.850494,0.152689,-0.543089,0.834546,0.200514,-0.530936,0.884357,0.244923,-0.476245,0.860336,0.00238049,-0.385094,0.923999,0.00238049,-0.300019,0.881403,0.00238049,-0.221022,0.878756,0.00238049,-0.135947,0.887403,-0.0488608,-0.0630261,0.911946,-0.0215321,-0.0508726,0.944628,0.00579667,-0.0447958,0.928001,0.0297093,-0.0508726,0.916213,0.0570381,-0.0751796,0.858958,-0.185505,-0.37294,0.907572,-0.158176,-0.397247,0.872173,-0.113767,-0.397247,0.827247,-0.0830218,-0.360787,0.862903,-0.117183,-0.33648,0.869354,-0.158176,-0.33648,0.966722,0.0877829,-0.37294,0.936246,0.115112,-0.421554,0.92853,0.162937,-0.421554,0.90566,0.193682,-0.385094,0.932658,0.162937,-0.348633,0.875271,0.118528,-0.348633,0.888442,-0.0796057,0.107123,0.934676,-0.0522769,0.0645857,0.88185,-0.0215321,0.0463554,0.925417,0.00579667,0.0524322,0.933103,0.0399575,0.0402787,0.851728,0.0809506,0.058509,0.941164,0.111696,0.101046,0.925014,0.0843668,0.155737,0.983529,0.053622,0.198274,0.922203,0.00921273,0.198274,0.916081,-0.0215321,0.198274,0.97083,-0.055693,0.155737,0.905831,-0.0522769,0.107123,0.893981,-0.0215321,0.101046,0.905818,0.00921273,0.101046,0.907414,0.0433736,0.0949694,0.842593,0.0843668,0.101046,0.850765,0.0433736,0.107123,0.884079,0.00921273,0.107123,0.920098,-0.0215321,0.107123,0.942395,-0.134263,-0.385094,0.931633,0.139024,-0.385094,0.950236],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0117111,-0.164779,0.569396,0.0362418,0.7289,0.20434,-0.319133,0.794275,0.216259,-0.570351,0.892338,0.179137,-1,-1,0,0.345663,0.756158,0.0838569,0.624468,0.892339,0.110151,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0648487,-0.262944,0.0630871,0.140539,-0.404596,0.850536,-0.294569,-0.235668,0.623264,0.333502,-0.279297,0.646345],"face_keypoints_2d":[-0.294808,-0.336479,0.817693,-0.28456,-0.214946,0.741247,-0.26748,-0.0873367,0.855486,-0.243568,0.0402727,0.833165,-0.21624,0.155729,0.899458,-0.175247,0.252955,0.817417,-0.127423,0.350181,0.832283,-0.0556862,0.417024,0.797201,0.00921834,0.441331,0.864472,0.087787,0.417024,0.845908,0.156108,0.350181,0.825504,0.21418,0.252955,0.827447,0.251757,0.149652,0.880559,0.279085,0.00988948,0.879508,0.302997,-0.09949,0.841594,0.309829,-0.239253,0.86523,0.320077,-0.379015,0.770194,-0.236736,-0.451935,0.776126,-0.19916,-0.506625,0.812106,-0.158167,-0.524855,0.915253,-0.106927,-0.524855,0.923501,-0.0659343,-0.494472,0.798325,0.0536268,-0.512701,0.818451,0.104867,-0.530931,0.853361,0.152692,-0.543085,0.834978,0.200516,-0.530931,0.880043,0.244925,-0.476242,0.858057,0.00238633,-0.385092,0.924326,0.00238633,-0.300019,0.879008,0.00238633,-0.221023,0.881186,0.00238633,-0.13595,0.889588,-0.0488542,-0.0630301,0.911565,-0.0215259,-0.0508769,0.943902,0.00580227,-0.0448002,0.927911,0.0297146,-0.0508769,0.9155,0.0570428,-0.0812601,0.859919,-0.185495,-0.372939,0.907416,-0.158167,-0.397245,0.872692,-0.113759,-0.397245,0.826745,-0.0830145,-0.360785,0.863648,-0.117175,-0.336479,0.868603,-0.158167,-0.336479,0.966466,0.087787,-0.372939,0.9413,0.115115,-0.421552,0.930385,0.16294,-0.421552,0.906825,0.193684,-0.385092,0.933073,0.16294,-0.354709,0.87455,0.118531,-0.348632,0.887127,-0.0795984,0.107116,0.935879,-0.0522702,0.0585026,0.888457,-0.0215259,0.0463494,0.923183,0.00580227,0.052426,0.932297,0.0399626,0.0402727,0.851637,0.080955,0.0585026,0.941675,0.111699,0.101039,0.925834,0.084371,0.155729,0.984954,0.0536268,0.198265,0.921748,0.00921834,0.198265,0.917971,-0.0249419,0.198265,0.970803,-0.0556862,0.155729,0.907254,-0.0522702,0.107116,0.894903,-0.0215259,0.101039,0.904448,0.00580227,0.0949625,0.907358,0.0433787,0.0949625,0.840862,0.084371,0.101039,0.853317,0.0433787,0.107116,0.884165,0.00921834,0.107116,0.921091,-0.0215259,0.107116,0.944122,-0.134255,-0.385092,0.930046,0.139027,-0.385092,0.949132],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
|
@ -1 +0,0 @@
|
|||
{"version":1.2,"people":[{"pose_keypoints_2d":[0.0116868,-0.164908,0.586448,0.0332016,0.728969,0.203203,-0.316061,0.794255,0.218877,-0.570274,0.892286,0.187661,-1,-1,0,0.345665,0.772487,0.0738209,0.627471,0.892385,0.104794,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,-0.0648336,-0.268406,0.0610056,0.140539,-0.404674,0.851316,-0.294604,-0.235782,0.623174,0.333512,-0.279364,0.644229],"face_keypoints_2d":[-0.294842,-0.336575,0.814881,-0.284594,-0.215034,0.739707,-0.267512,-0.0874154,0.855149,-0.243599,0.0402029,0.834777,-0.216268,0.155667,0.906276,-0.171857,0.2529,0.820259,-0.124029,0.350133,0.834605,-0.0557038,0.416981,0.800795,0.00920534,0.441289,0.870076,0.0877794,0.410903,0.856822,0.156105,0.344056,0.830082,0.214181,0.2529,0.831996,0.25176,0.14959,0.876149,0.27909,0.0098176,0.88859,0.303004,-0.105647,0.832733,0.309837,-0.239342,0.855895,0.320086,-0.379114,0.771788,-0.236766,-0.458116,0.772022,-0.199187,-0.506732,0.812594,-0.158192,-0.524964,0.910835,-0.106948,-0.524964,0.923943,-0.0659526,-0.500655,0.794196,0.0570331,-0.518887,0.822149,0.104861,-0.531041,0.84047,0.152688,-0.549272,0.828747,0.200516,-0.531041,0.884723,0.244928,-0.476347,0.861162,0.00237274,-0.385191,0.922706,0.00237274,-0.300112,0.880781,0.00237274,-0.221111,0.86656,0.00237274,-0.136032,0.858976,-0.0488712,-0.0691842,0.90449,-0.0215411,-0.050953,0.933358,0.00578892,-0.0448759,0.905565,0.0297028,-0.050953,0.90044,0.0570331,-0.0813383,0.855136,-0.185522,-0.373037,0.914364,-0.158192,-0.403422,0.86977,-0.117197,-0.403422,0.821492,-0.0830339,-0.36696,0.871555,-0.117197,-0.342652,0.857389,-0.158192,-0.336575,0.9585,0.0877794,-0.373037,0.953088,0.11511,-0.421654,0.938075,0.159521,-0.427731,0.906177,0.193684,-0.385191,0.92714,0.162937,-0.354806,0.866886,0.118526,-0.348729,0.878385,-0.0796177,0.107051,0.927687,-0.0522875,0.058434,0.872755,-0.0249574,0.0462799,0.921502,0.00578892,0.052357,0.917707,0.0433679,0.0402029,0.838155,0.0843631,0.058434,0.949168,0.111693,0.100973,0.902757,0.0877794,0.155667,0.971034,0.0570331,0.198206,0.924481,0.00920534,0.198206,0.910231,-0.0249574,0.198206,0.956916,-0.0557038,0.155667,0.910587,-0.0522875,0.107051,0.888919,-0.0215411,0.0948963,0.890735,0.00578892,0.0948963,0.898396,0.0433679,0.0888193,0.829201,0.0843631,0.100973,0.822429,0.0433679,0.107051,0.884649,0.00920534,0.107051,0.938909,-0.0215411,0.107051,0.950321,-0.134278,-0.385191,0.929271,0.139023,-0.391268,0.939987],"hand_left_keypoints_2d":[],"hand_right_keypoints_2d":[],"pose_keypoints_3d":[],"face_keypoints_3d":[],"hand_left_keypoints_3d":[],"hand_right_keypoints_3d":[]}]}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue