Saturday, April 20, 2013

Turret Gun Robot - iPhone Control

The turret gun robot is up and running in a "teleoperated" mode using an iPhone as the controller.  The built in accelerometer on the iPhone has been mapped to control the drive motor powers.  As noted before, the OSC connection seems to work fine as long as the bug involving the motor power is screened out.  The Processing interface reports the sensor data (two encoders, three IR distance sensors, and a 6DOF gyro/accelerometer), shows the motor powers derived from the tilt of the iPhone, shows the gun status as on/off, and shows the pan/tilt of the turret by both printing the values and mapping them to a target bulls-eye   When Processing is set to 3D mode, the gyro values are mapped to a rotating cube which shows the orientation of the robot.  Since the robot can only rotate around a single axis, the cube rotates around the x-axis.  There are two movies below which show the processing sketch in 2D mode, then in 3D mode.

Processing in 2D Mode.

Processing in 3D mode:  Watch the rotating rectangle.
This project has been a long time in the making so I am very proud to have gotten this far.  The robot is pretty dumb for the amount of sensors it has, so I'll have to work on making it smarter.

Here is the link to the Arduino Code.  Note that I turned off the stall checks as they were giving false positive too often.  I will have to work on figuring out why that is.