-
Notifications
You must be signed in to change notification settings - Fork 1
4. Wheel Motion: 4 modules.
The wheel motion is a simple but cool motion which can be done with 4 Dtto modules. It consists of 2 stages, and switching between these two stages causes the wheel to move. Our program is written with the wheel forming such that all the modules' power switches are on the outside.
Initially, on running prepare_wheel()
, the modules move to their starting positions. After this attach all the modules together and hook them to each other by sending ahb1
to the master. Then sending 1wr
causes the wheel to move.
As seen in the image above, 4 states are depicted. The starting state has module 1 set at angles (male, female) = (0, 0), module 2 at (90, -90), module 3 at (0, 0) and module 4 at (90, -90).
When we move from state 1 to state 2, note that all the female hinge angles remain in the same position while the male angles at 90 go to 0, and 0 goes to 90.
From state 2 to state 3, all male hinge angles remain in the same position while the female angles at -90 go to 0, and 0 goes to -90.
From state 3 to state 4, all female hinge angles retain their positions while the male angles change positions.
We can observe a pattern in this: At every run, either the male or female angles retain their positions and its counterpart switches position between 0<->90 for males and -90<->0 for females. (Note: -90<->0 for males and 0<->90 for females would require the wheel to be inside out,i.e. wheel formed when the power switches are on the inside)
So, our run_wheel()
program is basically this:
run_wheel(){
if(odd_run){
retain_male_angles;
not_female();
}
if(even_run){
retain_female_angles;
not_male();
}
wheel_run_count++; //Used to differentiate betwwen odd and even runs
}