In this log I'll explain the algorithm I use to the control my VR shoes. Please refer to the following image.
When the rectangle is solid, that means that the user’s foot is on the motorized shoe. When a rectangle is dotted, that signifies that the user’s foot is in the air and the user is bringing the shoe forward (or to the side) along with their foot.
Step 1 is the starting position of the user, where they are standing still, shoulder-width apart. In step 2, the user starts taking a step forward. The right foot is in the air, and the motorized shoe is being brought forward along with the user’s foot. The sensor in the right shoe will detect an acceleration in the positive Y direction. The acceleration in the positive Y direction in the right shoe will trigger the left shoe’s main motor to turn on. The left shoe will be start moving backwards at the same speed the right shoe is moving forwards. The speed to use can be calculated by using the accelerometer data (integrating to get the velocity) or by using motor encoders. So put in other words, When the user takes a step forward with his right foot, the left foot is moved at the same speed in the opposite direction.
In step 3, the user has put their right foot down on the motorized shoe again. In step 4, the user lifts their left foot and begins moving it forward. Just like in step 2, when motion is detected in the left foot, the right foot’s shoe will start bring the right foot back at equal speed in the opposite direction.
In step 5, the user has brought their left foot down. Now the user decides to take one last shorter step, and then to stop. The shorter step is shown in step 6. In step 7, when the user brings their right foot down, she does not start to move their left foot. Since she doesn’t move their left foot, no motion in the left foot is detected, so the motors in the right foot’s shoe do not start up.
Let’s now imagine that in step 5, instead of the user taking another step forward, she decides to take a step to the side, as shown in below.
Shown in step 6, the user will lift their right foot and start moving it in the positive X direction. In step 7, the user has put their right foot down. In step 8, she continues their strafing to the right. She brings their left foot up and starts moving it I the positive X direction. Since motion in the left shoe is detected, the right shoe will start moving sideways in the opposite direction. In step 9, the user brings their left foot down.
An additional thing to consider with strafing and that I think I’ll need to incorporate into the algorithm is that, with strafing, the user’s feet should not crisscross. If the user lifts his right foot and moves it X distance to the right, the right foot’s shoe should not move back a distance greater than X.
Braking must also be considered in this algorithm. When the user is standing still, the motors should lock the wheels in place so that the user feels like he has stable footing. When the user is walking, for example, straight forward, the motor in charge of moving side to side will hold its position so that the shoe does not move to either side when it’s supposed to only move straight backwards. To detect the user lifting his feet, buttons will be on the top of the platform. When the buttons are compressed, the user’s foot is on the platform.
The algorithm, step by step, is as follows.
- When the user is standing still with both feet on the platforms, the motors should resist any motion.
- When the user lifts one of his feet to start walking, his foot will come off the platform. That will be detected by the buttons on the platform. This will cause that shoe’s motors to stop holding their position.
- A 2D vector will be constructed that indicates the direction and speed the user is moving his foot and the shoe in.
- The other shoe, where motion is not detected and the user has not lifted his foot, will have its motors activated so that the motorized shoe starts to move. It will move at the same speed as the other shoe, but in the opposite direction.
- When the user brings his foot that was in the air down, the buttons will be compressed. The distance the shoe moved will be stored.
- When the user starts to lift his other foot, the same process will occur. The shoe for the foot that is still on the ground will move in the opposite direction with the same speed. If the user is strafing, the shoe will not move more than the stored distance.
- When the user stops moving his foot that is in the air, or bring his foot down and does not continue to move it, the motors in both shoes will be stopped and they will hold their position again.
What I have just described is what I call the return to center algorithm. In reality, there will be some error in the process and the user could end up drifting away from his origin. To combat this I plan on retrieving the position of the headset in my code and using that position and the headset's original position to track where the user is and correct accordingly.
With VR shoes that can only go forward and backward, some sideways drift may happen and can't be corrected for. Unfortunately the user may need to correct his position from time to time. If the shoes have the ability to turn then a possible solution is to have the shoes turn a small amount with each step to move the user back to the center.