Show Posts
Pages: [1] 2 3
1  Forum 2005-2010 (read only) / Troubleshooting / Re: communication breakdown between my arduino & servo on: May 20, 2009, 09:36:37 am
yes and no, i'm just testing the respond of the servoes to the packets of commands, but some servoes seem to be unable to hold the torque upon received the codes.
2  Forum 2005-2010 (read only) / Troubleshooting / Re: communication breakdown between my arduino & servo on: May 19, 2009, 12:25:30 pm
here is my code
Code:
#include <math.h>
#define Header 0xff  


byte *PosPtr;
byte ZeroPosArray[12]={/* ID 0 ,  1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ,  8 ,   9,  10 ,  11 */
                           132 , 122, 187, 164,  60, 121, 123, 127, 63 , 86 ,  195, 127      //initial positions
                    };                                                                      
                    
byte WalkPosArray[11][12]={/* ID 0 ,  1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ,  8 ,   9,  10 ,  11 */
                              {132 , 116, 188, 161, 58 , 119, 123, 121, 62,  89, 197 , 121},//ViaPoint_0
                              {132 , 115, 166, 190, 64 , 118, 123, 121, 62,  89, 197 , 109},//ViaPoint_1
                              {132 , 116, 182, 154, 45 , 119, 123, 121, 53,  92, 191 , 121},//ViaPoint_2
                              {132 , 122, 180, 157, 46 , 125, 123, 127, 55,  89, 190 , 127},//ViaPoint_3
                              {132 , 129, 183, 158, 50 , 132, 123, 134, 48,  96, 190 , 134},//ViaPoint_4
                              {132 , 129, 188, 161, 58 , 132, 123, 134, 41, 103, 190 , 134},//ViaPoint_5
                              {132 , 129, 180, 161, 58 , 142, 123, 135, 84,  60, 191 , 135},//ViaPoint_6
                              {132 , 129, 197, 158, 64 , 132, 123, 134, 68,  96, 210 , 134},//ViaPoint_7
                              {132 , 122, 195, 161, 65 , 125, 123, 127, 70,  93, 209 , 125},//ViaPoint_8
                              {132 , 116, 202, 154, 65 , 119, 123, 121, 58,  90, 194 , 118},//ViaPoint_9
                             /* {132 , 116, 209, 147, 65 , 114, 123, 121, 68,  96, 210 , 116},//ViaPoint_10 */
                              {132 , 115, 166, 190, 64 , 118, 123, 121, 62,  89, 197 , 109},//ViaPoint_10
                         };
                        
void setup()
  {
    byte i,b;
    Serial.begin(115200);
    byte LastID, Torque;
    LastID=11;
    Torque=0; //0(max)~4(min)
    stop_Post(LastID,Torque);
    b=availableMemory();
    Serial.println(b,DEC);
    delay(1500);
   for(i=0;i<1;i++)
   {
      motionA(LastID,Torque);
   }
    stop_Post(LastID,Torque);
  }
  
void loop()
{
  
  
}
Code:
void SyncPosSend(byte LastID, byte Torque ,byte *PosPtr)
{
  byte i, Checksum;
  i=0;
  Checksum=0;
  Serial.print(Header,BYTE);
  Serial.print((Torque<<5)|0x1f,BYTE);
  Serial.print(LastID+1,BYTE);
    for(i=0; i<=LastID; i++)
      {
        Serial.print(*(PosPtr+i),BYTE);
        Checksum ^=*(PosPtr+i);
      }
      
  Checksum &=0x7f;
  Serial.print(Checksum,BYTE);
  
}
Code:
void motionA(byte LastID, byte Torque)
{
    byte ViaPoint;
    ViaPoint=0;
    for (ViaPoint = 0; ViaPoint <= 10; ViaPoint++)      
          {
                 PosPtr=&WalkPosArray[ViaPoint][0];
                 SyncPosSend(LastID,Torque,PosPtr);
                 //Serial.println();
                 delay(650);
            }
}
Code:
void stop_Post(byte LastID, byte Torque)
{
    PosPtr=ZeroPosArray;
    SyncPosSend(LastID,Torque,PosPtr);//initialise
}


