abhishekvp / cesium-lg

Liquid Galaxy GSoC 2016 Project: Enabling Cesium for Liquid Galaxy
5 stars 3 forks source link

node server.js: add receiving Google Earth UDP viewsync packets for camera pose #6

Closed alfski closed 8 years ago

alfski commented 8 years ago

Add UDP packet listening and sending to the nodejs relay service, so it can send & respond to Google Earth viewsync UDP packets.

And translate between Cesium ViewSync and Earth ViewSync formats. In the first instance, I'd like to try using a Google Earth master to control Cesium slaves and get a better idea how responsive the slaves are.

alfski commented 8 years ago

Info on UDP viewsync packet format is at the bottom of https://github.com/LiquidGalaxy/liquid-galaxy/wiki/GoogleEarth_ViewSync

It's a simple comma separated string.

counter, latitude, longitude, altitude, heading, tilt, roll, time start, time end, planet name ("sky", "mars", "moon", empty "" is Earth)

eg. 5090,-33.54948434838393,150.99967479537557,523818.98127554677194,-0.28372808067457, 0.00000000000000,0.00000000000000,63454496156,63454496156,

alfski commented 8 years ago

It's pretty straight forward to make node listen for UDP packets. See http://www.hacksparrow.com/node-js-udp-server-and-client-example.html I just quickly got viewsync arriving in node from Google Earth -

127.0.0.1:53654 - 132,-28.94928556203039,133.23963914180322,11001293.21927279978991,0.52104470487629,0.00000000000000,0.00000000000000,-31574016,-31574016,

alfski commented 8 years ago

Start with simply receiving and repackaging the camera pose from the viewsync UDP packets. You will need to set another JSON msg_type, since the cam position will be in lat,lon,alt rather than Cesium's internal camera position values. The websocket relay should send messages to all the websocket clients including the Master. So after you have the Cesium Slaves tracking add a websocket onMessage handler in the Cesium Master so it also tracks with the Google Earth Master.

alfski commented 8 years ago

Will test and then hopefully close this issue tomorrow.