WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation

GaitDesigner.h

Allows you to connect your servos to a computer running Gait Designer (downloadable from http://webbot.org.uk).
To use the gait designer you need to define all of your servos as normal. For example on my Brat biped I have split the servos into two banks - one for the left left and another for the right leg:-
#define UART1_RX_BUFFER_SIZE 40
#include <sys/axon2.h>
#include <Gait/GaitDesigner.h>
#include <servos.h>
#include <rprintf.h>
 
SERVO servo1 = MAKE_SERVO(false,B5,1500,650);
SERVO servo2 = MAKE_SERVO(false,B6,1500,650);
SERVO servo3 = MAKE_SERVO(false,B7,1500,650);
static SERVO_LIST PROGMEM bank1_list[] = {&servo1,&servo2,&servo3};
SERVO_DRIVER bank1 = MAKE_SERVO_DRIVER(bank1_list);
 
SERVO servo4 = MAKE_SERVO(true,E3,1500,650);
SERVO servo5 = MAKE_SERVO(true,E4,1500,650);
SERVO servo6 = MAKE_SERVO(true,E5,1500,650);
static SERVO_LIST PROGMEM bank2_list[] = {&servo4,&servo5,&servo6};
SERVO_DRIVER bank2 = MAKE_SERVO_DRIVER(bank2_list);
The gait designer however expects a single list of all the servos to be controlled. This can be done by:-
ACTUATOR_LIST PROGMEM all[] = {&servo1.actuator,&servo2.actuator,&servo3.actuator,
   &servo4.actuator,&servo5.actuator,&servo6.actuator };
The order of the servos in this list should remain the same once you start using Gait Designer. However you can continue to change the servo banks or whether you are using hardware or software PWM.
The final step is to create an object that is used to talk to the Gait Designer program on the computer specifying the list of all the servos and the uart and baud rate:-
GAIT_DESIGNER gait = MAKE_GAIT_DESIGNER(all, UART1, (BAUD_RATE)115200);
In your appInitHardware you need to initialise the servos and rprintf just as normal. But you also need to initialise the gait object:-
void appInitHardware(void){
  servoPWMInit(&bank1);
  servoPWMInit(&bank2);
  gaitDesignerInit(&gait);
  rprintfInit(&uart1SendByte);
}
The final step is to regularly call the gait object from your main loop so that incoming messages get processed:-
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart){
  gaitDesignerProcess(&gait);
  return 0;
}
You are now ready to run the Gait Designer application to design the gait. Once you have finished the design you can export it from Gait Designer by using the File | Export menu option. This will create an H file containing all of the animations in the design.
You are now ready to use GaitRunner.h so that the robot can play the gait without the connection to the PC.

 

Function

 


void gaitDesignerInit(GAIT_DESIGNER* gait)

Initialise the gait program.
This will initialise the uart to the correct baud rate and start listening to commands from the Gait Designer program on the computer.
Call this once - from your appInitHardware

void gaitDesignerProcess(GAIT_DESIGNER* gait)

Process commands from the computer.
You should call this method from your main loop. It will process all new messages from the computer and move the servos accordingly.

Valid XHTML 1.0 Transitional