2024-Group 9


Gold Miner Game.


Gold Miner Game

Project team member(s): Manaka Gomi, Lujia Liu, Camille Chungyoun, and Matthew Nguyen

We designed a gold miner game, where a rope with a gripper at the end can be used to grab gold or stone shown in the graphic display. The player controls the angle of the rope and gripper using a joystick, releases the gripper using a button, and reels back the gold or stone using a crank made from a modified Hapkit. Gravity and damping are simulated such that the density of the material, the angle of reeling, and the velocity of reeling affect the forces felt by the user. When the user reels in the gold, it will feel heavier than the stone (if they are the same size), and objects of the same material will feel heavier if they appear larger in the graphic display. The objective of this game is to simulate different weights of the object through force feedback and demonstrate a fun application of the haptics. The resulting implementation was successful, as users enjoyed the experience and could feel the difference between the forces.

Introduction

The motivation for this project was to determine the forces and dynamics required for different materials being reeled in the gold miner game. We calculated the torque required to render the weight of the gold/stones on the Hapkit, which depends on the density of the material (gold or stone), the size of the material, and the angle of reeling. In addition to the weight, we also added damping to the reeling to display the force from the dirt. We chose this study because analyzing these properties of our system made the haptic renderings more realistic for the user.

Background

Haptic devices are commonly used in digital games to immerse the user in the virtual environment, increase player engagement, and enhance the game experience. These haptic games have applications not only in the gaming industries but also in game-based learning, healthcare, and rehabilitation [1]. Rehabilitation games with haptic force feedback offer various advantages: providing force feedback while analyzing movement, offering a safe environment, and making rehabilitation enjoyable and motivating [2]. A literature review suggests that using haptic feedback games in hand rehabilitation for stroke patients has positive effects, aiding in motor and functional recovery [3].

These studies motivated our project to create haptic feedback for the Gold Miner game. The haptic feedback allows users to become immersed in the gaming environment of the Gold Miner game, enhancing their experience. The game requires dexterous control of the joystick to determine the angle of the crank. Users also need to apply force to the crank to reel back objects. Through those haptic feedback in the game, we attempted to train the user's hand dexterity and motor skills.

Methods

Hardware Design and Implementation

The system consists of one gear hapkit, one joystick, and a button. The gear hapkit system includes a 3D-printed base, small gear, large gear, two hex head shafts, a crank, and one motor, as shown in the figure below. The capstan transmission from the hapkit was modified to 3D-printed gears to achieve unlimited rotations of the crank. The small gear is directly glued to the shaft of the motor, and the large gear is connected to a 3D-printed hex head shaft, which is also connected to a 3D-printed crank. The user holds the crank to rotate the gears, which reel back the stone/gold. As same as the hapkit, the small gear has a semicylindrical slot for holding the magnet, which was used to sense the rotation by the magnetoresistive sensor on the hapkit board. The Arduino board was mounted at the same distance as the motor and the Arduino board on the hapkit. The crank was attached to the motor side of the hapkit to avoid collision between the hapkit board and the crank. The bearing from the hapkit handle was inserted into the base to create a smooth rotation of the large gears. The two hex heads were connected by a stainless steel D-shaft, which was inserted inside the bearing.

System Dynamics Analysis and Implementation

The system dynamics analysis is shown above. In the implementation, we removed the acceleration term because it caused instability in the system. Also, the weight terms of the different materials and sizes were scaled down so that they could be rendered using the motor. Due to the extreme difference in densities, we also had to use different scaling factors for each material type to ensure that all of the forces could still be felt by the user.

Arduino Algorithm and Force rendering

The provided Arduino code controls a haptic interface, simulating realistic interactions by processing sensor data and implementing control algorithms. It initializes various variables and sets up input and output pins for sensors and the motor. The main loop reads the MR sensor's position and processes this data to account for flips over 180 degrees, ensuring accurate tracking. This position is converted into a distance measurement (xh), representing the handle's position in meters.

