PDA

View Full Version : [Question(s)] Arbotix problems with pose servo position



muc
02-19-2010, 12:33 PM
I need help. My servos do not go to "stand" position after I download my sketch to the arbotix board. Some fly to their mechanical stop. This is my first experience with arbotix board and arduino. This is what I have done so far.

1. confirmed xbee modules communicate between computer and arbotix
2. used PyPose to set and save "stand" pose for 8 AX-12
3. exported to AVR, saved file as "poses" in arduino sketches folder
4. uploaded below sketch to arbotix that should move servos to "stand" position


--contents of sketch--

#include <ax12.h>
#include <BioloidController.h>
#include "poses.h"

// we always need to create an instance of the bioloid control, usually with baud = 1Mbps.
BioloidController bioloid = BioloidController(1000000);

// stand up
void setup(){
delay(100); // recommended pause
bioloid.loadPose(stand); // load a pose (named "stand") from FLASH into buffer
bioloid.writePose(); // write the buffer to the servos
}

void loop(){}



--contents of poses.h--

#ifndef EBOT_POSES
#define EBOT_POSES
#include <avr/pgmspace.h>
PROGMEM prog_uint16_t stand[] = {8, 683, 467, 394, 532, 652, 509, 308, 501};

#endif

lnxfergy
02-19-2010, 12:59 PM
So, here's the deal: we aren't really directly calling writePose since we created the interpolation engine. There's actually two buffers now: pose and nextPose... load fills in nextPose, and the interpolation engine slowly moves the values in pose to become the desired values of nextPose. Our docs do appear to be out of date (as I'm writing this response, I'm fixing the errors). I would change your setup to be:


// stand up
void setup(){
delay(100); // recommended pause
bioloid.loadPose(stand); // load a pose (named "stand") from FLASH into nextPose buffer
bioloid.readPose(); // load the actual values into pose buffer
bioloid.interpolateSetup(500); // interpolate from current position to standing in 1/2 of a sec (500ms)
while(bioloid.interpolating > 0)
bioloid.interpolateStep(); // actually update values in pose, and do bus write
} This has several advantages, first off, it actually will work. But, most importantly it moves the bot to a known position slowly. If the bot is tangled up when you power it on, it'll jump to standing quickly doing a direct write, which could cause it to rip itself apart. (DAMHIK)

Sorry for the confusion, and thanks for the excellent bug report.

-Fergs

muc
02-19-2010, 01:50 PM
thanks Fergs,

What you posted would not compile. Do I have an outdated BioloidController.h file?

This worked for me. Legs interpolate to "stand" now





// stand up
void setup(){
delay(100); // recommended pause
bioloid.loadPose(stand); // load a pose (named "stand") from FLASH into nextPose buffer
bioloid.readPose(); // load the actual values into pose buffer
bioloid.interpolateSetup(500); // interpolate from current position to standing in 1/2 of a sec (500ms)
while(bioloid.interpolating > 0)
bioloid.interpolateStep(); // actually update values in pose, and do bus write
delay(1);
}

lnxfergy
02-19-2010, 01:55 PM
Nope, you're just fine.. I left "step" off of interpolateStep -- which was a problem. (corrected in my original post now, for anyone coming through later).

-Fergs

muc
02-19-2010, 03:31 PM
I'm trying to get a short sequence to play. I created a poses.h file with 2 poses and 1 sequence. It would not compile with the new poses.h file. I didn't change anything else. This is what the poses.h file looks like;



#ifndef EBOT_POSES
#define EBOT_POSES

#include <avr/pgmspace.h>

PROGMEM prog_uint16_t stand[] = {8, 665, 512, 355, 512, 665, 512, 355, 512};
PROGMEM prog_uint16_t legup[] = {8, 665, 512, 355, 765, 665, 512, 355, 512};

PROGMEM transition_t kick[] = {{0,2} ,{stand|100,stand|1000} ,{legup|100,legup|1000} };

#endif


if I change the line

PROGMEM transition_t kick[] = {{0,2} ,{stand|100,stand|1000} ,{legup|100,legup|1000} };

to

PROGMEM transition_t kick[] = {{0,2} ,{stand,1000} ,{legup,1000} };

then it will compile. It seemed to work. Will this be okay?

lnxfergy
02-19-2010, 03:42 PM
Yeah, your correction is fine. It appears PyPose is exporting incorrectly (it should have split on the | internally, you shouldn't be getting what you are).

I just checked here, and my version exports sequences correctly, so I can't seem to replicate the error. What OS are you running under? What version of PyPose?

-Fergs

muc
02-19-2010, 03:47 PM
windows XP - Version 2002 SP3
PyPose v1.1

lnxfergy
02-19-2010, 04:07 PM
What version of python?

lnxfergy
02-21-2010, 01:30 PM
We have a new version of ArbotiX/PyPose out today -- it fixes this bug: http://code.google.com/p/arbotix/

-Fergs

muc
02-21-2010, 06:11 PM
Fergs,

I'll give it a test when I get back in town later in the week.

Mark