i really need helps!!!!!!!!!
3  Forum 2005-2010 (read only) / Troubleshooting / Re: communication breakdown between my arduino & servo on: May 08, 2009, 10:26:57 pm
HI..do you want me to post it down here or on the url?
4  Forum 2005-2010 (read only) / Troubleshooting / communication breakdown between my arduino & servo on: May 07, 2009, 08:17:51 am
Hi guys, i am currently working on a project that use arduino to control 12servos. I am using the pin 0 and 1(Communication: Multi drop Full Duplex UART serial communication) to send packets of commands to all servos which are connected in daisy chain manner. Initially, everything seems to work fine as all the servos respond according to the commands transmitted from arduino. But after a few weeks later, those packets commands seem to only able to transmit to a few servos and the rest of the servo didnt receive any commands. Can someone tell me what is going on or tell me what can i do? :'(

thanks in advance
5  Forum 2005-2010 (read only) / Syntax & Programs / Re: help in codes on: September 25, 2009, 12:42:59 pm
please..............
6  Forum 2005-2010 (read only) / Syntax & Programs / Re: help in codes on: September 22, 2009, 11:57:31 am
any kind soul out there to help me point out my mistakes?
7  Forum 2005-2010 (read only) / Syntax & Programs / Re: help in codes on: September 21, 2009, 11:40:50 am
Code:
void SmoothStepInterpolation(float N)
{
  byte row, col, timer;
  float V;          //smoothstep expression variable
  int X;            //final smoothstep value.
  byte Min, Max;

  
  

for (row = 0; row < 12; row++)
{
  for(col=0; col<12; col++)
  {
Min=ForwardPosArray[row][col]; // should i use pointer?
  Max=ForwardPosArray[row+1][col];//should i use pointer?
    V = j / N;                      //interation divided by the no. of steps.
    V = SMOOTHSTEP (V);             //run the smoothstep expression on V.
    X = (Max * V) + (Min * (1 - V));    //run the linear interpolation expression using the current smoothstep result.
    Serial.print(X,DEC);          //prints the smoothstep value
    
    j++;
  }  
}
 }  

i moved Min and Max into the for loop to solve the problem, but the output is not in accordance to the array. what have went wrong?
8  Forum 2005-2010 (read only) / Syntax & Programs / Re: help in codes on: September 21, 2009, 11:17:46 am
Code:
#define SMOOTHSTEP(x) ((x) * (x) * (3 - 2 * (x))) //SMOOTHSTEP expression.
 
byte j = 0;        //an interator.
byte N = 5;      //input no. of steps for transition.

byte ForwardPosArray[11][12]={/* ID 0 ,  1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ,  8 ,   9,  10 ,  11 */
                                  {0  , 100, 200, 300, 400 , 500, 600, 700, 800, 900, 1000, 3000},//ViaPoint_0                                
                                  {10 , 110, 210, 310, 410 , 510, 610, 710, 810, 910, 1100, 3100},//ViaPoint_1                                  
                                  {20 , 120, 220, 320, 420 , 520, 620, 720, 820, 920, 1200, 3200},//ViaPoint_2
                                  {30 , 130, 230, 330, 430 , 530, 630, 730, 830, 930, 1300, 3300},//ViaPoint_3                                  
                                  {40 , 140, 240, 340, 440 , 540, 640, 740, 840, 940, 1400, 3400},//ViaPoint_4                                
                                  {50 , 150, 250, 350, 450 , 550, 650, 750, 850, 950, 1500, 3500},//ViaPoint_5
                                  {60 , 160, 260, 360, 460 , 560, 660, 760, 860, 960, 1600, 3600},//ViaPoint_6                                
                                  {70 , 170, 270, 370, 470 , 570, 670, 770, 870, 970, 1700, 3700},//ViaPoint_7
                                  {80 , 180, 280, 380, 480 , 580, 680, 780, 880, 980, 1800, 3800},//ViaPoint_8                                  
                                  {90 , 190, 290, 390, 490 , 590, 690, 790, 890, 990, 1900, 3900},//ViaPoint_9                                
                                  {100, 200, 300, 400, 500 , 600, 700, 800, 900, 1000,2000, 4000},//ViaPoint_10
                         };  