The code computes the handle's velocity (dxh) and acceleration (ddxh) using differences in position over time, smoothing these values with an IIR filter. Force rendering involves two states: the landing state and the gameplay state. In the landing state, a spring-like force is applied based on handle position. In the gameplay state, pressing the button starts a new run, setting a target angle (final_angle) and searching for objects within a catchable angle range. If an object is found, its path length and weight are set; otherwise, values are calculated for catching "air."

Force computation depends on handle position and object status. If the handle is within the path length and the object isn't caught, force is zero. Once caught, the force includes the object's weight and damping terms. Motor control adjusts direction and duty cycle based on the computed force, providing realistic haptic feedback.

Graphics

The Processing code displays the entire environment, including the sky, dirt, gripper, and materials to be captured, and the final graphic is shown in the image below. It includes calculations of gradients of colors to make the display more realistic. Additionally, the angle ranges and rope distances for which each material could be captured are calculated using geometry based on hard-coded initial locations of each material and each material's hard-coded radius. The code takes in the angle and length of the rope being sent from the Arduino code. The code also keeps track of the state of each material (uncaptured, currently being reeled, or captured) to determine which materials to draw and whether or not the position of the material is changing. Once a material is captured, the score increases accordingly, with the small stone being 20 points, large stone being 40 points, small gold being 50 points, and large gold being 100 points. Please see the attached PDF of the Processing code in the Files section for reference.

Results

During the open house, we had participants try to get the highest score they could within 45 seconds. We had 16 total participants attempt the timed game, and the highest score was 380. All 16 participants felt different forces for different sizes, 12/16 participants felt the different forces for different materials, and 8/16 participants felt different forces for different angles. The average realism score was 4.5/5 and the average stability score was 4.8/5. The general feedback was very positive, and the participants had fun playing the game. All of the qualitative and quantitative results are in the spreadsheet in the Files section.

Here is a video of a participant playing the game: Attach:Group-09-6.MOV

Future Work

To improve the system, a stronger motor could be used to expand the range of forces that could be rendered. This would provide a higher degree of realism since the density of gold is so much larger than that of stone. Another improvement would be to make the difference in rendered forces due to the angle more noticeable, which would also be more possible if a stronger motor were used. To make the game more interesting for the user, we could use a random initialization of the material positions in the graphic display and use a greater variety of types of materials. A possible improvement to the Arduino code would be to change the algorithm so that it doesn't require that the user touches the gripper to the wall to start the next round if no material is caught.

Files

Spreadsheet with demonstration feedback: Attach:DemoResults.xlsx

PDF of Processing Code: Attach:FinalProcessingCode_goldminergame.pdf

Spreadsheet with components and costs: Attach:ComponentsSpreadsheet.xlsx

STL files for 3D-printed parts: Attach:ProjectSTLFiles.zip

Arduino Code: Attach:9_Arduino_PDF

References

[1] Tokuyama, Y., Rajapakse, R. J., Miya, S., & Konno, K. (2016, July). Development of a whack-a-mole game with haptic feedback for rehabilitation. In 2016 Nicograph International (NicoInt) (pp. 29-35). IEEE.

[2] Gutierrez, A., Sepulveda-Munoz, D., Gil-Agudo, A., & de los Reyes Guzman, A. (2020). Serious game platform with haptic feedback and EMG monitoring for upper limb rehabilitation and smoothness quantification on spinal cord injury patients. Applied Sciences, 10(3), 963.

[3] Choukou, M. A., Mbabaali, S., Bani Hani, J., & Cooke, C. (2021). Haptic-enabled hand rehabilitation in stroke patients: a scoping review. Applied sciences, 11(8), 3712.


Appendix: Project Checkpoints

Checkpoint 1

The checkpoint 1 goals are listed below, and all of the goals were met:

■ Finish creating graphics background and stationary gold/stone

■ Finish CAD design of crank mechanism

■ Finish determining required connections of the two hapkits

■ Finish selecting a button

Finish creating graphics background and stationary gold/stone: We designed the graphic environment by representing gold as yellow spheres, stone as grey spheres, and the dirt as a light brown rectangle. The graphic environment also includes the spool of the rope and the sky background. The position of the rope and gripper depends on two parameters: the angle and the length of the rope. Since this is the stationary graphic environment, these two parameters currently have hard-coded values. An image of the current stationary environment is shown below.

Finish CAD design of the crank mechanism: We designed a gear system for the transmission and crank mechanism. The small gear will be attached directly to the motor shaft. We will print the first prototype and make adjustments by the next checkpoint. The torque T required to produce force F at the crank can be calculated using the following equation: gear A is attached to the shaft, and gear B is attached to the crank.

 

Finish determining required connections of the two Hapkits: Since we are now using a joystick button (see below) instead of a second Hapkit, we no longer need to determine connections between two Hapkits. Thus, we have begun developing Arduino code that will allow us to use input from the joystick button as well as from one Hapkit.

Finish selecting a button: We picked the button shown below, which is joystick and button. This will allow us to use the joystick to change the angle of the rope and gripper, eliminating the need for a second Hapkit. When the user presses the button, it will cause the length of the rope in the graphic to extend, allowing the gripper to grasp any gold or stone in its path.

Checkpoint 2

The checkpoint 2 goals are listed below, and all of them have been met:

  • Finish 3D printing and implementing crank
  • Finish calculations of required torques for different materials and different sizes
  • Finish implementing button
  • Finish processing code to move the position of the gripper and the angle of the rope in the graphic display

Finish 3D printing and implementing crank: The following figure shows the latest 3d printed gears. The dimensions of the hex shafts and crank have been changed for the next version of the printing.

Finish calculations of required torques for different materials and different sizes: We have decided to start by rendering each force as constant, and then we will render more complex forces if time allows. To determine the specific force values for each material and size, we assumed that all of the materials are spherical and assumed that they are being reeled in at a constant velocity. We also assumed that the large materials have a radius of 50 mm (since they have a radius of 50 pixels in the Processing code), and the small materials have a radius of 25 mm (since they have a radius of 25 pixels in the Processing code). For simplicity, we also assumed that each material is being pulled straight up when rendering the forces. Then, we used the fact that the density of gold is approximately 19,300 kg/m^3 and the density of stone is approximately 1602 kg/m^3. The full analysis is shown below. As next steps, the forces will be scaled down so that they can be realistically rendered using our haptic device, and the angle of reeling will be taken into account when determining the forces.

Alternate torque calculation: The following process for calculating torques simulates reeling in the gripper and materials with damping. The gripper and materials are given separate force contributions so that different haptic feedback is rendered when material is grabbed versus when no material is grabbed. Several parameters will need to be determined experimentally to get the right haptic experience and ensure that the motor does not oversaturate. A next step to improve the haptic experience could be to add a "handle shake" which is rendered when the gripper grabs a material, gets fully reeled in, or hits the edge of the display window. A fast shaking motion could introduce device instability, therefore, we could incorporate controls analysis to limit this instability.

Finish implementing button: Both the button and the joystick have been tested and implemented, as shown in the image below.

Finish processing code to move the position of the gripper and the angle of the rope in the graphic display: As shown in the videos attached below, the Processing code is now able to change the angle of the rope and the position of the gripper in the graphic display. Additionally, several other new features have been added. First, as shown in the image attached below, the angle ranges and rope distances for which each material could be captured have been calculated using geometry. Additionally, the Processing code keeps track of which materials have been captured and increases the score based on the type and size of the material. The captured materials also now move with the gripper as it is being reeled in. Please see the attached PDF of the Processing code below for reference.

Attach:Checkpoint2_ProcessingCode.pdf

Attach:Checkpoint2Video_GraphicsAngle.mp4

Attach:Checkpoint2Video_GraphicsReeling.mp4