Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

18 servos moving randomly using rcservo_EnterPlayMode_NOFB

Based on DMP's Vortex processor / SoC this board is a full computer capable of running a standard Windows and Linux installation on the backpack of your robot.
22 postsPage 1 of 21, 2
22 postsPage 1 of 21, 2

18 servos moving randomly using rcservo_EnterPlayMode_NOFB

Post by dragonax » Sun Oct 03, 2010 9:06 pm

Post by dragonax
Sun Oct 03, 2010 9:06 pm

Hi

I have been trying to connect up 18 servos (645MG x 6 and 485HB x 12) to the roboard RB 100. I have connected the servos power separately to a 5000mAh NiMH battery.

I initialize 18 servos and use rcservo_EnterPlayMode_NOFB then when I use either MoveTo or SetAction all the servos moves randomly but if I use 17 servos instead of 18 it all works fine. it doesn't matter which servo i remove it works fine but as soon as I connect 18 it all goes wrong. The roboard does not reset or anything its just the servos move randomly. Any help is much appreciated

Thanks
Hi

I have been trying to connect up 18 servos (645MG x 6 and 485HB x 12) to the roboard RB 100. I have connected the servos power separately to a 5000mAh NiMH battery.

I initialize 18 servos and use rcservo_EnterPlayMode_NOFB then when I use either MoveTo or SetAction all the servos moves randomly but if I use 17 servos instead of 18 it all works fine. it doesn't matter which servo i remove it works fine but as soon as I connect 18 it all goes wrong. The roboard does not reset or anything its just the servos move randomly. Any help is much appreciated

Thanks
dragonax
Savvy Roboteer
Savvy Roboteer
Posts: 35
Joined: Sat Sep 04, 2010 7:46 pm

Post by josh » Mon Oct 04, 2010 3:21 am

Post by josh
Mon Oct 04, 2010 3:21 am

hi,

The lowest voltage which roboard accepts is 5V.

If the voltage of roboard is too low, roboard will reboot.

I think that you could try to increate the voltage to roboard.

The situation should be solved.
hi,

The lowest voltage which roboard accepts is 5V.

If the voltage of roboard is too low, roboard will reboot.

I think that you could try to increate the voltage to roboard.

The situation should be solved.
josh
Robot Builder
Robot Builder
Posts: 21
Joined: Wed Apr 07, 2010 1:43 am

Post by dragonax » Mon Oct 04, 2010 3:34 am

Post by dragonax
Mon Oct 04, 2010 3:34 am

Thanks for your reply but i have tried with 6V, 9V and 15V but no luck. it only happens when I connect 18 servos works fine with 17 so strange.
Thanks for your reply but i have tried with 6V, 9V and 15V but no luck. it only happens when I connect 18 servos works fine with 17 so strange.
dragonax
Savvy Roboteer
Savvy Roboteer
Posts: 35
Joined: Sat Sep 04, 2010 7:46 pm

Post by roboard » Mon Oct 04, 2010 7:31 am

Post by roboard
Mon Oct 04, 2010 7:31 am

dragonax wrote:Thanks for your reply but i have tried with 6V, 9V and 15V but no luck. it only happens when I connect 18 servos works fine with 17 so strange.


Hi,

please post your code; we will help to check whether your code is correct. :)
dragonax wrote:Thanks for your reply but i have tried with 6V, 9V and 15V but no luck. it only happens when I connect 18 servos works fine with 17 so strange.


Hi,

please post your code; we will help to check whether your code is correct. :)
roboard
Savvy Roboteer
Savvy Roboteer
Posts: 302
Joined: Fri Jul 03, 2009 4:44 am

Post by dragonax » Mon Oct 04, 2010 10:24 am

Post by dragonax
Mon Oct 04, 2010 10:24 am

Thanks here is the code I have so far

Code: Select all

#include <iostream>
#include <roboard>
#include <rcservo>
#include <string>
#include <stdio>             

struct servo {
    const int Pin;            // servo port
    const int PinNum;         // servo port
    const int Center;         // center point in Degrees
    double Angle;             // actuall angle
};

struct leg {
    struct servo Coxa;
    struct servo Femur;
    struct servo Tibia;
};

struct leg LF = {{ RCSERVO_USECHANNEL23,23,-2,0},{ RCSERVO_USECHANNEL22,22,0,0},{ RCSERVO_USECHANNEL21,21,-45,0}};
struct leg LM = {{ RCSERVO_USECHANNEL9,9, -19,0},{ RCSERVO_USECHANNEL10,10,-1,0},{ RCSERVO_USECHANNEL11,11,-40,0}};
struct leg LR = {{ RCSERVO_USECHANNEL15,15,-30,0},{ RCSERVO_USECHANNEL13,13,-8,0},{ RCSERVO_USECHANNEL14,14,-37,0}};

struct leg RF = {{ RCSERVO_USECHANNEL18,18,0,0},{ RCSERVO_USECHANNEL17,17,7,0},{ RCSERVO_USECHANNEL16,16,37,0}};
struct leg RM = {{ RCSERVO_USECHANNEL4,4, 7,0},{ RCSERVO_USECHANNEL20,20, 8,0},{ RCSERVO_USECHANNEL2,2, 30,0}};
struct leg RR = {{ RCSERVO_USECHANNEL1,1, 30,0},{ RCSERVO_USECHANNEL3,3, 16,0},{ RCSERVO_USECHANNEL0,0, 38,0}};

