Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
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


Code:




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

Your robot can be more than a simple automated machine with the power of ARC Pro!

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.



Code:



: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:)
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.

Code:



: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
#25  
You would need to set up your laptop as a router so it creates a network your iphone can connect to. As far as i know, an iPhone can o ly do Infrastructure networking, not Adhoc, but there is software available that can make Windows 7 be an infrastructure router , I'll try and post a link tomorrow, but as I recall it was a bit complicated for someone who doesn't already understand networking, so your solution is actually not a bad one. (sorry for the run on sentence.. Long day, and i am falling asleep as I type).

Couple of other options available I'll post about tomorrow when more awake.
United Kingdom
#26  
Hi if you can enter a URL and not an IP address into the Sensor Stream app then you should be able to setup port forwarding or your home router (not the laptop) using a service such as DTDNS.net

If you are lucky enough to have a fixed IP address @home then you don't need the DTDNS service but you will need to make sure the appropriate port is visible over the Internet normally say port 80 would be but is used for other services so that's why Sensor Stream uses port 1111

I stream my home CCTV (4 cameras) to my IPhone using DTDNS and I can keep an eye on the house when I out and about and connected to a WIFI internet access point

It may not be the best way to do this as Sensor Stream updates rapidly and being on the same network maybe the most efficient. It depends I guess on how you want to run your application?

If I get a chance later I may try setting the DTDNS option with the Iphone and see if it works
#27  
Hey Winstn,


The Sensor Stream and ARC are working perfectly in my home network through my access point. Sensor Stream sends to my accesspoint my laptop gets the data there through port 1111 on 192,168.1,3 which I find with cmd.exe>ipconfig

My issue is when I take it out doors, I'm having to power an 5v Asus wireless Access point via the EZ-B board. Which works but just consumes more power than I like. I was thinking there was a way to communicate with my phone out doors and conserve significant battery life.

I find the Iphone accelerometer far superior to the MMA7455 BTW.

Thanks much,

Bill...
#29  
A wireless hotspot was going to be one of my suggestions. Even one without a contract will still act as an lan router, they are battery powered, and typically charge on 5v 0.5amp or less (usb).

Bill, I have an old 3g MiFi off contract that you can have. Email me at alan at thetechguru.net with your mailing address if interested.

Alan
#30  
A little bit of an expensive solution, but this device: Roving Networks WiFi can be used as a really low power access point (among many other things). I bought one to try using as a WiFi TTL, which unfortunately is not one of the things it does, but I have plans for it.

Alan
#31  
Hey Techguru,

Thanks for the offer of your hotspot. Though, Asus wireless access point thing is working pretty well. I don't have to have it in my robot so I can power it separately so it won't be that much trouble. That Roving Networks WIFI looks powerful also.

I'm starting to build the 4wd monster truck climber now. I'll use the Iphone Data Streamer app to read GPS, compass and accelerometer to communicate with the EZ-B. I'm hooking the digital pins of the EZ-B to the remote controller for the truck. That way I won't have to make any modifications to the truck other than securely housing my Iphone.

I plan to use the phone's sensors to tell if it's trying to accelerate but it's against something. Then I'll back up, go left and resume it's uphill climbing algorithm.

When the mini is released, I'll put one of them in the truck with it's RC controller to add some addition ping or perhaps my Neato LDS unit.

Bill
#32  
Update:

We can significantly simplify this method by jailbreaking our iphones and purchasing the hotspot MyFi app.

This eliminates the need for powering a wireless access point for outdoor use.

Best,

Bill