void setup()
  {
    Serial.begin(115200);
  }  
  
void loop()
  {
    if ( j < N )                      //keep looping until we hit predefined max no. of steps.
    {
      SmoothStepInterpolation(N);
    }          
  }
Code:
void SmoothStepInterpolation(float N)
{
  byte row, col, timer;
  float V;          //smoothstep expression variable
  int X;            //final smoothstep value.
  byte Min, Max;

  
  Min=ForwardPosArray[row][col]; // should i use pointer?
  Max=ForwardPosArray[row+1][col];//should i use pointer?

for (row = 0; row < 12; row++)
{
  for(col=0; col<12; col++)
  {
    V = j / N;                      //interation divided by the no. of steps.
    V = SMOOTHSTEP (V);             //run the smoothstep expression on V.
    X = (Max * V) + (Min * (1 - V));    //run the linear interpolation expression using the current smoothstep result.
    Serial.print(X,DEC);          //prints the smoothstep value
    
    j++;
  }  
}
 }  

can some one tell me why i cant interpolate  those values in array and serial.print? do i need to use pointer for Min=ForwardPosArray[row][col]; // should i use pointer?
 Max=ForwardPosArray[row+1][col];//should i use pointer?
9  Forum 2005-2010 (read only) / Syntax & Programs / Re: help in codes on: September 17, 2009, 11:20:10 am
i am going to interpolate this array with steps of 5 to 10
Code:
byte ForwardPosArray[11][12]={/* ID 0 ,  1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ,  8 ,   9,  10 ,  11 */
                                  {132 , 116, 188, 161, 58 , 119, 123, 121, 62,  89, 197 , 121},//ViaPoint_0                                
                                  {132 , 115, 166, 190, 64 , 118, 123, 121, 62,  89, 197 , 109},//ViaPoint_1                                  
                                  {132 , 116, 182, 154, 45 , 119, 123, 121, 53,  92, 191 , 121},//ViaPoint_2
                                      {132 , 122, 180, 157, 46 , 125, 123, 127, 55,  89, 190 , 127},//ViaPoint_3                                  
                                  {132 , 129, 183, 158, 50 , 132, 123, 134, 48,  96, 190 , 134},//ViaPoint_4                                
                                  {132 , 129, 188, 161, 58 , 132, 123, 134, 41, 103, 190 , 134},//ViaPoint_5
                                  {132 , 129, 180, 161, 58 , 142, 123, 135, 84,  60, 191 , 135},//ViaPoint_6                                
                                  {132 , 129, 197, 158, 64 , 132, 123, 134, 68,  96, 210 , 134},//ViaPoint_7
                                  {132 , 122, 195, 161, 65 , 125, 123, 127, 70,  93, 209 , 125},//ViaPoint_8                                  
                                  {132 , 116, 202, 154, 65 , 119, 123, 121, 58,  90, 194 , 118},//ViaPoint_9                                
                                  {132 , 115, 166, 190, 64 , 118, 123, 121, 62,  89, 197 , 109},//ViaPoint_10
10  Forum 2005-2010 (read only) / Syntax & Programs / Re: help in codes on: September 17, 2009, 09:59:35 am
hmm...the output is same as mine..but can the code deal with multiple arrays[10][11]? the codes in the header file seem too hard for me to digest too..
11  Forum 2005-2010 (read only) / Syntax & Programs / Re: help in codes on: September 16, 2009, 12:10:37 pm
sad to say...i have to do it in runtime. otherwise i have to manually calculate the so-call average value and put into the array
12  Forum 2005-2010 (read only) / Syntax & Programs / Re: help in codes on: September 16, 2009, 12:06:16 pm
Code:
#define SMOOTHSTEP(x) ((x) * (x) * (3 - 2 * (x))) //SMOOTHSTEP expression.

byte j = 0;        //an interator.
byte N = 100;      //input no. of steps for transition.
float V;          //smoothstep expression variable
int X;            //final smoothstep value.
float A = 0.0;    //input min value.
float B = 255.0;  //input max value.
void setup()
  {
    Serial.begin(115200);
  }  
  
void loop()
  {
    if ( j < N )                      //keep looping until we hit predefined max no. of steps.
    {
      SmoothStepInterpolation(A,B,N);
    }          
  }
Code:
void SmoothStepInterpolation(float A, float B, float N)
{
  byte timer;
  timer=TimerControl();
  
  V = j / N;                      //interation divided by the no. of steps.
  V = SMOOTHSTEP (V);             //run the smoothstep expression on V.
  X = (B * V) + (A * (1 - V));    //run the linear interpolation expression using the current smoothstep result.
  Serial.println(X);          //prints the smoothstep value
  delay(timer);
  j++;
    
 }  

let say i'm going to replace the values assigned to A and B with the array of values which i posted previously. is it possible to serialprint the orignal and the calculated values respectively?
13  Forum 2005-2010 (read only) / Syntax & Programs / Re: help in codes on: September 16, 2009, 11:47:43 am
hmm..in fact the example which you had stated, is what i really want. the problem is that i dont know how to insert the calculated value into the orignal array
14  Forum 2005-2010 (read only) / Syntax & Programs / Re: help in codes on: September 15, 2009, 12:29:13 pm
Quote
Re: help in codes
Reply #1 - Yesterday at 18:31:33   When is your assignment due?
end of next month .

Quote
hey

1.
u posted it 3 minutes before... maybe u want to delete that topic? or is that impossible?
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1252948872

opps..sorry..the internet connection was lagging so i double posted it.

actually, i am using the smoothstep interpolation in this array. i want to calculate the smoothstep points in between each via point. say via pt0 and pt1, pt1 and pt2, pt2 and pt3.........till pt 10 and pt 11. i was wondering how am i going to do put those new transition points back into the same or new array...sorry..i also dont know how explain to clearly..hope u guys know what i really mean..
thanks

Code:
byte ForwardPosArray[11][12]={/* ID 0 ,  1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ,  8 ,   9,  10 ,  11 */
                                  {132 , 116, 188, 161, 58 , 119, 123, 121, 62,  89, 197 , 121},//ViaPoint_0                                
                                  {132 , 115, 166, 190, 64 , 118, 123, 121, 62,  89, 197 , 109},//ViaPoint_1                                  
                                  {132 , 116, 182, 154, 45 , 119, 123, 121, 53,  92, 191 , 121},//ViaPoint_2
                                      {132 , 122, 180, 157, 46 , 125, 123, 127, 55,  89, 190 , 127},//ViaPoint_3                                  
                                  {132 , 129, 183, 158, 50 , 132, 123, 134, 48,  96, 190 , 134},//ViaPoint_4                                
                                  {132 , 129, 188, 161, 58 , 132, 123, 134, 41, 103, 190 , 134},//ViaPoint_5
                                  {132 , 129, 180, 161, 58 , 142, 123, 135, 84,  60, 191 , 135},//ViaPoint_6                                
                                  {132 , 129, 197, 158, 64 , 132, 123, 134, 68,  96, 210 , 134},//ViaPoint_7
                                  {132 , 122, 195, 161, 65 , 125, 123, 127, 70,  93, 209 , 125},//ViaPoint_8                                  
                                  {132 , 116, 202, 154, 65 , 119, 123, 121, 58,  90, 194 , 118},//ViaPoint_9                                
                                  {132 , 115, 166, 190, 64 , 118, 123, 121, 62,  89, 197 , 109},//ViaPoint_10
                         };
15  Forum 2005-2010 (read only) / Syntax & Programs / help in codes on: September 14, 2009, 12:24:25 pm
Hi guys,

I am going to write a code that that will calculate the average of row1 and row2 of an aray[2][12]. But how can i store the results of the average in between row1 and row2 into same array?
Pages: [1] 2 3