unsigned long motion[32];

using namespace std;


int Angle2ServoPos(double angle){

    //result 500-2500
    //angle in degrees(-90 to +90) 0 = center
    return (int)((angle * 2000/180) + 1500);

}

void ServoDriver(){


    //Set servo type here first
    /*if (rcservo_SetServos(
    RCSERVO_USECHANNEL23 + RCSERVO_USECHANNEL22 + RCSERVO_USECHANNEL21 +
    RCSERVO_USECHANNEL18 + RCSERVO_USECHANNEL17 + RCSERVO_USECHANNEL16 +
    RCSERVO_USECHANNEL9 + RCSERVO_USECHANNEL10 + RCSERVO_USECHANNEL11 +
    RCSERVO_USECHANNEL4 + RCSERVO_USECHANNEL5 + RCSERVO_USECHANNEL2 +
    RCSERVO_USECHANNEL15 + RCSERVO_USECHANNEL13 + RCSERVO_USECHANNEL14 +
    RCSERVO_USECHANNEL1+RCSERVO_USECHANNEL3+RCSERVO_USECHANNEL0 ,
        RCSERVO_SERVO_DEFAULT_NOFB)){*/

    if (rcservo_SetServos(
        LF.Coxa.Pin + LF.Femur.Pin + LF.Tibia.Pin +
        LM.Coxa.Pin + LM.Femur.Pin + LM.Tibia.Pin +
        LR.Coxa.Pin + LR.Femur.Pin + LR.Tibia.Pin +
        RF.Coxa.Pin + RF.Femur.Pin + RF.Tibia.Pin +
        RM.Coxa.Pin + RM.Femur.Pin + RM.Tibia.Pin +
        RR.Coxa.Pin + RR.Femur.Pin + RR.Tibia.Pin ,
        RCSERVO_SERVO_DEFAULT_NOFB)){
        //Initialize servo now
        if (rcservo_Initialize(
            LF.Coxa.Pin + LF.Femur.Pin + LF.Tibia.Pin +
            LM.Coxa.Pin + LM.Femur.Pin + LM.Tibia.Pin +
            LR.Coxa.Pin +
            LR.Femur.Pin +
            //LR.Tibia.Pin +   //If I comment any one of the pins it works fine
            RF.Coxa.Pin + RF.Femur.Pin + RF.Tibia.Pin +
            RM.Coxa.Pin + RM.Femur.Pin + RM.Tibia.Pin +
            RR.Coxa.Pin + RR.Femur.Pin + RR.Tibia.Pin  )){

            //sleep(1);


            rcservo_EnterPlayMode_NOFB(motion);


            rcservo_MoveTo(motion, 1000L);

            //rcservo_SetAction(motion, 2000L);
            //while (rcservo_PlayAction()!= RCSERVO_PAUSED){
                //rcservo_PauseAction();

            //};


            //rcservo_Close();
            //}else

        }
        else
        {
            //On error initialize servo
            printf("\n\nError: %s", roboio_GetErrMsg());
        };
    }
    else
    {
        //On error setting servo type
        printf("\n\nError: %s", roboio_GetErrMsg());
    };
};

void MoveServos(){
   rcservo_MoveTo(motion, 400L);
}

void SetHomePosition(){
    RF.Coxa.Angle=RF.Coxa.Center+30;
    RM.Coxa.Angle=RM.Coxa.Center;
    RR.Coxa.Angle=RR.Coxa.Center-30;

    RF.Femur.Angle=RF.Femur.Center+30;
    RM.Femur.Angle=RM.Femur.Center+30;
    RR.Femur.Angle=RR.Femur.Center+30;

    RF.Tibia.Angle=RF.Tibia.Center+33;
    RM.Tibia.Angle=RM.Tibia.Center+33;
    RR.Tibia.Angle=RR.Tibia.Center+33;

    LF.Coxa.Angle=LF.Coxa.Center-30;
    LM.Coxa.Angle=LM.Coxa.Center;
    LR.Coxa.Angle=LR.Coxa.Center+30;

    LF.Femur.Angle=LF.Femur.Center-30;
    LM.Femur.Angle=LM.Femur.Center-30;
    LR.Femur.Angle=LR.Femur.Center-30;

    LF.Tibia.Angle=LF.Tibia.Center-33;
    LM.Tibia.Angle=LM.Tibia.Center-33;
    LR.Tibia.Angle=LR.Tibia.Center-33;

};

