Pages: 1 [2]   Go Down
Author Topic: Me and my Quadrabot  (Read 3712 times)
0 Members and 1 Guest are viewing this topic.
Morrinsville, New Zealand
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry I have taken my sweet time returning to this forum, life has been busy.

All I've done at this stage is make a to the change to the movements. Now instead of making the foot move from point A to point B, it moves in a path between point A to point B, stopping at a predetermined (set at three in this example) number of points along the path. I have done this in an attempt to create a more accurate path. The path is made from the original coordinates and mathematically added within the program.


There are still a few glitches in it and it looks quite dumb imo, but its a start.



Code:
void doTest()
{
  for (h=0; h<testcount; h++) //step
  { 
    for (e=0; e<12; e++) //servo
  {
    for (d=1; d<testcount; d++)
    {
        if (h==0)  //if first step
      {
        move=test[e][h];
        myservo[e].write(move);
      }
      else
      {
        if (h!=0 && h<=testcount) //if subsequent steps
        {
          if (test[e][h]==test[e][h-1]) //if move-to is equal to
          {
            move=test[e][h];
            myservo[e].write(move);
          }
          else if (test[e][h]>test[e][h-1]) //if move-to is greater than
          {
            c=test[e][h]-test[e][h-1];
            c=c/3;
            move=test[e][h]-(c*d);
            myservo[e].write(move);
            delay(pause);
          }
          else if (test[e][h]<test[e][h-1]) //if move-to is less than
          {
            c=test[e][h-1]-test[e][h];
            c=c/3;
            move=test[e][h]+(c*d);
            myservo[e].write(move);
            delay(pause);
          }
        }
      }
    }
  }
  delay(pause);
  }
}

For all those that want to follow a little closer I have set up a Facebook page:
http://www.facebook.com/home.php#!/pages/Quadrabot/246637268735818
Logged

The average person doesn't read the manual; that's what makes them average.

Morrinsville, New Zealand
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Opps, I put the wrong code on there, sorry:

Code:
void doTest()
{
  for (h=0; h<testcount; h++) //step
  {
    for (d=divisor; d>0; d--) //divisions per movement
    {
      for (e=0; e<12; e++) //servo
      {
        savepos[e]=test[e][h];
        if (h==0) //if first step
        {
          if (test[e][h]==savepos[e]) //if move-to is equal to
          {
            move=test[e][h];
            myservo[e].write(move);
          }
          else if (test[e][h]>savepos[e]) //if move-to is greater than
          {
            c=test[e][h]-savepos[e];
            c=c/3;
            move=test[e][h]-(c*d);
            myservo[e].write(move);
          }
          else if (test[e][h]<savepos[e]) //if move-to is less than
          {
            c=savepos[e]-test[e][h];
            c=c/3;
            move=test[e][h]+(c*d);
            myservo[e].write(move);
          }
        }
        else
        {
          if (h!=0 && h<=testcount) //if subsequent steps
          {
            if (test[e][h]==test[e][h-1]) //if move-to is equal to
            {
              move=test[e][h];
              myservo[e].write(move);
            }
            else if (test[e][h]>test[e][h-1]) //if move-to is greater than
            {
              c=test[e][h]-test[e][h-1];
              c=c/3;
              move=test[e][h]-(c*d);
              myservo[e].write(move);
            }
            else if (test[e][h]<test[e][h-1]) //if move-to is less than
            {
              c=test[e][h-1]-test[e][h];
              c=c/3;
              move=test[e][h]+(c*d);
              myservo[e].write(move);
            }
          }
        }
        delay(pause/(divisor*2));
      }
    }
  }
}

 
Logged

The average person doesn't read the manual; that's what makes them average.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 68
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
Nice project!
Would you mind to do a litte "instructables" with any photo, to explain how to assembly the legs,wires and sensor?
Thanks for all
« Last Edit: February 14, 2012, 09:12:26 am by Cello62 » Logged

Pages: 1 [2]   Go Up
Jump to: