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

ARC Pro is your passport to a world of endless possibilities in robot programming, waiting for you to explore.

Canada
#17  

I have not installed the app yet not sure it will work for me as i only have an old ipod lol

PRO
Synthiam
#18  

Wow EEGbiofeedback, you have done a lot in the short time of this control:) Nice work!

PRO
Canada
#19  

Aw man! I tried to install the Sensor Streamer App on my old iphone 3GS and it said I needed IOS5.0 or newer. I guess I may have to upgrade...but all my Cydia apps:(...tough decision.

#20  

DJ, this one was gestating in me since you created the conditional logic in Ez-Script. So it was just a matter of that Iphone app coming available and you doing the heavy lifting to create this awesome interface the app. Then, it was a slow day at work and it only 12 lines of code to teach it to learn how to climb hills.

I have a Radio Shack monster truck I'm building up to with the tank chassis. I trashed a few things before getting the tank for tests first. Rather than tearing my tank apart, I'm waiting for the new EZ-Bs to become available for the truck climber.

Here's the final script that keeps it renegotiating until it climbs to the highest point of whatever it's placed on. I find it fascinating how with so few rules something with just one sense can perform such complex behaviors.



:topA
if ($AccelerometerX<-0.13)
Left(200,300)
endif

if ($AccelerometerX>0.13)
Right(200,300)
endif

if ($AccelerometerZ<0.07) 
forward(200,300)
endif

sleep(300)
goto(topA)


#21  

Skater, I've used the Sensor Stream App with the EZ-B on a 3Gs Iphone. I successfully Installed it yesterday on model MB717LL on IOS 5.5.1. Shucks re losing your Cydia apps. The 3Gs just lacks Gyros but the accelerometer, GPS, and compass work well.

Best,

Bill

PRO
Canada
#22  

Awesome, Thanks Bill!

#23  

Has anyone been able to connect their Iphone controller without an internet connection to their laptop?

When I took the tank outside for rock climbing, I realized the IP address I was connecting to 192.168.1.2 was my laptop with ARC but through my wifi network.

I've tried connecting to local host 127.0.0.1 on port 1111

When enter netstat at the cmd.exe prompt I see the local host with 8 different ports but none with port 1111.

When I run Microsoft's TCP view (which is a really cool program) I see the ARC.exe with a local IP Address at 0.0.0.0 on port 1111

I've tried entering in 0.0.0.0 on port 1111 on the Sensor Streamer Iphone app.

I've tried opening port 1111 in my windows firewall but not sure I did it right.

I'm wanting to give the tank a GPS location up a steep hill and let it navigate around until it finds a way to the top. Then I'll hook this up to a high powered 4x4 truck.

Thanks,

Bill

#24  

Here's a solution but probably not the best one for my issue where I was unable to connect the EZ-B with the iphone outdoors and away from my homes wireless network.

I powered an 5 v Asus Wireless access point from the EZ-b board. It consumes a lot of power but works.

I can't figure out why the phone can't connect directly to the wifi on the laptop. Is it a firewall issue? Network things baffle me.

Best,

Bill