Sure, here you go:
I tried making a graphical thing showing feedback to cellphone/tablet
sensors using something like sensorUDP[1] or SensorStream IMU+GPS [2],
starting out from the GL2Demo from the "Graph Utilities" Lab. I thought it
might be a nice showcase for J: signal processing, networking, fancy
graphics all running on the tablet/phone.
Using the script below should be a matter of sending udp packets to the IP
of the PC J runs on at port 5555.
Somewhere in gl2demo_g_paint it goes wrong, the issue is shown in an error,
and that error keeps repeating when closed.
I hope this is specific enough.

Kind regards,

Jan-Pieter

[1]:
https://play.google.com/store/apps/details?id=jp.ac.ehime_u.cite.sasaki.SensorUdp&hl=en
[2]:
https://play.google.com/store/apps/details?id=de.lorenz_fenster.sensorstreamgps&hl=en

The script:

NB. Listen to UDP stream (phone IMU eg.)

load'socket'

load'graph'


(;:'jsocket jdefs z') copath 'base'


sk =: 0 pick sdcheck sdsocket AF_INET_jdefs_,SOCK_DGRAM_jdefs_,0

sdcheck sdbind sk;AF_INET;'';5555


GL2DEMO=: 0 : 0

pc gl2demo closeok;

minwh 200 200;

cc g isigraph;

pas 0 0;

)


gl2demo_run=: 3 : 0

wd GL2DEMO

wd'pshow'

)


gl2demo_g_paint=: 3 : 0

if. sk e. 2 pick sdselect '' do.

it =: 1 pick sdcheck sdrecvfrom (sk ; 1000 ; 0)

NB. IMU+GPS stream format:

NB. timestamp, 4-tuples: id x y z

r=: _4 ]\ }. ". ;. _2 it,','

G=: }. (3 = {."1 r) # r

else.

G=: 5 5 5

end.


wh=. glqwh_jgl2_'' NB. window width x height

NB. X

glrgb_jgl2_ 255 0 0

glrect_jgl2_ (wh,wh) * 300 300 400 400 % 1000

smoutput G

NB. glbrush_jgl2_''

NB. glrect_jgl2_ (wh,wh) * (100 200 ,( 100 + 10* 0 { G), 200 ) % 1000

NB. NB. Y

NB. glrgb_jgl2_ 0 255 0

NB. glbrush_jgl2_''

NB. glrect_jgl2_ (wh,wh) * (300 400 , (100 + 10* 1 { G),400) % 1000

NB. NB. Z

NB. glrgb_jgl2_ 0 0 255

NB. glbrush_jgl2_''

NB. glrect_jgl2_ (wh,wh) * (500 500 , ( 100 + 10* 2 { G), 500) % 1000

)


NB. gl2demo_run'' NB. commented out for safety ;)


2014-11-05 22:10 GMT+01:00 chris burke <[email protected]>:

> Please send us a concrete example of this when you can, thanks.
>
> * Repeating error messages when playing around with WD: sometimes, error
> popups will just come back when closed or clicked "ok" with J not
> responding to "break" either. I know I'm probably doing things wrong, but
> it would be nice if beginners wouldn't have to restart J because of an
> error they made writing a GUI. (I'm currently not at my home computer for
> giving a concrete example).
>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to