Calum Johnston / Gait

Dependents:   Hexapod_Library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Gait.cpp Source File

Gait.cpp

00001 #include "Gait.h"
00002 
00003 
00004 Gait::Gait(Tripod tripod_1, Tripod tripod_2) :
00005 
00006     group_1(tripod_1),
00007     group_2(tripod_2)
00008 
00009 {
00010 
00011 }
00012 
00013 void Gait::time_1(void)
00014 
00015 {
00016     tripod_2_timeout.attach(this, &Gait::time_2, 0.4);
00017     group_1.gait_smooth();
00018 
00019 }
00020 
00021 
00022 void Gait::time_2(void)
00023 
00024 {
00025     tripod_1_timeout.attach(this, &Gait::time_1, 0.4);
00026     group_2.gait_smooth();
00027 
00028 }
00029 
00030 
00031 void Gait::start(int group)
00032 
00033 {
00034     switch(group) {
00035         case 1:
00036             tripod_1_timeout.attach(this, &Gait::time_1, 1);
00037             break;
00038         case 2:
00039             tripod_2_timeout.attach(this, &Gait::time_2, 1);
00040             break;
00041         default:
00042             break;
00043     }
00044 }
00045 
00046 
00047 void Gait::stop(void)
00048 
00049 {
00050 
00051     tripod_2_timeout.detach();
00052     tripod_1_timeout.detach();
00053 
00054 }
00055