Hi everyone,
In order to use the powerful of Matlab Toolboxes and Simulink . I'm going to build a native library to control the Dynamixel Motors from Matlab directly.
My Source Code: https://github.com/quangthanh010290/Dynamixel
I. Using Dynamixel SDK
- Step 1: Create Class
o = MyDynamixel();
- Step 2: Initialize the serial port
o.portNum = 16;
o.baudNum = 1;
o.init()
- Step 3: Add dynamixel motor base on their IDs
o.addDevice(5);
o.addDevice(16);
- Step 4: Set Speed for dynamixel (optimal, can use default setup)
o.setSpeed('id',5,'RPM',10);
o.setSpeed('id',16,'RPM',10);
- Step 5: Turn the Dynamixels
o.writeAngle('id',5,'deg',0);
o.writeAngle('id',16,'deg',0);
- Step 6: Unload resource
o.Exit();
- Result:
Thank you all for support people who are trying to connect these motors. I have a question, what can I do if I run the o.init() function but it always shows the error connection message? I followed all the steps you put above but, when I try to connect the dynamixel motors, command window says "Cannot init dynamixel".
ReplyDeletePlease help me!!!
DeleteYou should take a look for you serial port , and replace the port number 16 in this line "o.portNum = 16;"
DeleteHello! I have a problem with using your library. I copied files from githup to Matlab folder. When I try to run it output error message in line: o = MyDynamixel();
ReplyDeleteError mesage:
Serial port does not configure
Index exceeds matrix dimensions.
Error in loadlibrary>getLoadlibraryCompilerConfiguration (line 527)
Error in loadlibrary (line 263)
Error in MyDynamixel (line 35)
loadlibrary('dynamixel', 'dynamixel.h')
Error in testDynamixel (line 5)
o = MyDynamixel();