top of page

LIMB MOVEMENT

Limb movement consists of programming the arms and legs to move. The following codes move the Darwin's left arm, right arm, and bend the Darwin's hip.

/********************************

 *       RIGHT ARM WAVE         *

 *   Created By: Maria Ramos    *

 *******************************/

 

#define DXL_BUS_SERIAL1 1  //Dynamixel on Serial1(USART1)  <-OpenCM9.04

 

#define ID1 1

#define ID3 3

#define ID5 5

 

Dynamixel Dxl(DXL_BUS_SERIAL1);

 

void setup() {

  // Initialize the dynamixel bus:

 

  // Dynamixel 2.0 Baudrate -> 0: 9600, 1: 57600, 2: 115200, 3: 1Mbps  

  Dxl.begin(3);  

  Dxl.jointMode(ID1); //jointMode() is to use position mode

  Dxl.jointMode(ID3); //it also enables the torque on the motors

  Dxl.jointMode(ID5);

 

  Dxl.goalPosition(ID1, 512); //moves ID1 to position 512

  delay(50);

  Dxl.goalPosition(ID3, 312);

  delay(100);

  Dxl.goalPosition(ID5, 512);

  delay(500);

  Dxl.setPosition(ID1, 1023, 700); //moves ID1 to position 1023 

  delay(700);                      //with speed 700

  Dxl.setPosition(ID5, 312, 900);

  delay(200);

  Dxl.setPosition(ID5, 512, 900);

  delay(200);

  Dxl.setPosition(ID5, 312, 900);

  delay(200);

  Dxl.setPosition(ID5, 512, 900); 

  delay(500);

  Dxl.goalPosition(ID1, 512);

  delay(500);

   Dxl.goalPosition(ID3, 212);

  delay(500);

 

}

 

void loop() {

 

}

 

VIDEO COMING SOON

The left and right arm wave codes consist of sequential movements, executing a single command to a specific motor to achieve the waves. The right arm wave code executes the wave once while the left arm wave code loops the wave indefinitely.

VIDEO COMING SOON

/********************************

 *       LEFT ARM WAVE          *

 *   Created By: Maria Ramos    *

 *******************************/

 

 

/* Dynamixel ID defines */

 

#define DXL_BUS_SERIAL1 1  //Dynamixel on Serial1(USART1)  <-OpenCM9.04

 

#define ID2 2

#define ID4 4

#define ID6 6

 

#define ID7 7

#define ID8 8

#define ID9 9

#define ID10 10

#define ID11 11

#define ID12 12

#define ID13 13

#define ID14 14

#define ID15 15

#define ID16 16

 

#define P_GOAL_POSITION    30

#define P_GOAL_SPEED    32

 

Dynamixel Dxl(DXL_BUS_SERIAL1);

 

void setup() {

  // Initialize the dynamixel bus:

 

  // Dynamixel 2.0 Baudrate -> 0: 9600, 1: 57600, 2: 115200, 3: 1Mbps  

  Dxl.begin(3);  

  Dxl.jointMode(ID2); //jointMode() is to use position mode

  Dxl.jointMode(ID4);

  Dxl.jointMode(ID6);

  Dxl.jointMode(ID7);

  Dxl.jointMode(ID8);

  Dxl.jointMode(ID9);

  Dxl.jointMode(ID10);

  Dxl.jointMode(ID11);

  Dxl.jointMode(ID12);

  Dxl.jointMode(ID13);

  Dxl.jointMode(ID14);

  Dxl.jointMode(ID15);

  Dxl.jointMode(ID16);

}

 

void loop() {

  //Executes the left arm wave multiple times

  

  Dxl.goalPosition(ID2, 512); //moves ID2 to position 512

  delay(500);

  Dxl.goalPosition(ID4, 712);

  delay(2000);

  Dxl.goalPosition(ID6, 512);

  delay(2000);

  Dxl.goalPosition(ID2, 0);

  delay(2000);

  Dxl.setPosition(ID6, 712, 900); //moves ID6 to position 712

  delay(2000);                    //with speed 900

  Dxl.setPosition(ID6, 512, 900);

  delay(2000);

  Dxl.setPosition(ID6, 712, 900);

  delay(2000);

  Dxl.setPosition(ID6, 512, 900); 

  delay(2000);

  Dxl.goalPosition(ID2, 512);

  delay(2000);

  Dxl.goalPosition(ID4, 812);

  delay(2000);

}

/********************************

 *          SIMPLE BOW          *

 *   Created By: Maria Ramos    *

 *******************************/

 

/* Dynamixel ID defines */

#define ID_NUM_1  9      

#define ID_NUM_2  10

 

#define ID_NUM_3  12

#define ID_NUM_4  14

#define ID_NUM_5  16

#define ID_NUM_6  11

#define ID_NUM_7  13

#define ID_NUM_8  15

#define ID_NUM_9  8

#define ID_NUM_10 7

 

/* Control table defines */

#define P_GOAL_POSITION    30

#define P_GOAL_SPEED    32

 

/********* Sync write data  **************

 * ID1, DATA1, DATA2..., ID2, DATA1, DATA2,...

 ******************************************

 */

/* Serial device defines for dxl bus */

#define DXL_BUS_SERIAL1 1  //Dynamixel on Serial1(USART1)  <-OpenCM9.04

 

 

Dynamixel Dxl(DXL_BUS_SERIAL1);

 

word SyncPage1[30]=

  ID_NUM_1,386,100,  // 2 Dynamixels move to specified positions

  ID_NUM_2,638,100,  // with velocity 100

 

}; 

 

word SyncPage2[30]=

  ID_NUM_1,512,100, // 2 Dynamixels move to position 512

  ID_NUM_2,512,100, // with velocity 100

 

};

 

void setup(){

  // Dynamixel 2.0 Protocol -> 0: 9600, 1: 57600, 2: 115200, 3: 1Mbps 

  Dxl.begin(3);

  //Set all dynamixels as same condition.

  Dxl.writeWord( BROADCAST_ID, P_GOAL_POSITION, 512);

  Dxl.writeWord( BROADCAST_ID, P_GOAL_SPEED, 100 );

  

    /*

 * byte syncWrite(byte start_addr, byte num_of_data, int *param, int array_length);

   */

  Dxl.syncWrite(30,2,SyncPage1,24);

  delay(1000);

  Dxl.syncWrite(30,2,SyncPage2,24);

  delay(1000);

}

 

void loop(){

 

}

The simple bow is simply that; a bow. This code makes use of Sync Pages to move more than one motor simultaneously. In this case, the left side and right side fo the robot's legs must move with each other to achieve the bow.

VIDEO COMING SOON

A comprehensive user manual can be found at http://support.robotis.com/

© 2014 | Created with Wix.com | Updated 8/22/14

bottom of page