|
Home
Home of Accelerometer Simulator
IntroductionAccelerometer Simulator is an iPhone/iPod Touch application that transfers accelerometer data from the device to your computer using UDP protocol. Use casesThe main use case for the application is to allow iPhone application developers to create applications that require accelerometer, without having to do all the debugging on the actual device. By inserting two files into their project, they can use the Accelerometer Simulator to provide accelerometer data to their application when debugging on the iPhone simulator. Second use case is to use your iPhone accelerometer to control something else on another device (such as your MacBook or PC). Finally you can use the receiver part and write your own data generation application to, for example, execute predefined accelerometer datasets on your application. Usage
The application has two views: Accelerometer and Network. The Accelerometer view looks like this
Here you can switch between the actual sensor and manual operation modes. The sliders show the current accelerometer values. In the manual mode you can slide these yourself, generating accelerometer data manually. Note that in the manual mode you can generate data that would not be possible to generate with the HW sensor. In the second view (tap the bottom tap bar to activate) you can configure network settings.
When the application starts, network is set to OFF and no data is being sent. Switching it to ON opens the gates and the application begins sending UDP packets to the network. By feault it uses broadcast mode, which means that all devices in the same network (such as your WLAN) will receive the packets. In case you plan to run multiple simulators in the same network, you should switch to unicast mode and specify the target IP address manually. You may also change the port to something else if you wish (remember to change it on the receiving end as well). Now that AccSim is sending accelerometer data, it's time to setup someone receiving it. Embedding into your applicationTo embed Accelerometer Simulator capabilities into your own application, simply add the AccelerometerSimulation.h and AccelerometerSimulation.m files from the Simulator classes directory into your project. Then in the source file where you configure UIAccelerometer, simply add #import "AccelerometerSimulation.h" This will override the default behaviour of UIAccelerometer when run on the iPhone simulator. When building for device, nothing is changed in your application. After compiling and running your application on the simulator, it should now be receiving accelerometer data from the AccSim application running on your device. Should you need to use a different UDP port, you have to edit the AccelerometerSimulaton.m file and change the line #define kAccelerometerSimulationPort 10552 Other usagesIf you want to use the AccSim application for other purposes, check out the testaccsim.py Python-example. It prints out the messages sent by AccSim. The format of messages is following: ACC: <deviceid>,<timestamp>,<x>,<y>,<z> The deviceid is the unique device id of iPhone, used to identify different sources if there are many (think of a crowd of iPhone users controlling a single game on a big screen...) Next is timestamp and acceleration values for x,y and z. These are derived directly from UIAcceleration. |
Sign in to add a comment
Hello,
Please, can you put this app in the apple store?
It'd be great to have this in the app store!
Hey,
Thanks for sharing your code! I hooked this up to my macbook's internal accelerometer (using UniMotion?):
http://ifiddling.blogspot.com/2009/01/dummy2.html
Best, Karan
This is way too cool! I can finally provide decent looking movies for my accelerometer based games! Thanks a bunch, man!
Thanks for sharing! Is anyone aware of an equivalent for multitouch, sending touches from the device to the simulator? (I need more than the pinch and drag that are available on the simulator)
I made a TCP client that handles accelerometer and multi-touch. The only problem is that it is designed to work with SIO2, so it would need a bit of tweaking to work for general programs.
This is fantastic! Thanks for sharing such a useful tool, I had it all hooked up and running on my apps within a few minutes.
Does anybody know why this stops streaming when the iPhone goes into "sleep" mode? Even if it's setup to run in the background via jailbreaking, the data still stops.
I am having an issue with the timestamps coming over to the python script. When I average them, I am getting a 10% reduction on the frequency of the accelerometer update that is coded in. Also, it occasionally will lose a record.
Is this not working anymore?
I'm using iPhone SDK 3.1.2, iPhone Simulator running iPhone OS 2.2.1
I've got the AccSim? application running on an iPhone 3G and iPod Touch 16GB 1st Gen just fine, and included the simulator .h and .m files in my project(s) just fine, and I can see the "getAccelerometer" function get called by placing a NSLog statement there in the simulator, but the delegate never makes any callbacks in the simulator at all
Switching to the device(s) works just fine...
Works great! Thanks for the code.
Nice and easy, worked the very first time. Thanks a bunch. As others have pointed out, the only logical extension to this project is to add touchesBegin/touchesEnd support, then it'll be perfect. Also, the ability to save network preferences would be nice. But hey, it's open source, so I might contribute these changes if I ever put them in myself.
Thanks alot. Beers on me.
Very clever, here some suggestions how it could evolve even better (if only apple picked up): http://fraggle.squarespace.com/blog/2009/6/14/doing-game-using-accelerometer-on-the-iphone-dont-miss-that.html
Thank you very much. I think that this is going to prove a life saver for me.
Anyone know how many bytes are in each portion of the message. ie. it sends a 76 byte array across udp and it's split into those 5 messages. id, timestamp, x,y,z
how many bytes make up each portion?
Also anyone made a windows server for accepting this? I'm working on that now in c#.
Has anybody been able to get this to work with PhoneGap?? I'm not having any luck. Thanks.
I'm just wondering how exactly i download this. I've followed the link etc. but it doesn't take me to any sort of page... Is the link dead? Is it actually possible to download this?
To Download it just open a terminal window and type (or paste): svn checkout http://accelerometer-simulator.googlecode.com/svn/trunk/ accelerometer-simulator-read-only