void CalServoPositions(){
    motion[RF.Coxa.PinNum]=Angle2ServoPos(RF.Coxa.Angle);   
    motion[RM.Coxa.PinNum]=Angle2ServoPos(RM.Coxa.Angle);   
    motion[RR.Coxa.PinNum]=Angle2ServoPos(RR.Coxa.Angle);   

    motion[RF.Femur.PinNum]=Angle2ServoPos(RF.Femur.Angle);   
    motion[RM.Femur.PinNum]=Angle2ServoPos(RM.Femur.Angle);   
    motion[RR.Femur.PinNum]=Angle2ServoPos(RR.Femur.Angle);   

    motion[RF.Tibia.PinNum]=Angle2ServoPos(RF.Tibia.Angle);   
    motion[RM.Tibia.PinNum]=Angle2ServoPos(RM.Tibia.Angle); 
    motion[RR.Tibia.PinNum]=Angle2ServoPos(RR.Tibia.Angle);   

    motion[LF.Coxa.PinNum]=Angle2ServoPos(LF.Coxa.Angle);   
    motion[LM.Coxa.PinNum]=Angle2ServoPos(LM.Coxa.Angle);   
    motion[LR.Coxa.PinNum]=Angle2ServoPos(LR.Coxa.Angle);   

    motion[LF.Femur.PinNum]=Angle2ServoPos(LF.Femur.Angle); 
    motion[LM.Femur.PinNum]=Angle2ServoPos(LM.Femur.Angle); 
    motion[LR.Femur.PinNum]=Angle2ServoPos(LR.Femur.Angle);   

    motion[LF.Tibia.PinNum]=Angle2ServoPos(LF.Tibia.Angle); 
    motion[LM.Tibia.PinNum]=Angle2ServoPos(LM.Tibia.Angle); 
    motion[LR.Tibia.PinNum]=Angle2ServoPos(LR.Tibia.Angle);   
};

void RippleGait(){

    //Move RF and LR forward
    RF.Femur.Angle = RF.Femur.Angle + 20;
    LR.Femur.Angle = LR.Femur.Angle - 20;
    CalServoPositions();
    MoveServos();

    RF.Coxa.Angle = RF.Coxa.Angle +20;
    RF.Tibia.Angle = RF.Tibia.Angle -20; //- expands
    LR.Coxa.Angle = LR.Coxa.Angle -20;
    LR.Tibia.Angle = LR.Tibia.Angle +20; //- expands
    CalServoPositions();
    MoveServos();

    RF.Femur.Angle = RF.Femur.Center+30;
    RF.Tibia.Angle = RF.Tibia.Center+33; //- expands
    LR.Femur.Angle = LR.Femur.Center-30;
    LR.Tibia.Angle = LR.Tibia.Center-33; //- expands
    CalServoPositions();
    MoveServos();

    RF.Coxa.Angle = RF.Coxa.Center+30;
    LR.Coxa.Angle = LR.Coxa.Center+30;

    RM.Coxa.Angle = RM.Coxa.Center+10;
    RR.Coxa.Angle = RR.Coxa.Center+10;
    LF.Coxa.Angle = LF.Coxa.Center-10;
    LM.Coxa.Angle = LM.Coxa.Center-10;
    CalServoPositions();
    MoveServos();


    //Move RR and LM forward
    RR.Femur.Angle = RR.Femur.Angle + 20;
    LM.Femur.Angle = LM.Femur.Angle - 20;
    CalServoPositions();
    MoveServos();

    RR.Coxa.Angle = RR.Coxa.Angle +20;
    RR.Tibia.Angle = RR.Tibia.Angle -20; //- expands
    LM.Coxa.Angle = LM.Coxa.Angle -20;
    LM.Tibia.Angle = LM.Tibia.Angle +20; //- expands
    CalServoPositions();
    MoveServos();


    RR.Femur.Angle = RR.Femur.Center+30;
    RR.Tibia.Angle = RR.Tibia.Center+33; //- expands
    LM.Femur.Angle = LM.Femur.Center-30;
    LM.Tibia.Angle = LM.Tibia.Center-33; //- expands
    CalServoPositions();
    MoveServos();

    RR.Coxa.Angle = RR.Coxa.Center-30;
    LM.Coxa.Angle = LM.Coxa.Center;
    CalServoPositions();
    MoveServos();



    //Move RM and LF forward
    RM.Femur.Angle = RM.Femur.Angle + 20;
    LF.Femur.Angle = LF.Femur.Angle - 20;
    CalServoPositions();
    MoveServos();

    RM.Coxa.Angle = RM.Coxa.Angle +20;
    RM.Tibia.Angle = RM.Tibia.Angle -20; //- expands
    LF.Coxa.Angle = LF.Coxa.Angle -20;
    LF.Tibia.Angle = LF.Tibia.Angle +20; //- expands
    CalServoPositions();
    MoveServos();


    RM.Femur.Angle = RM.Femur.Center+30;
    RM.Tibia.Angle = RM.Tibia.Center+33; //- expands
    LF.Femur.Angle = LF.Femur.Center-30;
    LF.Tibia.Angle = LF.Tibia.Center-33; //- expands
    CalServoPositions();
    MoveServos();

    RM.Coxa.Angle = RM.Coxa.Center;
    LF.Coxa.Angle = LF.Coxa.Center-30;
    CalServoPositions();
    MoveServos();
};

