Happy Memorial day for those in the US otherwise Happy Monday. Ok did some more playing with that crazy pseudo gait that I am using for testing and Servo timing and communication. Found one interesting thing:
- After you send the command to move the 3 leg servos it takes at least 450ms to to get the checkstatus to return all true with out getting stuck in the loop waiting on movement complete.
Now this is really going to be contigent on the gaits but more on that later first there is the LA trace:
First group on the first line is the tx of the movement commands the next set of traces on the 1st line are the check status for the 3 servos. The second line is the response - notice (not easy) but all three response come back as holding right away.
Now this is all contingent on my test case for actual movement which no one seems to be able to give me a good gait sequence yet. But here are the particulars for the servo setups and commands:
//====================================
//set MJS RF config Gait Test Values
//====================================
#define RF_COXA_MaxSpeed 600
#define RF_COXA_Gyre LSS_GyreCounterClockwise
#define RF_COXA_Offset 0
#define RF_FEMUR_MaxSpeed 600
#define RF_FEMUR_Gyre LSS_GyreCounterClockwise
#define RF_FEMUR_Offset 700
#define RF_TIBIA_MaxSpeed 600
#define RF_TIBIA_Gyre LSS_GyreCounterClockwise
#define RF_TIBIA_Offset 190
//Time delays for Gait MoveT commands
uint16_t delay1 = 450;
uint16_t servo_move_time = 250;
//================================================================================
// RF leg array pins
uint16_t rf_ids [] = { RF_COXA, RF_FEMUR, RF_TIBIA };
int16_t rf_rip6_gait [5][3] =
{
{-48, 11, 110}, //Start position 1 - start position
// -4.8, 1.1, 11 degrees
{-26, 3, 51}, //position2
//-2.6, 0.3, 5.1
{ 0, 0, 0}, //position3
// 0, 0, 0
{ 31, 3, -44}, //position4
// 3.1, 0.3, -4.4
{ 67, 10, -82} //position5 - end position
// 6.7, 1, -8.2
};
//=================================================================================
void generateGait()
{
for(uint8_t count = 0; count <1; count++) {
for(uint8_t position = 0; position < 5; position++) {
for(uint8_t ids = 0; ids < 3; ids++){
myLSS.setServoID(rf_ids[ids]);
myLSS.moveT(rf_rip6_gait[position][ids], servo_move_time);
}
delay(delay1);
checkStatus();
}
}
//leg up start position
//6.7, -31.2, -34.3
myLSS.setServoID(RF_COXA);
myLSS.moveT(67, servo_move_time);
myLSS.setServoID(RF_FEMUR);
myLSS.moveT(-312, servo_move_time);
myLSS.setServoID(RF_TIBIA);
myLSS.moveT(343, servo_move_time);
delay(delay1);
//Serial.println("Position Start Leg Up: ");
checkStatus();
GetServoPositions();
}
void checkStatus()
{
int8_t status1 = -1, status2 = -1, status3 = -1;
uint32_t statusTime = 0;
while(status1 != 6 || status2 != 6 || status3 != 6) {
myLSS.setServoID(RF_COXA);
if(status1 != 6) status1 = myLSS.getStatus();
myLSS.setServoID(RF_FEMUR);
if(status2 != 6) status2 = myLSS.getStatus();
myLSS.setServoID(RF_TIBIA);
if(status3 != 6) status3 = myLSS.getStatus();
delay(2);
statusTime += 2;
}
//Serial.printf(“Status: %d: %d, %d, %d\n”, statusTime, status1, status2, status3);
}