Why is This important?
Because a robot need to move their motors all the same time especially for a joint robot. Let's think about that you want to push a door. You will reach out your hand by unfolding your arm and shoulder at the same time. If there is time gap between shoulder and arm, you cannot push the door properly. A normal RC servo motor is connected main controller in parallel way which means you can control them together at the same time. But, Dynamixel, on the other hand, shares their data line. There must be time gap between each other because every instruction is carried by communication. Some motors get data packet earlier than others. If the motors move as soon as they get data packet, we may have serious problem. We can say this as asynchronized.How can make them synchronized? Robotis gives two ways to fix this problem.
Features we will use
1. Reg Write and Action - keeping instruction and waiting for Action instruction.
Let's say there are 3 bus drivers and a boss. The boss just give them their destination. They will wait until boss say "Action"Boss: Here is your destinations. A goes a city, B goes b city and C goes c city. Wait until I say "Action"
Bus Divers: Okay.
(waiting...)
Boss : Action!
Bus Drivers: (go now at the same time)
http://emanual.robotis.com/docs/en/dxl/protocol1/#reg-write
2. Sync Write - keeping instruction, waiting until the packet finished
Boss : I am going to give you destinations. Everyone has to wait for I finish this announcement. As soon as I finish this statement, go yours immediately. A driver goes a, B driver goes b and C driver goes c. Let's go!Drivers : (go now at the same time)
http://emanual.robotis.com/docs/en/dxl/protocol1/#sync-write
Let's Try!
In this post, we are going to use "Sync Write". Because it is more intuitive in my opinion.
Preparation
sample code
I modified the sample code for Dynamixel AX12. put the file into the folder .\python\tests\protocol1_0\
part list
1 * USB2DYNAMIXEL
1 * SMPS2Dynamixel
ID Setting
You need to prepare 2 * AX12, Change their ID as '1' for one, '2' for the other.
The simplest way to change ID is to use Dynamixel Wizard with USB2Dynamixel.
Please refer to this (https://www.youtube.com/watch?v=YJ9b68hx5Qc)
Let's Try!
if you don't know how to run these examples, please refer to the previous post http://eunchanpark.blogspot.com/2018/08/how-to-use-ax12-robotis-dynamixel-with.html
I changed some code for AX12. The original code was for MX series. I somehow don't understand why Robotis gives the example as Protocol_2.0 version. Anyway, if you read the code, you will understand it. Sync write only set the start address of the instruction table. You can write parameters from the starting address. It is somehow tricky but efficent. I think that is one of why the goal position address and the goal speed address is adjacent to each other.
reference
http://emanual.robotis.com/docs/en/dxl/protocol1/
http://emanual.robotis.com/docs/en/dxl/ax/ax-12a/


No comments:
Post a Comment