Skip to content
This repository has been archived by the owner on Jun 25, 2019. It is now read-only.

Commit

Permalink
oscillate implementation
Browse files Browse the repository at this point in the history
La fonction oscillate permet de resonner en terme de pas et non de cycles pour faire osciller les servos...
  • Loading branch information
Resethel committed Oct 22, 2017
1 parent 02d952c commit 13d4b4d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 21 additions & 0 deletions Kubot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,27 @@ void Kubot::oscillateServos(int A[4], int O[4], int T, double Ph[4], float cycle
}
}

void Kubot::Oscillate(int A[4], int O[4], int T, double phase_diff[4], float steps)
{
attachServos();
setRestState(false);

float cycles = trunc(steps);

if(steps >= 1)
{

for(int i(0) ; i < cycles; ++i)
oscillateServos(A,O,T,phase_diff);
}

oscillateServos(A,O,T,phase_diff,steps-cycles);

}





////////////////////////////////////////////////
/// Homing: Controle de la position de repos ///
Expand Down
4 changes: 2 additions & 2 deletions Kubot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class Kubot

//-- Contrôle basique des servos
void moveServos(int duration, int servo_target[]);
void oscillateServos(int A[4], int O[4], int T, double phase_diff[4], float cycle);

void oscillateServos(int A[4], int O[4], int T, double phase_diff[4], float cycle = 1.0);
void oscillate(int A[4], int O[4], int T, double phase_diff[4], float steps = 1.0);
//-- HOME = Kubot à sa position de repos
void home();
bool getRestState();
Expand Down

0 comments on commit 13d4b4d

Please sign in to comment.