Hi there
I can't seem to get acceleration/deceleration using the apparently available GOAL_ACCELERATION function (control adress 73 on the MX 28AR).
I'm using Open CM 1.0.2 IDE on a Mac and the OpenCM9.04 board together with the 485EXP extension board.
The Dynamixel turns at the specified speed but no acceleration and decelleration.
The documentation is a bit sparse for my liking - I need everything spelled out so I'm not sure if I have the correct parameters in the correct order.
I adapted an example to test the acceleration function - could someone look at it to tell me what I'm doing wrong?
Thanks!
jomo
Code:
/* Dynamixel setPosition Example
Turns left the dynamixel , then turn right for one second,
repeatedly with different velocity.
Compatibility
CM900 O
OpenCM9.04 O
Dynamixel Compatibility
AX MX RX XL-320 Pro
CM900 O O O O X
OpenCM9.04 O O O O X
**** OpenCM 485 EXP board is needed to use 4 pin Dynamixel and Pro Series ****
created 16 Nov 2012
by ROBOTIS CO,.LTD.
*/
//Adapted by Jomo from example software
/* Serial device defines for dxl bus */
#define DXL_BUS_SERIAL1 1 //Dynamixel on Serial1(USART1) <-OpenCM9.04
#define DXL_BUS_SERIAL2 2 //Dynamixel on Serial2(USART2) <-LN101,BT210
#define DXL_BUS_SERIAL3 3 //Dynamixel on Serial3(USART3) <-OpenCM 485EXP
/* Dynamixel ID definitions */
#define Feet 1 //ID 1 for rotation of Feet
#define Waist 2 // ID 2 for rotation of Waist
#define GOAL_POSITION 30 // 30 is Goal Position control address
#define MOVING 46 // 46 is moving control adress
#define GOAL_ACCEL 73 // 73 is goal acceleration control address
Dynamixel Dxl(DXL_BUS_SERIAL3); // We use this port because we're on the 485EXP board
///////////////////////////////////////////////////////////////////////////////////////
//VARIABLES
byte isMoving = 0;
int goalPosition = 0;
///////////////////////////////////////////////////////////////////////////////////////
void setup() {
Dxl.begin(3); // Dynamixel 2.0 Baudrate -> 0: 9600, 1: 57600, 2: 115200, 3: 1Mbps
SerialUSB.begin(); // Open the serial USB port for debugging messages
// All Dynamixels are used in the joint mode
Dxl.jointMode(Feet); //jointMode() is to use position mode
Dxl.jointMode(Waist);
}
///////////////////////////////////////////////////////////////////////////////////////
void loop() {
isMoving = Dxl.readByte(Feet, MOVING); // Check if Feet are still moving
if(isMoving == 0){
Dxl.writeWord(Feet, GOAL_ACCEL, 10);
Dxl.writeWord(Feet, GOAL_POSITION, goalPosition);
//toggle the position if goalPosition is 1000, set to 0, if 0, set to 1000
if(goalPosition == 4000)
goalPosition = 0;
else
goalPosition = 4000;
}
}
Bookmarks