void TripodGait(){
//Move RF & LM & RR forward
    RF.Femur.Angle = RF.Femur.Angle + 20;
    LM.Femur.Angle = LM.Femur.Angle - 20;
    RR.Femur.Angle = RR.Femur.Angle + 20;
    CalServoPositions();
    MoveServos();

    RF.Coxa.Angle = RF.Coxa.Angle +20;
    RF.Tibia.Angle = RF.Tibia.Angle -20; //- expands
    LM.Coxa.Angle = LM.Coxa.Angle -20;
    LM.Tibia.Angle = LM.Tibia.Angle +20; //- expands
    RR.Coxa.Angle = RR.Coxa.Angle +20;
    RR.Tibia.Angle = RR.Tibia.Angle -20; //- expands
    CalServoPositions();
    MoveServos();


    RF.Femur.Angle = RF.Femur.Center+30;
    RF.Tibia.Angle = RF.Tibia.Center+33; //- expands
    LM.Femur.Angle = LM.Femur.Center-30;
    LM.Tibia.Angle = LM.Tibia.Center-33; //- expands
    RR.Femur.Angle = RR.Femur.Center+30;
    RR.Tibia.Angle = RR.Tibia.Center+33; //- expands
    CalServoPositions();
    MoveServos();

    RF.Coxa.Angle = RF.Coxa.Center+30;
    LM.Coxa.Angle = LM.Coxa.Center;
    RR.Coxa.Angle = RR.Coxa.Center-30;

    LF.Femur.Angle = LF.Femur.Angle - 20;
    RM.Femur.Angle = RM.Femur.Angle + 20;
    LR.Femur.Angle = LR.Femur.Angle - 20;
    CalServoPositions();
    MoveServos();




   //Move LF & RM & LR forward



    LF.Coxa.Angle = LF.Coxa.Angle -20;
    LF.Tibia.Angle = LF.Tibia.Angle +20; //- expands
    RM.Coxa.Angle = RM.Coxa.Angle +20;
    RM.Tibia.Angle = RM.Tibia.Angle -20; //- expands
    LR.Coxa.Angle = LR.Coxa.Angle -20;
    LR.Tibia.Angle = LR.Tibia.Angle +20; //- expands
    CalServoPositions();
    MoveServos();


    LF.Femur.Angle = LF.Femur.Center-30;
    LF.Tibia.Angle = LF.Tibia.Center-33; //- expands
    RM.Femur.Angle = RM.Femur.Center+30;
    RM.Tibia.Angle = RM.Tibia.Center+33; //- expands
    LR.Femur.Angle = LR.Femur.Center-30;
    LR.Tibia.Angle = LR.Tibia.Center-33; //- expands
    CalServoPositions();
    MoveServos();

    LF.Coxa.Angle = LF.Coxa.Center-30;
    RM.Coxa.Angle = RM.Coxa.Center;
    LR.Coxa.Angle = LR.Coxa.Center+30;
    CalServoPositions();
    MoveServos();
};


int main()
{

    //set roboard version in our case its roboard 100
    roboio_SetRBVer(RB_100);
    SetHomePosition();
    CalServoPositions();
    ServoDriver();

   //do 4 steps
    for (int i=0;i<3;i++){
        TripodGait();
    }




    return 0;
}
Thanks here is the code I have so far

Code: Select all

#include <iostream>
#include <roboard>
#include <rcservo>
#include <string>
#include <stdio>             

struct servo {
    const int Pin;            // servo port
    const int PinNum;         // servo port
    const int Center;         // center point in Degrees
    double Angle;             // actuall angle
};

struct leg {
    struct servo Coxa;
    struct servo Femur;
    struct servo Tibia;
};

struct leg LF = {{ RCSERVO_USECHANNEL23,23,-2,0},{ RCSERVO_USECHANNEL22,22,0,0},{ RCSERVO_USECHANNEL21,21,-45,0}};
struct leg LM = {{ RCSERVO_USECHANNEL9,9, -19,0},{ RCSERVO_USECHANNEL10,10,-1,0},{ RCSERVO_USECHANNEL11,11,-40,0}};
struct leg LR = {{ RCSERVO_USECHANNEL15,15,-30,0},{ RCSERVO_USECHANNEL13,13,-8,0},{ RCSERVO_USECHANNEL14,14,-37,0}};

struct leg RF = {{ RCSERVO_USECHANNEL18,18,0,0},{ RCSERVO_USECHANNEL17,17,7,0},{ RCSERVO_USECHANNEL16,16,37,0}};
struct leg RM = {{ RCSERVO_USECHANNEL4,4, 7,0},{ RCSERVO_USECHANNEL20,20, 8,0},{ RCSERVO_USECHANNEL2,2, 30,0}};
struct leg RR = {{ RCSERVO_USECHANNEL1,1, 30,0},{ RCSERVO_USECHANNEL3,3, 16,0},{ RCSERVO_USECHANNEL0,0, 38,0}};

unsigned long motion[32];

using namespace std;


int Angle2ServoPos(double angle){

    //result 500-2500
    //angle in degrees(-90 to +90) 0 = center
    return (int)((angle * 2000/180) + 1500);

}

