Asked — Edited
Resolved Resolved by DJ Sures!

Using All Iphone Sensors Gps With Ez-B

I'm inches away from creating a method for us to use Iphones GPS, Acclerometer, gyro, data for our robots.

This app rapidly streams data to the PC via wireless UDP stream.

With Python 2.7 or greater installed, this Python script updates the PC with comma delimited data of telemetry data.

I've been trying for about 12 hours to make the Python script below write to the C drive so EZ-Script can read that line and split it into an array with it's split string function.

I don't know how to add that write function to the script?

Thanks in advance! Bill...

Below is info on the Iphone APP: Sensor Data Iphone App

Below is the correct format of the script above: Sensor Data PC script

Below makes me drule. The Specifications of the data the python script receives from the Iphone: App Specifications




import SocketServer

PORTNO = 10552

class handler(SocketServer.DatagramRequestHandler):
    def handle(self):
        newmsg = self.rfile.readline().rstrip()
        print "Client %s said ``%s''" % (self.client_address[0], newmsg)
        self.wfile.write(self.server.oldmsg)
        self.server.oldmsg = newmsg

s = SocketServer.UDPServer(('',PORTNO), handler)
print "Awaiting UDP messages on port %d" % PORTNO
s.oldmsg = "This is the starting message."
s.serve_forever()


// REM below is a python write function that writes over the contents of an existing file and leaves it open for other programs to read
// with open("C:\\syslog.txt", "w+") as myfile:
// myfile.write(str(s.oldmsg))


ARC Pro

Upgrade to ARC Pro

With ARC Pro, your robot is not just a machine; it's your creative partner in the journey of technological exploration.

PRO
Synthiam
#1  

That's a brilliant idea!

There is a lot of overhead with reading and writing to files - and having to install Python. I have a suggestion:)

  1. In your iPhone app, include a section for IP Address and Username. Also maybe names of the variables to configure (i.e. $AccelX and $AccelY, and $CompassDegree, etc)

  2. Have the iPhone set the variables directly in ARC. You can do so with the HTTP Server, easily. The syntax is..


http://192.168.0.1/Exec?password=admin&script=$AccelX=32

You can repeat the above URL for each parameter, $AccelY, $CompassDegree, etc...

So essentially you skip the Python step and communicate with ARC directly. It's a good start to having an app that can have additional functionality too. For example, you can even have your iPhone control direction using ...


http://192.168.0.1/Exec?password=admin&script=Forward()

Any EZ-Script commands can be sent to the HTTP Server using that URL:)

Canada
#2  

hmmmm DJ with that little bit of code could i set variables directly in ARC from other programs that are running on my computer and is it posible for ARC to send data out to another program maybe using a get command ¿¿¿ confused

United Kingdom
#3  

Yes. I used to do similar to operate Jarvis from ARC which was running some PHP which took the "event" and passed it to EventGhost.

In my cloud I believe the example is still there for the EZ-Script (this one). Somewhere I have posted the PHP code too but I'll see if I can find it if anyone wants it. Different apps will use different methods so it may not be useful other than as a reference.

The above has been scrapped now in favour of Telnet to communicate directly with ARC.

Canada
#4  

Any bit of code for that sort of thing would be something im VARY interested in :D Thank You :D

#5  

Thanks DJ and others for the rapid response.

I agree there are a lot of moving parts to this one. I didn't create the app. But Python has built in compiler so that if /when someone modifies the above code with a segment that rewrite a single line of the current comma delimited data sent, I could compile it to an .exe and you could make it available for us.

Bill

PRO
Synthiam
#6  

What's the name of the App? I'll write a control in ARC to receive the network connection.

Netherlands
#8  

You can mark this issue is resolved. I'm in the same room as DJ and he's working on the ARC control:D