Software > Software

webbotlibs gait designer

(1/2) > >>

RifRaf:
Hello, have been using webbotlibs for a week now with great success, considering I have very basic coding abilities.  Am a little puzzled as to the setup for the gait designer on the avr side. 

Have setup the code as best I could from reading the docs, the code compiles, can connect from gait designer and see data on the rx led, but no servos move, the 3 servos are on ports PB0 PB1 and PB2 of an atmega168 .

The project was setup with project designer but the uart was the only device i added, if i added the servos in project manager would not compile. can send test text stream from avr and see it in putty at 112500 baidrate. any advice would be welcome on how to debug it.


--- Code: ---#define UART0_RX_BUFFER_SIZE 40
#include "hardware.h"
#include <Gait/GaitDesigner.h>
#include <servos.h>
#include <rprintf.h>
 
SERVO servo1 = MAKE_SERVO(false,B0,1500,650);
SERVO servo2 = MAKE_SERVO(false,B1,1500,650);
SERVO servo3 = MAKE_SERVO(false,B2,1500,650);
static SERVO_LIST PROGMEM bank1_list[] = {&servo1,&servo2,&servo3};
SERVO_DRIVER bank1 = MAKE_SERVO_DRIVER(bank1_list);
 
ACTUATOR_LIST PROGMEM all[] = {&servo1.actuator,&servo2.actuator,&servo3.actuator };

GAIT_DESIGNER gait = MAKE_GAIT_DESIGNER(all, UART0, (BAUD_RATE)115200);

void appInitHardware(void){
  servoPWMInit(&bank1);
  gaitDesignerInit(&gait);
  rprintfInit(&myUartSendByte);
}

// Initialise the software
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
return 0;
}

TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart){
  gaitDesignerProcess(&gait);
  //rprintf("hello "); //to test loop is working
  return 0;
}

--- End code ---

RifRaf:
ok so I must have been reading to much into it, let project manager do the servos instead, and had to refer to then as _servo1_ instead of servo1 etc.  This is the working code, this is gonna be so cool to use now.


--- Code: ---#include "hardware.h"
#include <Gait/GaitDesigner.h>
// The gait designer however expects a single list of all the servos to be controlled
ACTUATOR_LIST PROGMEM all[] = {&_servo1_.actuator,&_servo2_.actuator,&_servo3_.actuator };

// 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, UART0, (BAUD_RATE)115200);

// Initialise the hardware
void appInitHardware(void) {
gaitDesignerInit(&gait);  //Start Gait Designer
initHardware();
}
// Initialise the software
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
return 0;
}
// This is the main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart) {
    gaitDesignerProcess(&gait);

return 0;
}

--- End code ---

Gertlex:
Sounds like you've been successful?

I'm not sure what the underscores accomplish, but the 2nd version of your code looks fine.  It's a fun little setup :)

RifRaf:
Getlex yes is working great now thanks, no idea why but the underscores helped.  Have made a little arm to test with and having great time testing with it.

images of arm http://imagebin.org/245098  http://imagebin.org/245167 and a short video of it working with gait designer, 6 x sg90servo arm and gripper

What I cannot work out is how to extend the length of the animation past the default 6 seconds or so? 

Is this possible because once too many movements are added the servos have to move too fast in the time allowed if that makes sense.?  Shortening the animation as well for things that might just be closing a gripper would be cool too.

Webbot:
Looks good to me.

When you play the animation there is a DRIVE_SPEED parameter - this should change the duration of the animation. (Haven't looked back at my code for a while so please be patient if I'm wrong).
 
Don't forget that you can string animations together - ie have a different animation for closing the gripper, opening the gripper etc.

Navigation

[0] Message Index

[#] Next page

Go to full version