void ServoDriver(){


    //Set servo type here first
    /*if (rcservo_SetServos(
    RCSERVO_USECHANNEL23 + RCSERVO_USECHANNEL22 + RCSERVO_USECHANNEL21 +
    RCSERVO_USECHANNEL18 + RCSERVO_USECHANNEL17 + RCSERVO_USECHANNEL16 +
    RCSERVO_USECHANNEL9 + RCSERVO_USECHANNEL10 + RCSERVO_USECHANNEL11 +
    RCSERVO_USECHANNEL4 + RCSERVO_USECHANNEL5 + RCSERVO_USECHANNEL2 +
    RCSERVO_USECHANNEL15 + RCSERVO_USECHANNEL13 + RCSERVO_USECHANNEL14 +
    RCSERVO_USECHANNEL1+RCSERVO_USECHANNEL3+RCSERVO_USECHANNEL0 ,
        RCSERVO_SERVO_DEFAULT_NOFB)){*/

    if (rcservo_SetServos(
        LF.Coxa.Pin + LF.Femur.Pin + LF.Tibia.Pin +
        LM.Coxa.Pin + LM.Femur.Pin + LM.Tibia.Pin +
        LR.Coxa.Pin + LR.Femur.Pin + LR.Tibia.Pin +
        RF.Coxa.Pin + RF.Femur.Pin + RF.Tibia.Pin +
        RM.Coxa.Pin + RM.Femur.Pin + RM.Tibia.Pin +
        RR.Coxa.Pin + RR.Femur.Pin + RR.Tibia.Pin ,
        RCSERVO_SERVO_DEFAULT_NOFB)){
        //Initialize servo now
        if (rcservo_Initialize(
            LF.Coxa.Pin + LF.Femur.Pin + LF.Tibia.Pin +
            LM.Coxa.Pin + LM.Femur.Pin + LM.Tibia.Pin +
            LR.Coxa.Pin +
            LR.Femur.Pin +
            //LR.Tibia.Pin +   //If I comment any one of the pins it works fine
            RF.Coxa.Pin + RF.Femur.Pin + RF.Tibia.Pin +
            RM.Coxa.Pin + RM.Femur.Pin + RM.Tibia.Pin +
            RR.Coxa.Pin + RR.Femur.Pin + RR.Tibia.Pin  )){

            //sleep(1);


            rcservo_EnterPlayMode_NOFB(motion);


            rcservo_MoveTo(motion, 1000L);

            //rcservo_SetAction(motion, 2000L);
            //while (rcservo_PlayAction()!= RCSERVO_PAUSED){
                //rcservo_PauseAction();

            //};


            //rcservo_Close();
            //}else

        }
        else
        {
            //On error initialize servo
            printf("\n\nError: %s", roboio_GetErrMsg());
        };
    }
    else
    {
        //On error setting servo type
        printf("\n\nError: %s", roboio_GetErrMsg());
    };
};

void MoveServos(){
   rcservo_MoveTo(motion, 400L);
}

void SetHomePosition(){
    RF.Coxa.Angle=RF.Coxa.Center+30;
    RM.Coxa.Angle=RM.Coxa.Center;
    RR.Coxa.Angle=RR.Coxa.Center-30;

    RF.Femur.Angle=RF.Femur.Center+30;
    RM.Femur.Angle=RM.Femur.Center+30;
    RR.Femur.Angle=RR.Femur.Center+30;

    RF.Tibia.Angle=RF.Tibia.Center+33;
    RM.Tibia.Angle=RM.Tibia.Center+33;
    RR.Tibia.Angle=RR.Tibia.Center+33;

    LF.Coxa.Angle=LF.Coxa.Center-30;
    LM.Coxa.Angle=LM.Coxa.Center;
    LR.Coxa.Angle=LR.Coxa.Center+30;

    LF.Femur.Angle=LF.Femur.Center-30;
    LM.Femur.Angle=LM.Femur.Center-30;
    LR.Femur.Angle=LR.Femur.Center-30;

    LF.Tibia.Angle=LF.Tibia.Center-33;
    LM.Tibia.Angle=LM.Tibia.Center-33;
    LR.Tibia.Angle=LR.Tibia.Center-33;

};

void CalServoPositions(){
    motion[RF.Coxa.PinNum]=Angle2ServoPos(RF.Coxa.Angle);   
    motion[RM.Coxa.PinNum]=Angle2ServoPos(RM.Coxa.Angle);   
    motion[RR.Coxa.PinNum]=Angle2ServoPos(RR.Coxa.Angle);   

    motion[RF.Femur.PinNum]=Angle2ServoPos(RF.Femur.Angle);   
    motion[RM.Femur.PinNum]=Angle2ServoPos(RM.Femur.Angle);   
    motion[RR.Femur.PinNum]=Angle2ServoPos(RR.Femur.Angle);   

    motion[RF.Tibia.PinNum]=Angle2ServoPos(RF.Tibia.Angle);   
    motion[RM.Tibia.PinNum]=Angle2ServoPos(RM.Tibia.Angle); 
    motion[RR.Tibia.PinNum]=Angle2ServoPos(RR.Tibia.Angle);   

    motion[LF.Coxa.PinNum]=Angle2ServoPos(LF.Coxa.Angle);   
    motion[LM.Coxa.PinNum]=Angle2ServoPos(LM.Coxa.Angle);   
    motion[LR.Coxa.PinNum]=Angle2ServoPos(LR.Coxa.Angle);   

    motion[LF.Femur.PinNum]=Angle2ServoPos(LF.Femur.Angle); 
    motion[LM.Femur.PinNum]=Angle2ServoPos(LM.Femur.Angle); 
    motion[LR.Femur.PinNum]=Angle2ServoPos(LR.Femur.Angle);   

    motion[LF.Tibia.PinNum]=Angle2ServoPos(LF.Tibia.Angle); 
    motion[LM.Tibia.PinNum]=Angle2ServoPos(LM.Tibia.Angle); 
    motion[LR.Tibia.PinNum]=Angle2ServoPos(LR.Tibia.Angle);   
};

