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

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

#9  

AWSOME NIEK!

I'm giving up my file Python writing scheme now. That is a very complex language.

I would be more than delighted to beta test it. I have that app on a iphone 5, 3gs and an ipad?

Netherlands
#10  

@EEGbiofeedback No need to beta test it, I've seen it work! As a matter of fact, I've tried it myself:D

#12  

You guys are UNREAL!

Here's a video of the simplest application of using the phone to move a bot:

Yet the real power will come from the GPS, detecting smacks, telling how fast it's going before trying to turn, and the thing I'm playing with tomorrow, I'll call take that hill. I'll teach it how to autonomously best climb hills and avoiding obstacles.

The video is below: Click To Watch Video


:top



if ($AccelerometerY<-0.8)
reverse(200,300)
$direction=$TrueHeading
endif

if ($AccelerometerY>-0.1)
forward(200,300)
$direction=$TrueHeading
endif

if ($TrueHeading<$direction)
Left(200,300)
$direction=$TrueHeading
endif

if ($TrueHeading>$direction)
Right(200,300)
$direction=$TrueHeading
endif
#sleep(1000)
Print("Dir " + $Direction + "Heading " + $TrueHeading)

goto(top)


United Kingdom
#13  

You Tube link didn't work found it here

#14  

Yea that's some awesome sauce right there. This is what excites me about ez- robot

#15  

Here's a video and code of the Iphone in the robot finding the correct inclination to climb a hill.



:topA

if ($AccelerometerX<-0.05 or $AccelerometerX>0.05) 
if ($AccelerometerX<-0.1)
Left(200,300)
endif


if ($AccelerometerX>0.1)
Right(200,300)
endif
endif
sleep(300)
Print("Dir " + $Direction + "Heading " + $TrueHeading)

goto(topA)





United Kingdom
#16  

I know what I'm doing with my old iPhone:)