Forum Archive

Request: gyroscope, magnetometer, and camera access

ungaa

I've been using Pythonista for about an year now, and I have to say that it is an absolutely fantastic piece of software.

Lately, I've been experimenting with sensor fusion and dead reckoning algorithms, and I'd love to be able to put together and test quick prototype algorithms on an iOS device. The scene.gravity function provides a good estimate of the gravity vector, but I'd like to be able get raw accelerometer, gyro, and magnetometer readings, as well as more options for processed data.

For another project I've been working on, I've been wanting to take pictures programmatically using my iDevice's camera to do image processing. I don't need a fast real time video stream, just the ability to take static photos programmatically. It would also be nice to control the torch/flash in code.

I'd be very excited if you could incorporate such functionality into Pythonista. These are very useful sensors that iOS devices have that most desktop computers don't. Such functionality would greatly extend the possibilities of Pythonista and make my iPad and iPod invaluable tools for my research.

ccc

https://gist.github.com/cclauss/6349730 for a bit of hacking with pitch, yaw, and roll.

coolius

there's already a gyroscope function, but I would also love camera support

ungaa

The current scene.gravity() function provides the direction of the down vector (with a normalized magnitude), computed using a combination of the gyroscope and accelerometer readings. This is not what I am asking for.

The scene.gravity() function gives the output of the gravity function from the Core Motion CMDeviceMotion class.

The Core Motion CMDeviceMotion class can give a lot more processed values too:
These include:

  • attitude
  • rotationRate
  • userAcceleration
  • magneticField

Furthermore, for raw data:

I am asking for the additional calculated values offered by the CMDeviceMotion class, plus the raw readings from the accelerometer, gyro, and magnetometer.

ungaa

One more thing: it would be nice if one could get these readings without running a scene.

Perhaps you can create a motion module with a Motion python class that instantiates a CMMotionManager and sets it up to update the sensor readings at a user specified frequency. One could then call methods of the Motion python class to get the raw and calculated motion measurements.

omz

I have something like this in the works...

Webmaster4o

Yes, camera would be awesome.