void RippleGait(){

    //Move RF and LR forward
    RF.Femur.Angle = RF.Femur.Angle + 20;
    LR.Femur.Angle = LR.Femur.Angle - 20;
    CalServoPositions();
    MoveServos();

    RF.Coxa.Angle = RF.Coxa.Angle +20;
    RF.Tibia.Angle = RF.Tibia.Angle -20; //- expands
    LR.Coxa.Angle = LR.Coxa.Angle -20;
    LR.Tibia.Angle = LR.Tibia.Angle +20; //- expands
    CalServoPositions();
    MoveServos();

    RF.Femur.Angle = RF.Femur.Center+30;
    RF.Tibia.Angle = RF.Tibia.Center+33; //- expands
    LR.Femur.Angle = LR.Femur.Center-30;
    LR.Tibia.Angle = LR.Tibia.Center-33; //- expands
    CalServoPositions();
    MoveServos();

    RF.Coxa.Angle = RF.Coxa.Center+30;
    LR.Coxa.Angle = LR.Coxa.Center+30;

    RM.Coxa.Angle = RM.Coxa.Center+10;
    RR.Coxa.Angle = RR.Coxa.Center+10;
    LF.Coxa.Angle = LF.Coxa.Center-10;
    LM.Coxa.Angle = LM.Coxa.Center-10;
    CalServoPositions();
    MoveServos();


    //Move RR and LM forward
    RR.Femur.Angle = RR.Femur.Angle + 20;
    LM.Femur.Angle = LM.Femur.Angle - 20;
    CalServoPositions();
    MoveServos();

    RR.Coxa.Angle = RR.Coxa.Angle +20;
    RR.Tibia.Angle = RR.Tibia.Angle -20; //- expands
    LM.Coxa.Angle = LM.Coxa.Angle -20;
    LM.Tibia.Angle = LM.Tibia.Angle +20; //- expands
    CalServoPositions();
    MoveServos();


    RR.Femur.Angle = RR.Femur.Center+30;
    RR.Tibia.Angle = RR.Tibia.Center+33; //- expands
    LM.Femur.Angle = LM.Femur.Center-30;
    LM.Tibia.Angle = LM.Tibia.Center-33; //- expands
    CalServoPositions();
    MoveServos();

    RR.Coxa.Angle = RR.Coxa.Center-30;
    LM.Coxa.Angle = LM.Coxa.Center;
    CalServoPositions();
    MoveServos();



    //Move RM and LF forward
    RM.Femur.Angle = RM.Femur.Angle + 20;
    LF.Femur.Angle = LF.Femur.Angle - 20;
    CalServoPositions();
    MoveServos();

    RM.Coxa.Angle = RM.Coxa.Angle +20;
    RM.Tibia.Angle = RM.Tibia.Angle -20; //- expands
    LF.Coxa.Angle = LF.Coxa.Angle -20;
    LF.Tibia.Angle = LF.Tibia.Angle +20; //- expands
    CalServoPositions();
    MoveServos();


    RM.Femur.Angle = RM.Femur.Center+30;
    RM.Tibia.Angle = RM.Tibia.Center+33; //- expands
    LF.Femur.Angle = LF.Femur.Center-30;
    LF.Tibia.Angle = LF.Tibia.Center-33; //- expands
    CalServoPositions();
    MoveServos();

    RM.Coxa.Angle = RM.Coxa.Center;
    LF.Coxa.Angle = LF.Coxa.Center-30;
    CalServoPositions();
    MoveServos();
};

