Hi, I'm new to this forum, just ordered my axon board and first time in robotics. While waiting
for my axon to arrive, I just look into the source files included for the axon.
This is an idea that i got while learning the axon source file and the webbot library.
Both of them are controlling the servos one at a time by sending a high signal, wait for
1ms - 2ms, send low signal and go to the next servo. This seems to limit the amount of servo that
can be controlled. EG. to contol 10 servo, it already waited for 10ms-20ms for the high
pulse. Already there's no time to wait for the low pulse. If you have 20++ servos then
maybe the duration of low pulse to each servo will pass the 20ms-40ms required by the servos.
This is only an idea that i just got, i post it here just to get opinions for it. maybe
some of you have already tried it and found that it's no good.
this is my code in theory. Please ignore any syntax error since the last time i wrote a program
was in 2002.
lets say we define a SERVO struct with 'Position' as it's element.
#define numservo = 20; //number of servos
struct {int Position}SERVO;
Then we define a group of servo our robot has:
SERVO servo[numservo];
in our robot controlling function, we modify the position of the servos:
void control(void){
servo[0].position = 1500; //1.5ms
servo[1].position = 1200; //1.2ms
servo[2].position = 1700; //1.7ms
etc.... up to 20 servos.
move_servos(); ---> then we call this function to move all the servos
}
move_servos();//this is the function that move all the servos at once
{
//get the position of servo with the highest 'Position' value.
max_servo_position = GetMaxServoPosition(servo);
//set pulse to all servo to HIGH
for(i1=0; i1<numservo;i1++){
SetServoPulseHigh(servo[i1]);
next i1;
}
//now its just a matter of setting the individual servo pulse to low to move it to a specific position.
reset_timer(timer1); --> set timer1 to begin at 0
t=0; //for timer1
while(t <= max_servo_position){ //repeat until the last servo has been moved
//get the current time
t = get_timer(timer1);
for(i1=0; i1<numservo; i1++){ //repeat for each servo
//if the servo high pulse is already passed the servo[i1].Position, turn the pulse to LOW
if (t>servo[i1].position){
SetServoPulseLow(servo[i1])}
next i1;
}
}
while(t<20000){t=get_timer(timer1);}//wait for the remaining of 20ms to end - even better if we can track how
many ms our main function uses.
}
So in this code you can see that it only take in theory max 2ms to signal all the servo and wait for the remaining
18ms to complete the 20ms cycle. I dont know how ms it takes for the uC to do the logics,while & for, but i belive it's
neglitible.
I've never tried this code since I just ordered my AXON last week and it's still in transit to Malaysia.
This is the first time I will do prgramming for robot so my idea could be just a crap.
I'm planning to build a 20servos hexapod robot. That's why I'm concern about max servo controlling capability.