Haptic Gaming System

From Mech
Jump to navigationJump to search

Overview

Haptikos is an interactive gaming system that allows the user to physically feel a virtual world. The player controls the cursor by moving the red joystick. Two games were created to test the feedback system. The first, the player assumes the character of LINK (from Zelda) and jumps through a side-scrolling level collecting rupees and avoiding red boxes. The second involves feeling out the virtual shape with nothing other than a blue position dot and a blank screen. The answer can be seen by pushing R.

Haptikos.jpg

The Team

  • Yang Bai (Mechatronics Masters Student)
  • Philip Dames (Mechanical Engineering MS/BS)
  • Megan Welker(Mechanical Engineering BS/BM)
Team22haptics.jpg


Mechanical Design

Existing System

Haptikos is a modification from a previous pentagraph configuration. This allows for the free point to be able to freely move in a fixed two-dimensional plane. There are two Canon TR-36 optical encoders with a 3600 count/rev in x1 mode mounted on top of the stationary pivot.(see below) They are used to track the angle of the larger bars and calculate the position of the free point.

EncodersTeam22.jpg

System Modifications

The existing system had the capability to accurately tell where the free point was in space, but could not put any force on that point. A Pittman 700935 motorwas attached to each of the larger bars in the back of the pentagraph using a capstan configuration.

The capstan was created by milling two arcs out of Aluminum and then attaching one arc end to the furthest point from the backboard on each bar. A piece of heavy duty thread was set into the groove of the outer side of the arc and secured by screws on either side. To connect the capstan to the Motor, the thread was merely wound around the shaft three times and replaced tight into the groove. (see below)

The gear ratio the arc applies to the motor is approximately 14.7 to 1. (Radius of arc/ Radius of Capstan Drive)


Arc.
Thread and Motor attachment.


Electrical Design

The five boards created to run Haptikos



Overall.png
Circuitry.




PIC Configuration

PICWiringTeam22.jpg

Whatever this is

what it does

its circuit


Circut1Team22meg.jpg
PictureofCircut1Team22.jpg
2PictureofCircut1Team22.jpg


Decoder

what it does

its circuit


Circut2Team22meg.jpg
PictureofCircut2Team22.jpg


Motor Control

how it controls it

its circuit


MotorControlCircutTeam22.jpg
PictureofMotorControlCircutTeam22.jpg


Pre-Programming Anaylsis

Philip would you like to put some of the mathematica code here, can we capture those graphs? I shall look into it...


Software

PIC Programing

All PIC programming was done in C using the MPLAB IDE by Microchip Technologies. To install MPLAB, follow the instructions found here. To create a new project in MPLAB, follow the instructions found here. The source files for our project can be downloaded here (remember to change the include directions if you are trying to use our MPLAB project files).

While the source code is commented, here is a list of the project-specific files and a brief summary of the contents of each.

  • fingerTrack.c - This is the main file of the project, containing the main function as well as initialization and communication functions
    • initEncoder - This initializes the 4 timers (T2CK - T5CK) used to count the up and down pulses from the decoding circuit. Timers 2 and 3 are for the up and down counts of encoder 1, respectively. Timers 4 and 5 are used for up and down counts of encoder 2.
    • getEncoderPositionX - This reads the current counts of encoder X and updates the angles, checking for rollover of the 16-bit counters.
    • initUART1 - This initializes the UART1 bus of the PIC to be used for RS-232 communication with the PC.
    • initInterruptComm - This initializes the Timer1 interrupt to run every 10ms and initializes both I2C buses on the PIC to talk to the DAC's. The interrupt timing could be synched to match the frame rate of the game, but we found this to be reliable and not interfere with the data transmission interrupt.
    • MAX518 - This takes the data sent from the PC about how to force the system, parses the data, and sends out the appropriate signal to the DAC's over the I2C buses. Only 1 byte of data is sent between the PC and the PIC as this was found to be the most reliable, though it does limit the resolution of forces we are able to achieve (16 levels instead of 256). We did not find this to be a problem, but is one area of possible improvement.
    • UART1 interrupt - When it detects that it has received data from the PC, the PIC will read the data, call the MAX518 function, and toggle LED0 for visual feedback. We had some issues with the interrupt not functioning correctly after the game was reset after a game over (this did not happen every time).
    • Timer1 interrupt - This sends the current (x,y) position of the finger as well as the two angles of the encoders to the PC.
  • calculations.c (and .h) - This library has the functions used to calculate the forward kinematics of the pantograph (i.e., to get finger position from the encoder readings).
    • sine and cosine - These functions take in the current encoder angle (measured to the nearest tenth of a degree) as an integer and use a lookup table to calculate the sine. The output is an integer which must be divided by 10000 (the global variable SCALER). This was done to speed up calculations as it only involves integer math instead of floats, and can directly use encoder counts instead of converting these to radians.
    • forwardKinematics - This calculates the current (x,y) location of the finger based on the current encoder readings.


Game Programming

The games are programmed and run in processing. It can be downloaded here. Processing

Link's Adventure

This demo allows the player to run through a simple avoid and collect game set-up. Link can collect either red rupees that will increase his health, green rupees to increase his score, or blue rupees to slow the increasing speed of the red blocks. When Link runs into a red block, Haptikos will quickly push the joystick in the direction that the box was traveling then stop as the box disappears. It is very effective in telling the player they have hit something, but not very effective at keeping the player from repeatedly running into the boxes because it is more fun.

LinksAdventureTeam22.jpg

Below is the code from the Processing file

Identity Game

This demo allows the player to try to identify the shape (circle, star, triangle, square, diamond) blindly using only the feedback from Haptikos and a blue dot that represents the cursor. When the blue dot approaches the edge of the box, Haptikos will push the cursor the opposite direction it was traveling.

The shape and the cursor

IdentiyGame.jpg


Below is the processing code

Further Reading