void TripodGait(){
//Move RF & LM & RR forward
    RF.Femur.Angle = RF.Femur.Angle + 20;
    LM.Femur.Angle = LM.Femur.Angle - 20;
    RR.Femur.Angle = RR.Femur.Angle + 20;
    CalServoPositions();
    MoveServos();

    RF.Coxa.Angle = RF.Coxa.Angle +20;
    RF.Tibia.Angle = RF.Tibia.Angle -20; //- expands
    LM.Coxa.Angle = LM.Coxa.Angle -20;
    LM.Tibia.Angle = LM.Tibia.Angle +20; //- expands
    RR.Coxa.Angle = RR.Coxa.Angle +20;
    RR.Tibia.Angle = RR.Tibia.Angle -20; //- expands
    CalServoPositions();
    MoveServos();


    RF.Femur.Angle = RF.Femur.Center+30;
    RF.Tibia.Angle = RF.Tibia.Center+33; //- expands
    LM.Femur.Angle = LM.Femur.Center-30;
    LM.Tibia.Angle = LM.Tibia.Center-33; //- expands
    RR.Femur.Angle = RR.Femur.Center+30;
    RR.Tibia.Angle = RR.Tibia.Center+33; //- expands
    CalServoPositions();
    MoveServos();

    RF.Coxa.Angle = RF.Coxa.Center+30;
    LM.Coxa.Angle = LM.Coxa.Center;
    RR.Coxa.Angle = RR.Coxa.Center-30;

    LF.Femur.Angle = LF.Femur.Angle - 20;
    RM.Femur.Angle = RM.Femur.Angle + 20;
    LR.Femur.Angle = LR.Femur.Angle - 20;
    CalServoPositions();
    MoveServos();




   //Move LF & RM & LR forward



    LF.Coxa.Angle = LF.Coxa.Angle -20;
    LF.Tibia.Angle = LF.Tibia.Angle +20; //- expands
    RM.Coxa.Angle = RM.Coxa.Angle +20;
    RM.Tibia.Angle = RM.Tibia.Angle -20; //- expands
    LR.Coxa.Angle = LR.Coxa.Angle -20;
    LR.Tibia.Angle = LR.Tibia.Angle +20; //- expands
    CalServoPositions();
    MoveServos();


    LF.Femur.Angle = LF.Femur.Center-30;
    LF.Tibia.Angle = LF.Tibia.Center-33; //- expands
    RM.Femur.Angle = RM.Femur.Center+30;
    RM.Tibia.Angle = RM.Tibia.Center+33; //- expands
    LR.Femur.Angle = LR.Femur.Center-30;
    LR.Tibia.Angle = LR.Tibia.Center-33; //- expands
    CalServoPositions();
    MoveServos();

    LF.Coxa.Angle = LF.Coxa.Center-30;
    RM.Coxa.Angle = RM.Coxa.Center;
    LR.Coxa.Angle = LR.Coxa.Center+30;
    CalServoPositions();
    MoveServos();
};


int main()
{

    //set roboard version in our case its roboard 100
    roboio_SetRBVer(RB_100);
    SetHomePosition();
    CalServoPositions();
    ServoDriver();

   //do 4 steps
    for (int i=0;i<3;i++){
        TripodGait();
    }




    return 0;
}
dragonax
Savvy Roboteer
Savvy Roboteer
Posts: 35
Joined: Sat Sep 04, 2010 7:46 pm

Post by dragonax » Mon Oct 04, 2010 10:27 am

Post by dragonax
Mon Oct 04, 2010 10:27 am

If you look at the rcservo_Initialize in "void ServoDriver" if I comment any of the pins then it works fine but uncommented they all go randomly.

Thanks
If you look at the rcservo_Initialize in "void ServoDriver" if I comment any of the pins then it works fine but uncommented they all go randomly.

Thanks
dragonax
Savvy Roboteer
Savvy Roboteer
Posts: 35
Joined: Sat Sep 04, 2010 7:46 pm

Post by roboard » Tue Oct 05, 2010 6:02 am

Post by roboard
Tue Oct 05, 2010 6:02 am

dragonax wrote:If you look at the rcservo_Initialize in "void ServoDriver" if I comment any of the pins then it works fine but uncommented they all go randomly.


In your code, please change the "const int Pin" to "const unsigned long Pin" and try it again.

If this still unworks, then it is possible that your power supply (battery) cannot supply enough current to all 18 servos. To confirm this, please remove 1 or 2 servos from your RoBoard and run your program (written for 18 servos) again. And then please feed back the result to us. :)
dragonax wrote:If you look at the rcservo_Initialize in "void ServoDriver" if I comment any of the pins then it works fine but uncommented they all go randomly.


In your code, please change the "const int Pin" to "const unsigned long Pin" and try it again.

If this still unworks, then it is possible that your power supply (battery) cannot supply enough current to all 18 servos. To confirm this, please remove 1 or 2 servos from your RoBoard and run your program (written for 18 servos) again. And then please feed back the result to us. :)
roboard
Savvy Roboteer
Savvy Roboteer
Posts: 302
Joined: Fri Jul 03, 2009 4:44 am

Post by foe.pexal » Wed Oct 06, 2010 5:51 pm

Post by foe.pexal
Wed Oct 06, 2010 5:51 pm

hi... i have used Roboard RB-110 and unfortunately i have some problem when i execute the program, the program always fails to initialize I/O library, what should i do to fix this problem whereas i've followed the instructions from Roboard training software's tutorial?
hi... i have used Roboard RB-110 and unfortunately i have some problem when i execute the program, the program always fails to initialize I/O library, what should i do to fix this problem whereas i've followed the instructions from Roboard training software's tutorial?
foe.pexal
Robot Builder
Robot Builder
Posts: 12
Joined: Thu Sep 30, 2010 9:06 am

Post by dragonax » Thu Oct 07, 2010 1:08 am

Post by dragonax
Thu Oct 07, 2010 1:08 am

Are you running the program under root. If not execute the program as "sudo programname" to give root privileges.
Are you running the program under root. If not execute the program as "sudo programname" to give root privileges.
dragonax
Savvy Roboteer
Savvy Roboteer
Posts: 35
Joined: Sat Sep 04, 2010 7:46 pm

Post by foe.pexal » Thu Oct 07, 2010 9:52 am

