AR-Camera
Moderator: Moderators
Re: AR-Camera
Its coming home, its coming home...
Now for a nice little data transfer via Wifi- UDP and then a nice little eternity of optimization.
PS: Yes, i know for Cardboard AR- you need two times the background drawn, for each eye a rendering of the spring-map from a slightly different camera angle
Kloot is going to hate these indecent recent advances so much.
Well, we dug up the road anyway, might (h)aswell bury some new bad legacy behavior into those good foundations of tomorrow.
Now for a nice little data transfer via Wifi- UDP and then a nice little eternity of optimization.
PS: Yes, i know for Cardboard AR- you need two times the background drawn, for each eye a rendering of the spring-map from a slightly different camera angle
Kloot is going to hate these indecent recent advances so much.
Well, we dug up the road anyway, might (h)aswell bury some new bad legacy behavior into those good foundations of tomorrow.
- Attachments
-
- AR_Lines on the shirt.png
- (341.47 KiB) Not downloaded yet
Re: AR-Camera
Is the cat to scale? :D Anyway man, I have no idea about the technical stuff your talking about but holy shit this is amazing work, keep it up!
Re: AR-Camera
Imagine if you had a head mounted laser projector- you could paint the image from your head to - wherever.
Re: AR-Camera
This is what Hololens should do. You look through your glasses and there is your spring.
Re: AR-Camera
The flaw in hololens and the likes is the denial of the limitations of the device.
You can not compute much, because the battery will die if you do.
You can not send much because your devices battery will die if you do.
You can not recive much because your devices battery will die if you do.
The emperor is naked and dancing in the street, and everybody else is jamming to this beat.
Cause we all want to be, nudists and free - in a future city.
If you would accept it for the obsidian brick it is, you could use it as a door stopper. But hey, we want the future so bad, we go into collective denial.
If we used alcohol fuel cells, we could all now raise our cellphones to that- and drink from the worlds most fanciest pocket bottle.
The best solution would be to have nearby computation, as in nearby enough to not produce framerate issues - and turn all those phones into passive wifi devices.
https://passivewifi.cs.washington.edu/f ... e_wifi.pdf
https://www.feld.com/archives/2018/07/t ... -here.html
So here we are..
You can not compute much, because the battery will die if you do.
You can not send much because your devices battery will die if you do.
You can not recive much because your devices battery will die if you do.
The emperor is naked and dancing in the street, and everybody else is jamming to this beat.
Cause we all want to be, nudists and free - in a future city.
If you would accept it for the obsidian brick it is, you could use it as a door stopper. But hey, we want the future so bad, we go into collective denial.
If we used alcohol fuel cells, we could all now raise our cellphones to that- and drink from the worlds most fanciest pocket bottle.
The best solution would be to have nearby computation, as in nearby enough to not produce framerate issues - and turn all those phones into passive wifi devices.
https://passivewifi.cs.washington.edu/f ... e_wifi.pdf
https://www.feld.com/archives/2018/07/t ... -here.html
So here we are..
Re: AR-Camera
Juno the 28, Year of the Ford 2018
Okay, maybe one of you forum dwellers can help me on this.
I can recive UDP-Broadcasts now, in Dynamic Mode as well as in Static IP Mode.
But i can recive a reply only if i configure my machine to have a static IP. It seems that my packets do not get routed. Is there a way around this?
Feel free to take a look:
https://github.com/PicassoCT/Journeywar ... _arCam.lua
Okay, maybe one of you forum dwellers can help me on this.
I can recive UDP-Broadcasts now, in Dynamic Mode as well as in Static IP Mode.
But i can recive a reply only if i configure my machine to have a static IP. It seems that my packets do not get routed. Is there a way around this?
Feel free to take a look:
https://github.com/PicassoCT/Journeywar ... _arCam.lua
Re: AR-Camera
hm, when locking through your code: does it work with a dynamic ip when you set "local hostIPAddress = "0.0.0.0"?
if not: whats the error message / what happens?
edit:
http://w3.impa.br/~diego/software/luasocket/udp.html
broadcast:setsockname("*", BR_port)
should be fine!
Re: AR-Camera
Thx for repyling abma,
well i went ahead- and did some experimentation on everything tcp and udp have to offer springwise.
Turnsout- that if i register a UDP port with the same ip the tcp connection of spring has reserved- i can receive packages.
Netstat before and after:
So i guess i have to turn this around.. have Spring Broadcast to the mobile device, and then set the ip of the mobile device to be on the spring device ip. Which is okayish.
We are talking about a red hot glowing brick on fire- in everyones face. So a static ip should be the least of the worries.
Silly, silly, silly - get on with it.
well i went ahead- and did some experimentation on everything tcp and udp have to offer springwise.
Turnsout- that if i register a UDP port with the same ip the tcp connection of spring has reserved- i can receive packages.
Netstat before and after:
Code: Select all
C:\Users\PicassoCT>netstat -a
Aktive Verbindungen
Proto Lokale Adresse Remoteadresse Status
TCP 0.0.0.0:135 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:445 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:5040 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:7680 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:27036 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:49664 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:49665 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:49666 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:49667 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:49673 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:49674 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:21320 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:21321 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:21322 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:21323 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:21327 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:27060 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:59650 DESKTOP-ATSRCJ9:59651 HERGESTELLT
TCP 127.0.0.1:59651 DESKTOP-ATSRCJ9:59650 HERGESTELLT
TCP 127.0.0.1:59652 DESKTOP-ATSRCJ9:59653 HERGESTELLT
TCP 127.0.0.1:59653 DESKTOP-ATSRCJ9:59652 HERGESTELLT
TCP 127.0.0.1:59658 DESKTOP-ATSRCJ9:59659 HERGESTELLT
TCP 127.0.0.1:59659 DESKTOP-ATSRCJ9:59658 HERGESTELLT
TCP 127.0.0.1:59671 DESKTOP-ATSRCJ9:59672 HERGESTELLT
TCP 127.0.0.1:59672 DESKTOP-ATSRCJ9:59671 HERGESTELLT
TCP 127.0.0.1:59717 DESKTOP-ATSRCJ9:59718 HERGESTELLT
TCP 127.0.0.1:59718 DESKTOP-ATSRCJ9:59717 HERGESTELLT
TCP 127.0.0.1:59793 DESKTOP-ATSRCJ9:59794 HERGESTELLT
TCP 127.0.0.1:59794 DESKTOP-ATSRCJ9:59793 HERGESTELLT
TCP 127.0.0.1:59845 DESKTOP-ATSRCJ9:21322 WARTEND
TCP 192.168.178.20:139 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 192.168.178.20:57069 13.92.211.253:https HERGESTELLT
TCP 192.168.178.20:58237 springrts:8200 HERGESTELLT
TCP 192.168.178.20:59661 ec2-34-210-41-110:https HERGESTELLT
TCP 192.168.178.20:59699 lb-192-30-253-125-iad:https WARTEND
TCP 192.168.178.20:59732 fra16s25-in-f14:https HERGESTELLT
TCP 192.168.178.20:59766 fra16s05-in-f1:https WARTEND
TCP 192.168.178.20:59767 fra15s22-in-f182:https WARTEND
TCP 192.168.178.20:59791 40.79.65.78:https WARTEND
TCP 192.168.178.20:59792 fra16s05-in-f106:https HERGESTELLT
TCP 192.168.178.20:59795 lb-192-30-253-125-iad:https HERGESTELLT
TCP 192.168.178.20:59797 fra16s05-in-f100:https HERGESTELLT
TCP 192.168.178.20:59798 fra16s05-in-f14:https HERGESTELLT
TCP 192.168.178.20:59799 104.16.52.111:https HERGESTELLT
TCP 192.168.178.20:59801 server-13-32-14-208:https HERGESTELLT
TCP 192.168.178.20:59803 93.184.220.17:https HERGESTELLT
TCP 192.168.178.20:59804 muc11s11-in-f10:https HERGESTELLT
TCP 192.168.178.20:59805 vip0x00f:https WARTEND
TCP 192.168.178.20:59806 vip0x00f:https WARTEND
TCP 192.168.178.20:59807 fra15s11-in-f10:https HERGESTELLT
TCP 192.168.178.20:59808 104.19.198.151:https HERGESTELLT
TCP 192.168.178.20:59810 104.19.198.151:https WARTEND
TCP 192.168.178.20:59815 104.17.211.204:https HERGESTELLT
TCP 192.168.178.20:59816 ec2-52-0-61-34:https HERGESTELLT
TCP 192.168.178.20:59817 fra16s05-in-f14:https HERGESTELLT
TCP 192.168.178.20:59818 a95-101-80-8:http HERGESTELLT
TCP 192.168.178.20:59819 a95-101-80-8:http WARTEND
TCP 192.168.178.20:59820 104.16.55.111:https HERGESTELLT
TCP 192.168.178.20:59822 a95-101-80-8:http WARTEND
TCP 192.168.178.20:59823 server-13-32-8-234:http HERGESTELLT
TCP 192.168.178.20:59824 server-13-32-8-234:http HERGESTELLT
TCP 192.168.178.20:59825 lb-192-30-253-112-iad:https HERGESTELLT
TCP 192.168.178.20:59826 server-13-32-14-199:https HERGESTELLT
TCP 192.168.178.20:59828 server-13-32-14-156:https HERGESTELLT
TCP 192.168.178.20:59831 server-13-32-14-124:https HERGESTELLT
TCP 192.168.178.20:59833 fra16s05-in-f106:https HERGESTELLT
TCP 192.168.178.20:59834 server-13-32-2-6:https HERGESTELLT
TCP 192.168.178.20:59835 server-13-32-2-6:https HERGESTELLT
TCP 192.168.178.20:59836 server-13-32-2-6:https HERGESTELLT
TCP 192.168.178.20:59837 server-13-32-2-6:https HERGESTELLT
TCP 192.168.178.20:59839 fra16s05-in-f3:https HERGESTELLT
TCP 192.168.178.20:59840 151.101.112.133:https HERGESTELLT
TCP 192.168.178.20:59842 151.101.112.133:https HERGESTELLT
TCP 192.168.178.20:59843 151.101.112.133:https HERGESTELLT
TCP 192.168.178.20:59846 151.101.65.69:https HERGESTELLT
TCP 192.168.178.20:59850 192.0.73.2:https HERGESTELLT
TCP 192.168.178.20:59851 stackoverflow:https HERGESTELLT
TCP 192.168.178.20:59852 93.184.220.29:http HERGESTELLT
TCP 192.168.178.20:59853 fra16s05-in-f3:https HERGESTELLT
TCP [::]:135 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:445 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:7680 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:49664 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:49665 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:49666 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:49667 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:49673 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:49674 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::1]:49751 DESKTOP-ATSRCJ9:0 ABHÖREN
UDP 0.0.0.0:123 *:*
UDP 0.0.0.0:500 *:*
UDP 0.0.0.0:4500 *:*
UDP 0.0.0.0:5050 *:*
UDP 0.0.0.0:5353 *:*
UDP 0.0.0.0:5355 *:*
UDP 0.0.0.0:8090 *:*
UDP 0.0.0.0:27036 *:*
UDP 0.0.0.0:61505 *:*
UDP 127.0.0.1:1900 *:*
UDP 127.0.0.1:52935 *:*
UDP 127.0.0.1:60355 *:*
UDP 192.168.178.20:137 *:*
UDP 192.168.178.20:138 *:*
UDP 192.168.178.20:1900 *:*
UDP 192.168.178.20:60354 *:*
UDP [::]:123 *:*
UDP [::]:500 *:*
UDP [::]:4500 *:*
UDP [::]:5353 *:*
UDP [::]:5355 *:*
UDP [::]:8090 *:*
UDP [::]:27036 *:*
UDP [::1]:1900 *:*
UDP [::1]:8452 *:*
UDP [::1]:60353 *:*
UDP [fe80::9d5c:44e:9989:b968%17]:1900 *:*
UDP [fe80::9d5c:44e:9989:b968%17]:60352 *:*
C:\Users\PicassoCT>netstat -a
Aktive Verbindungen
Proto Lokale Adresse Remoteadresse Status
TCP 0.0.0.0:135 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:445 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:5040 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:7680 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:27036 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:49664 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:49665 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:49666 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:49667 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:49673 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 0.0.0.0:49674 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:21320 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:21321 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:21322 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:21323 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:21327 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:27060 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 127.0.0.1:59650 DESKTOP-ATSRCJ9:59651 HERGESTELLT
TCP 127.0.0.1:59651 DESKTOP-ATSRCJ9:59650 HERGESTELLT
TCP 127.0.0.1:59652 DESKTOP-ATSRCJ9:59653 HERGESTELLT
TCP 127.0.0.1:59653 DESKTOP-ATSRCJ9:59652 HERGESTELLT
TCP 127.0.0.1:59658 DESKTOP-ATSRCJ9:59659 HERGESTELLT
TCP 127.0.0.1:59659 DESKTOP-ATSRCJ9:59658 HERGESTELLT
TCP 127.0.0.1:59671 DESKTOP-ATSRCJ9:59672 HERGESTELLT
TCP 127.0.0.1:59672 DESKTOP-ATSRCJ9:59671 HERGESTELLT
TCP 127.0.0.1:59717 DESKTOP-ATSRCJ9:59718 HERGESTELLT
TCP 127.0.0.1:59718 DESKTOP-ATSRCJ9:59717 HERGESTELLT
TCP 127.0.0.1:59793 DESKTOP-ATSRCJ9:59794 HERGESTELLT
TCP 127.0.0.1:59794 DESKTOP-ATSRCJ9:59793 HERGESTELLT
TCP 127.0.0.1:59867 DESKTOP-ATSRCJ9:21322 WARTEND
TCP 192.168.178.20:139 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP 192.168.178.20:57069 13.92.211.253:https HERGESTELLT
TCP 192.168.178.20:58237 springrts:8200 HERGESTELLT
TCP 192.168.178.20:59661 ec2-34-210-41-110:https HERGESTELLT
TCP 192.168.178.20:59795 lb-192-30-253-125-iad:https HERGESTELLT
TCP 192.168.178.20:59851 stackoverflow:https HERGESTELLT
TCP 192.168.178.20:59861 fra16s05-in-f100:https HERGESTELLT
TCP 192.168.178.20:59865 fra16s05-in-f14:https HERGESTELLT
TCP 192.168.178.20:59866 fra16s05-in-f14:https HERGESTELLT
TCP [::]:135 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:445 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:7680 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:49664 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:49665 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:49666 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:49667 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:49673 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::]:49674 DESKTOP-ATSRCJ9:0 ABHÖREN
TCP [::1]:49751 DESKTOP-ATSRCJ9:0 ABHÖREN
UDP 0.0.0.0:123 *:*
UDP 0.0.0.0:500 *:*
UDP 0.0.0.0:4500 *:*
UDP 0.0.0.0:5050 *:*
UDP 0.0.0.0:5353 *:*
UDP 0.0.0.0:5355 *:*
UDP 0.0.0.0:8090 *:*
UDP 0.0.0.0:27036 *:*
UDP 0.0.0.0:61505 *:*
UDP 127.0.0.1:1900 *:*
UDP 127.0.0.1:52935 *:*
UDP 127.0.0.1:60355 *:*
UDP 192.168.178.20:137 *:*
UDP 192.168.178.20:138 *:*
UDP 192.168.178.20:1900 *:*
UDP 192.168.178.20:8090 *:*
UDP 192.168.178.20:60354 *:*
UDP [::]:123 *:*
UDP [::]:500 *:*
UDP [::]:4500 *:*
UDP [::]:5353 *:*
UDP [::]:5355 *:*
UDP [::]:8090 *:*
UDP [::]:27036 *:*
UDP [::1]:1900 *:*
UDP [::1]:8452 *:*
UDP [::1]:60353 *:*
UDP [fe80::9d5c:44e:9989:b968%17]:1900 *:*
UDP [fe80::9d5c:44e:9989:b968%17]:60352 *:*
C:\Users\PicassoCT>
We are talking about a red hot glowing brick on fire- in everyones face. So a static ip should be the least of the worries.
Silly, silly, silly - get on with it.
- Attachments
-
- exampleLuaServer.7z
- (89.83 KiB) Downloaded 10 times
Last edited by PicassoCT on 14 Aug 2018, 23:55, edited 1 time in total.
Re: AR-Camera
UDP 0.0.0.0:8090 *:*
and
UDP 0.0.0.0:8090 *:*
you should be able to receive udp packets in both cases...
and
UDP 0.0.0.0:8090 *:*
you should be able to receive udp packets in both cases...
Re: AR-Camera
wow nice progress Picasso
Re: AR-Camera
I dont know..
First the blending is off- the blending method i prefer, turns whie when in to broad sunlight- and the other one is just- cut and paste- and doesent have the holographic look to it. So i need to use the ligh detection sensor to balance those two.
There there is the problem of the udp server.
Its always the same- everyone states it obvious and easy.
Until its not and you have to read into android source code to get onwards.
I did stupid things though too.
I set the Device IP Adress to the broadcast adress (255.255.255.255) , and then wondered why i got a invalid argument EINVAL on my packets send.
So overall - its super slow going.
First the blending is off- the blending method i prefer, turns whie when in to broad sunlight- and the other one is just- cut and paste- and doesent have the holographic look to it. So i need to use the ligh detection sensor to balance those two.
There there is the problem of the udp server.
Its always the same- everyone states it obvious and easy.
Until its not and you have to read into android source code to get onwards.
I did stupid things though too.
I set the Device IP Adress to the broadcast adress (255.255.255.255) , and then wondered why i got a invalid argument EINVAL on my packets send.
So overall - its super slow going.
Re: AR-Camera
Code: Select all
private void testLoop() throws IOException {
SpringAR.testCases toTest = SpringAR.testCases.bindsend;
DatagramSocket sendSocket = null;
DatagramSocket recieveSocket = null;
InetSocketAddress address;
switch (toTest) {
case broadcastrecieve:
address = new InetSocketAddress(InetAddress.getByName("0.0.0.0"), 9000);
recieveSocket = new DatagramSocket(null);
recieveSocket.setSoTimeout(30);
recieveSocket.bind(address);
break;
case broadcastsend:
address = new InetSocketAddress(InetAddress.getByName("192.168.178.178"), 9000);
sendSocket = new DatagramSocket(null);
sendSocket.setSoTimeout(30);
sendSocket.setBroadcast(true);
sendSocket.bind(address);
break;
case bindsend:
address = new InetSocketAddress(InetAddress.getByName("192.168.178.178"), 9000);
sendSocket = new DatagramSocket(null);
sendSocket.setSoTimeout(30);
sendSocket.bind(address);
sendSocket.setBroadcast(false);
break;
case bindrecieve:
address = new InetSocketAddress(InetAddress.getByName("192.168.178.178"), 9000);
recieveSocket = new DatagramSocket(null);
recieveSocket.setSoTimeout(30);
recieveSocket.bind(address);
recieveSocket.setBroadcast(false);
break;
}
while (true) {
Log.d(SpringAR.protocollDebugLogPrefix, "TestLoop running");
String dbg_message;
if (recieveSocket != null) {
try {
DatagramPacket rcv_packet = new DatagramPacket(rcv_message[writeBuffer], rcv_message[writeBuffer].length);
recieveSocket.receive(rcv_packet);
dbg_message = new String(rcv_message[writeBuffer], 0, rcv_packet.getLength(), "US-ASCII");
Log.d(SpringAR.dataDebugLogPrefix, "" + rcv_packet.getAddress().getHostAddress() + ": " + dbg_message.trim() + " via " + toTest.name());
} catch (SocketTimeoutException e) {
}
}
if (sendSocket != null ) {
try {
DatagramPacket snd_packet = null;
switch (toTest) {
case broadcastsend:
snd_packet = new DatagramPacket(("Testmessage send by " + toTest.name() + " socket").getBytes(),
("Testmessage send by " + toTest.name() + " socket").length(),
InetAddress.getByName("255.255.255.255"),
SpringAR.UDP_SERVER_PORT
);
break;
case bindsend:
snd_packet = new DatagramPacket(("Testmessage send by " + toTest.name() + " socket").getBytes(),
("Testmessage send by " + toTest.name() + " socket").length(),
InetAddress.getByName("192.168.178.20"),
SpringAR.UDP_SERVER_PORT
);
break;
}
sendSocket.send(snd_packet);
} catch (IOException e1) {
}
}
try {
Thread.sleep(SpringAR.TIME_OUT_IN_BROADCAST);
} catch (InterruptedException e) {
Log.d(SpringAR.protocollDebugLogPrefix, " Broadcast Interrupted");
}
}
}
Im running this code on a phone with wifi in fixed ip.
And no matter what testmode i run this loop- i always get broadcast behaviour.
Re: AR-Camera
why do you bind the socket to a fixed ip? thats afaik not needed.
is there a reason for using two sockets? you could send + receive from the same socket.
is there a reason for using two sockets? you could send + receive from the same socket.
Re: AR-Camera
very simple udp client/server in python:
client:
server:
server just echos back to clientip / port. client broadcasts to find server ip and does send a direct send. server + client can be run on the same ip / computer.
client:
Code: Select all
#!/usr/bin/env python3
import socket
ip="255.255.255.255"
port=1234
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
sock.sendto(b"Hello World!", (ip, port))
data, remoteaddr = sock.recvfrom(1024)
print(remoteaddr, data)
sock.sendto(b"Direct send", remoteaddr)
data, remoteaddr = sock.recvfrom(1024)
print(remoteaddr, data)
server:
Code: Select all
#!/usr/bin/env python3
import socket
ip = "0.0.0.0"
port = 1234
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((ip, port))
while True:
data, remoteaddr = sock.recvfrom(1024)
print("%s %s" %(remoteaddr, data))
sock.sendto(data, remoteaddr)
server just echos back to clientip / port. client broadcasts to find server ip and does send a direct send. server + client can be run on the same ip / computer.
Re: AR-Camera
Gather round kids, for i have to bring you another fascinating tale of the infinite quest for AR.
Where did we left off - the last time? Ah, yes, the udp package wars. Well those where actually quite boring and solved.
So what remains? Yes, the math intrigues.
On the ARDevice we have a object-pose, which is basically the virtual objects position in world space.
But dont we need the camera, uncle Pica?
Yes, we need that- we need the camera position in the ar-core world, and the center of the object.
We get that by taking the anchorPose and applying the camera affinity matrix on the coordinates.
Now we have the center of our little world - in coordinates relative to the camera.
To make our live easier we also send the camera rotation as a quaternion to the system:
Now we have the data arrive on the Spring Side of town..
We first determine the max dimensions of the map
From this we calculate the scalefactor- arcores dimensions are in meters
We scale the matrice so the object is a spring sized distance away from the camera
Now, to get to the position of the camera in the world, we have to calculate the adjunct matrix.
Which is done by calculating the -minor matrices and the cofactors.
Finally we computate the inverse matrix to get the coordinates of the camera relative to the object in world
Because the inverse matrice might not be normalized, we do
Now we can reap what we saw - we get the camera Position from the inverse and plung that into the camera state.
For the Quaternion to euler angles - radiants as we imagine them i found a nice litte javascript function.
Also it fails, of course it fails.
Where did we left off - the last time? Ah, yes, the udp package wars. Well those where actually quite boring and solved.
So what remains? Yes, the math intrigues.
On the ARDevice we have a object-pose, which is basically the virtual objects position in world space.
But dont we need the camera, uncle Pica?
Yes, we need that- we need the camera position in the ar-core world, and the center of the object.
We get that by taking the anchorPose and applying the camera affinity matrix on the coordinates.
Code: Select all
anchorPose= anchorPose.compose(camera.getPose());
To make our live easier we also send the camera rotation as a quaternion to the system:
Code: Select all
camera.getPose().getRotationQuaternion(rotQuaternion,0);
Code: Select all
function setCamera(cam_mat, rot_quat)
Code: Select all
MAX_MAP_SIZE = math.max(mapSizeZ,mapSizeX)
Code: Select all
--Scalefactor = OriginalScale(1m)/TotalSizeOfSquareInReality (e.g. 2m)* biggest map size in Elmo
scaleFactor = ((1/SIZE_SPRING_SQUARE)* MAX_MAP_SIZE)
We scale the matrice so the object is a spring sized distance away from the camera
Code: Select all
world_mat= scaleMatrice(cam_mat, scaleFactor,scaleFactor,scaleFactor)
Which is done by calculating the -minor matrices and the cofactors.
Code: Select all
--calculate the adjugate - the matrix of cofactors
minor_mat= matrix(4,4,0)
for i=1,#minor_mat do
for j=1,#minor_mat do
-- Minor -- cofactor
minor_mat[i][j] = matrix.det(getMinorMat(world_mat,i,j)) * (-1^(i)*-1^(j))
end
end
--transpose the cofactor matrice into the adjunct
adjunct = matrix.transpose(minor_mat)
Finally we computate the inverse matrix to get the coordinates of the camera relative to the object in world
Code: Select all
inverse_mat = (1/matrix.det(world_mat))* adjunct
Code: Select all
--normalize the matrice
norm = 1/inverse_mat[4][4]
inverse_mat= inverse_mat * norm
Code: Select all
camState= Spring.GetCameraState()
camState.px= inverse_mat[1][4]
camState.pz= inverse_mat[3][4]
camState.py= inverse_mat[2][4]
For the Quaternion to euler angles - radiants as we imagine them i found a nice litte javascript function.
Code: Select all
camState.rx, camState.rz, camState.ry= quaternionToEulerAngle(rot_quat[1],rot_quat[2],rot_quat[3],rot_quat[4])
Spring.SetCameraState(camState)
end
- Attachments
-
- grippe.jpg
- (485.77 KiB) Not downloaded yet
Re: AR-Camera
So, progress report.
I can set the camera position- except for the heigth. I also bounce into some strange limitations there.
Setting the position works for all camera positions.
I can set the camera direction, but the direction is offset- meaning if i look into the ground, i look 90° ahead in the world, while 90° ahead are - i look in sky. setting the direction only works for fps mode.
Its super slow, meaning camera updates only arrive every second. I have to decouple that from the rendering. Not that i do anything in this department, yet, except drawing a static image.
Yet, its progress.
I guess i should post a video, problem is, how to take video, if you use phone as spring cam.
I can set the camera position- except for the heigth. I also bounce into some strange limitations there.
Setting the position works for all camera positions.
I can set the camera direction, but the direction is offset- meaning if i look into the ground, i look 90° ahead in the world, while 90° ahead are - i look in sky. setting the direction only works for fps mode.
Its super slow, meaning camera updates only arrive every second. I have to decouple that from the rendering. Not that i do anything in this department, yet, except drawing a static image.
Yet, its progress.
I guess i should post a video, problem is, how to take video, if you use phone as spring cam.
Re: AR-Camera
Im not in need of help, im just asking for a friend of mine - how do i add a constant offset to a directional vector?
If anyone wants to try out for himself:
https://github.com/PicassoCT/Journeywar ... _arCam.lua
And here is the APK A installation for manually installing apks. You might need arcore from google.
Warning: This is still buggy as hell - and very slow.
In the App- find a plane, and position the anchor (thats where the spring world map will be).
It might be necessary to restart the app.
Bug reports are of course welcome. I recommend using the rotation camera.
If anyone wants to try out for himself:
https://github.com/PicassoCT/Journeywar ... _arCam.lua
And here is the APK A installation for manually installing apks. You might need arcore from google.
Warning: This is still buggy as hell - and very slow.
In the App- find a plane, and position the anchor (thats where the spring world map will be).
It might be necessary to restart the app.
Bug reports are of course welcome. I recommend using the rotation camera.
Re: AR-Camera
You know how they say never roll your own crypto?
I thought long and hard about how to transfer video from spring desktop to a android device.
And i think it would be very foolish to try to reinvent the wheel here.
And it would also be very foolish to try to implement this in lua.
So here is a set of questions.
Spring is able to dump a videostream of the currently played game- correct?
As far as im aware of- it is only able to capture avis?
Formats like OpenH264 are not supported?
https://github.com/cisco/openh264
Would integrating such a existing streaming option in unsynced be frowned upon by the devs?
Cause from there - is rather a walk in the park, compared too other solutions i approached:
https://github.com/ekumenlabs/AndroidStreamingClient
I thought long and hard about how to transfer video from spring desktop to a android device.
And i think it would be very foolish to try to reinvent the wheel here.
And it would also be very foolish to try to implement this in lua.
So here is a set of questions.
Spring is able to dump a videostream of the currently played game- correct?
As far as im aware of- it is only able to capture avis?
Formats like OpenH264 are not supported?
https://github.com/cisco/openh264
Would integrating such a existing streaming option in unsynced be frowned upon by the devs?
Cause from there - is rather a walk in the park, compared too other solutions i approached:
https://github.com/ekumenlabs/AndroidStreamingClient
-
- Posts: 6
- Joined: 25 Sep 2014, 20:59
Re: AR-Camera
Hi PicassoCT,
I followed your link from my thread but your youtube link (in your 2nd post) points to a "Video unavailable".
What was that video?
The rest here is really cool.
I followed your link from my thread but your youtube link (in your 2nd post) points to a "Video unavailable".
What was that video?
The rest here is really cool.