Introduction

Following in the footsteps of my previous article, it would have been improper not to take on the task of xamlizing a four-legged creature. In short, I decided to work on a WPF project that replicated a walking four-legged animal.

Requirements

To run the project provided from the download link above, you require either of the following:

NB: Ensure that you open the solution using Visual Basic Express if you're using the Express edition of Visual Studio.

Avalona

How It Works

To make Avalona walk, just press the right arrow key. Avalona will amble on a treadmill, this time the action taking place inside the M Labs Animaloid Research Centre.

Ambling

The amble is an easy gait (way of walking), most common in horses, where at least one leg/hoof touches the ground during the phases of motion. There is no suspension phase, i.e., a phase where all the legs are entirely off the ground. This was the primary reason I decided to replicate the amble. During this gait, a maximum of two legs can/will support the weight of the animal. The following sequence of photographs show the phases followed during this gait.

A short and detailed explanation of the phases of movement shown above can be found here.

There are 11 phases in the photos above, which are a bit of a handful, so I narrowed it down to 5 phases which would offer me equally suitable results.

From the initial sequence of photos, I chose the 4th, 5th, 6th, 7th, and 9th phases.

Design and Layout

I designed Avalona, Treadmill, and the Lab_Screen in Expression Design. The rest of the elements were added in Expression Blend. The following image shows the layout of the elements of concern and their names (the same applies to the left legs),

NB: The center of the joints of each section of Avalona act as center points.

Leg Movement

The standing posture of Avalona and that of a horse are slightly different. Avalona's limbs are more slightly angled especially those of the hind legs.

This presented a bit of a challenge in my attempt at replicating the amble. Because of this difference, Avalona's gait is a slightly modified version of a horse's amble.

In order to get a better picture of how to proceed, I drew stick figures of the ambling horse and then drew stick figures of a ambling Avalona, taking into account their differences in standing posture. I then adjusted the elements of concern in Expression Blend, at positions similar to those of the stick figures, noting down the angles which I felt would offer suitable results. These were the results:

The Code

The calculations that provide us with the necessary wizardry are found in the module MovementCalculations:

In the method above, method calls are made based on the values of various variables, of Boolean type. The RightHindBack method rotates the various sections of Avalona's legs from the standing position to Phase 3. It later alternates to rotating elements from Phase 1 to Phase 3.

Extra Resources

I'm sure that Avalona can do more than just amble. It can run, walk,... maybe even swim. If you are of the same opinion and have the time and interest, the following resources could prove to be useful:

Conclusion

I hope you enjoyed reading the article and taking Avalona for a walk, even if it was only on a treadmill. Stay tuned for the next episode when the Speedster, Xaml Man, and Avalona join forces in an epic battle against Winn Fommz... just kidding. If you want to add some enhancements to Avalona, the doors of the M Labs Animaloid Research Center are wide open once you download the source files and open the solution. Cheers!