Post by foe.pexal
Thu Oct 07, 2010 9:52 am

I am not using Linux OS, but use WinXP SP 2 build 2600 and microsoft visual studio 2008 as programming software. I already include the RoBoIO library, but it still fails to initialize I/O library. what should I do?
I am not using Linux OS, but use WinXP SP 2 build 2600 and microsoft visual studio 2008 as programming software. I already include the RoBoIO library, but it still fails to initialize I/O library. what should I do?
foe.pexal
Robot Builder
Robot Builder
Posts: 12
Joined: Thu Sep 30, 2010 9:06 am

Post by dragonax » Sat Oct 09, 2010 6:21 am

Post by dragonax
Sat Oct 09, 2010 6:21 am

I have tried changing the code to const unsigned long but no luck
also I removed 2 servos and tried the 18servos code like you said and it moves still randomly. so its not a problem with the power supply.

I am running Ubuntu 10.04, could it be that the pulses are not sent every 20 ms (May be a delay because of processing)?.
I have tried changing the code to const unsigned long but no luck
also I removed 2 servos and tried the 18servos code like you said and it moves still randomly. so its not a problem with the power supply.

I am running Ubuntu 10.04, could it be that the pulses are not sent every 20 ms (May be a delay because of processing)?.
dragonax
Savvy Roboteer
Savvy Roboteer
Posts: 35
Joined: Sat Sep 04, 2010 7:46 pm

Post by dragonax » Sat Oct 09, 2010 6:22 am

Post by dragonax
Sat Oct 09, 2010 6:22 am

Sorry foe-pexal I am not familiar with xp on roboard.
Sorry foe-pexal I am not familiar with xp on roboard.
dragonax
Savvy Roboteer
Savvy Roboteer
Posts: 35
Joined: Sat Sep 04, 2010 7:46 pm

Post by foe.pexal » Sat Oct 09, 2010 8:40 pm

Post by foe.pexal
Sat Oct 09, 2010 8:40 pm

ok, thank you dragonax.. can anyone else help me??
ok, thank you dragonax.. can anyone else help me??
foe.pexal
Robot Builder
Robot Builder
Posts: 12
Joined: Thu Sep 30, 2010 9:06 am

Post by PaulL » Sun Oct 10, 2010 1:05 pm

Post by PaulL
Sun Oct 10, 2010 1:05 pm

dragonax,

I would guess it's a code issue, and not a hardware problem. Does it do the same with only 1 servo connected, and 18 enabled in your code? That kind of test would help point to where the problem is coming from. The surge current for a pile of servos can be really high if the moves start far from their intended destination. There was a post a while back where someone's board rebooted (same power supply for servos and Roboard) when moving a bunch of servos. He added a 1mS delay between position updates on the servos (I forget the code, but he posted it here somewhere) so all the servos wouldn't "hit" at the same time.

foe.pexal,

What version of the Roboard source are you using? Are you trying to run the example program? Are you running under an "Administrator" account? WinIO doesn't need much to initialize, access rights or version would be the only two reasons I can think of that would prevent it from initializing.
dragonax,

I would guess it's a code issue, and not a hardware problem. Does it do the same with only 1 servo connected, and 18 enabled in your code? That kind of test would help point to where the problem is coming from. The surge current for a pile of servos can be really high if the moves start far from their intended destination. There was a post a while back where someone's board rebooted (same power supply for servos and Roboard) when moving a bunch of servos. He added a 1mS delay between position updates on the servos (I forget the code, but he posted it here somewhere) so all the servos wouldn't "hit" at the same time.

foe.pexal,

What version of the Roboard source are you using? Are you trying to run the example program? Are you running under an "Administrator" account? WinIO doesn't need much to initialize, access rights or version would be the only two reasons I can think of that would prevent it from initializing.
PaulL
Savvy Roboteer
Savvy Roboteer
Posts: 423
Joined: Sat Sep 15, 2007 12:52 am

Post by dragonax » Sun Oct 10, 2010 8:00 pm

Post by dragonax
Sun Oct 10, 2010 8:00 pm

I haven't tested with just one servo but I did test with 16 servos running for 18 servo code just removed two servos. I will try with just one servo. I have seen the post you mentioned. the same thing happened to me when i connected the servos directly to the roboard (I mean the board reset) so I connected the power to servos separately which solved that issue. I don't think the error is in the initializing in my code it only happens at the rcservo_MoveTo Command.

I am running in ubuntu under root so it has all permission and the code is the one I posted before.

Thanks
I haven't tested with just one servo but I did test with 16 servos running for 18 servo code just removed two servos. I will try with just one servo. I have seen the post you mentioned. the same thing happened to me when i connected the servos directly to the roboard (I mean the board reset) so I connected the power to servos separately which solved that issue. I don't think the error is in the initializing in my code it only happens at the rcservo_MoveTo Command.

I am running in ubuntu under root so it has all permission and the code is the one I posted before.

Thanks
dragonax
Savvy Roboteer
Savvy Roboteer
Posts: 35
Joined: Sat Sep 04, 2010 7:46 pm

Next
22 postsPage 1 of 21, 2
22 postsPage 1 of 21, 2