NYP_Humanoid_robot_FYP_2018

Dependencies:   LSM6DSL

Fork of b_NYP_humanoid by Junjie Wang

servo.cpp

Committer:
mr_wang
Date:
2018-06-05
Revision:
5:1faeeab28bd1
Parent:
4:99891561a38b

File content as of revision 5:1faeeab28bd1:

#include "mbed.h"
#include "kondo1.h"
#include "kondo2.h"
#include "kondo3.h"
#include "servo.h"
extern EventQueue KONDO1_queue;
extern EventQueue KONDO2_queue;
extern EventQueue KONDO3_queue;
double KODNO1_degrees1[] = {0,10,5,28,10,23,2};
double KODNO1_degrees2[] = {10,10,10,10,10,10,10};
double KODNO2_degrees1[] = {0,0,0,0,0,0,5,0,4,15};
double KODNO3_degrees1[] = {15,15,15,15,15,15,15,15,15,15,15,15,-22,-19,20,-10,0,15};
/*double KODNO3_degrees[] = {15,15,15,15,15};
double KONDO3_Degrees_Initial[] = {0,0,0,0,0,0};
double KONDO3_Degrees_Target[KONDO3_MAX_TOTAL];
double KONDO3_Newdegree = 5;*/

void KONDO1_Degrees_Set()
{
        KONDO1_queue.call(KONDO1_Positions_Set,KODNO1_degrees1);         
}
void KONDO2_Degrees_Set()
{
        KONDO2_queue.call(KONDO2_Positions_Set,KODNO2_degrees1);
}
void KONDO3_Degrees_Set()
{
        KONDO3_queue.call(KONDO3_Positions_Set,KODNO3_degrees1);
}
/*
void KONDO2_Degrees_Set()
{
    while(1)
    {
        unsigned char i;
        unsigned char id;
        for(i=0;i<=sizeof(KONDO2_DegreeOrder);i++)
        {
            id = KONDO2_DegreeOrder[i];
            KONDO2_Degrees_Target[id] = KONDO2_Degrees_Initial[id] + KONDO2_Newdegree[id]; 
//            KONDO2_queue.call(KONDO2_Positions_Set,KONDO2_Degrees_Target);
        }
    }
}*/
/*void KONDO3_Degrees_Set()
{
 while(1)
    {
        unsigned char id;
        for(id=0;id<=5;id++)
        {
            KONDO3_Degrees_Target[id] = KONDO3_Degrees_Initial[id] + KONDO3_Newdegree;
            KONDO3_queue.call(KONDO3_Positions_Set,KONDO3_Degrees_Target);
        }
        KONDO3_Newdegree = KONDO3_Newdegree + 10;
        id=0;
        wait(2);
    }
}*/