This object is the master of all other objects for Bioloid. It has only three methods available for user.
connect("device",int speed) Connect to RS232 Bioloid network. This method need to be call first of all other commands. it returns 0 on connection success.
under Unix system:
Bioloid.connect("/dev/ttyS0", 57600);
[00000066] 0
under Windows system:
Bioloid.connect("COM1", 57600);
[00000076] 0
Please, note that the firmware flashed in Bioloid CM-5 is programmed for working at 57600 bauds for the moment; Giving 57600 as parameter in all cases for the second parameter is a good practise.
ping(int Id) Ping ID of a dynamixel to test if dynamixel is present on network. This method return the ID if dynamixel is present, 255 if not present or ID unavailable
Bioloid.ping(12); [00004993] 12 Bioloid.ping(29); [00012900] 255
A dynamixel with ID 12 was on network, but no one with ID 29.
scan() Scan all the 253 available IDs (0~252, no need to test broadcast ID 254 and #253 is reserved for CM-5 management), and return list of all dynamixels on the network. This is a blocking function that can take a bit time (2~3 seconds). In most cases, you need just to call it once at start to discover network (just after doing a Bioloid.connect ).
Bioloid.scan(); scanning network, may take some time... [00099415] [12, 18, 100] Bioloid; [00109621] OBJ [listAXS1:[100],load:1,listAX12:[12, 18]]
This function automatically fill the Bioloid.listAXS1 and Bioloid.listAX12 lists
with the number of the present nodes ID on the network.
Note: How scan() works: it does a ping on all IDs and wait for reply.
After calling this functions, two lists are available in Bioloid object: Bioloid.listAXS1 and Bioloid.listAX12.
The lists contain IDs (sorted) of respectivly AX-S1 and AX-12 dynamixels.
You can use these lists to create all your motors and sensors objects. (see <bioloid-dir>/Bioloid.data/bioloid_scan.u
in your installation directory for more details and examples).