Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

REG_WRITE, SYNC_WRITE etc.... for Python... ?

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
4 postsPage 1 of 1
4 postsPage 1 of 1

REG_WRITE, SYNC_WRITE etc.... for Python... ?

Post by Siel » Fri Sep 26, 2008 2:22 pm

Post by Siel
Fri Sep 26, 2008 2:22 pm

Hi Everybody

Somebody know how to use the REG_WRITE and other stuff with the command libc.dxl_set_txpacket_instruction
I really don't get it, if someone could help me ... !
I tried the example 5 in the manual, but nothing happen.... !

I think it's quiet the same thing with C/C++... I just don't understand how to tell something to my dynamixel in this way.
Usually I use libc.dxl_write_word(3, 30, 300)
id 3 go to position 300...

Thanks
S:el
Hi Everybody

Somebody know how to use the REG_WRITE and other stuff with the command libc.dxl_set_txpacket_instruction
I really don't get it, if someone could help me ... !
I tried the example 5 in the manual, but nothing happen.... !

I think it's quiet the same thing with C/C++... I just don't understand how to tell something to my dynamixel in this way.
Usually I use libc.dxl_write_word(3, 30, 300)
id 3 go to position 300...

Thanks
S:el
Siel
Newbie
Newbie
Posts: 6
Joined: Fri Sep 19, 2008 2:32 pm

Post by limor » Sat Sep 27, 2008 6:17 pm

Post by limor
Sat Sep 27, 2008 6:17 pm

Hi,
Have you read the following part in the manual ?

4.3.5. gbInstructionPacket
gbInstructionPacket is an arrangement pointer to save contents of Instruction Packets.... As for the [other] programming languages in which access through global variables is unavailable... to make the Instruction Packets, there is no need to input the Header and Checksum. Upon calling on dxl_tx_packet or dxl_txrx_packet function, the Header and Checksum are automatically made and transmitted.

Code: Select all
(in python call dxl_set_txpacket_instruction() for each of the following lines):
gbInstructionPacket[ID] = 3; // ID is 3
gbInstructionPacket[INSTRUCTION] = 3; // Instruction Code is 3
gbInstructionPacket[PARAMETER] = 10; // Parameter 1 is 10
gbInstructionPacket[PARAMETER+1] = 20; // Parameter 2 is 20
gbInstructionPacket[PARAMETER+2] = 30; // Parameter 3 is 30
gbInstructionPacket[LENGTH] = 3+2; // Length is Parameter number + 2
dxl_tx_packet( );


hope this helps

In case someone reading this thread doesnt know: Robotis have released a formal SDK that supports most programming languages in Windows environment - http://robosavvy.com/forum/viewtopic.php?t=2726
Hi,
Have you read the following part in the manual ?

4.3.5. gbInstructionPacket
gbInstructionPacket is an arrangement pointer to save contents of Instruction Packets.... As for the [other] programming languages in which access through global variables is unavailable... to make the Instruction Packets, there is no need to input the Header and Checksum. Upon calling on dxl_tx_packet or dxl_txrx_packet function, the Header and Checksum are automatically made and transmitted.

Code: Select all
(in python call dxl_set_txpacket_instruction() for each of the following lines):
gbInstructionPacket[ID] = 3; // ID is 3
gbInstructionPacket[INSTRUCTION] = 3; // Instruction Code is 3
gbInstructionPacket[PARAMETER] = 10; // Parameter 1 is 10
gbInstructionPacket[PARAMETER+1] = 20; // Parameter 2 is 20
gbInstructionPacket[PARAMETER+2] = 30; // Parameter 3 is 30
gbInstructionPacket[LENGTH] = 3+2; // Length is Parameter number + 2
dxl_tx_packet( );


hope this helps

In case someone reading this thread doesnt know: Robotis have released a formal SDK that supports most programming languages in Windows environment - http://robosavvy.com/forum/viewtopic.php?t=2726
limor
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1845
Joined: Mon Oct 11, 2004 1:00 am
Location: London, UK

Post by Siel » Mon Sep 29, 2008 10:42 am

Post by Siel
Mon Sep 29, 2008 10:42 am

Hi,

Thanks for your reply...
I tried many things...
So, in relation to your reply I tried this in the IDLE of python

>>> from ctypes import *
>>> libc = windll.dynamixel
>>> libc.dxl_initialize()
1

#id is 2
>>> libc.dxl_set_txpacket_id(2)
2226178

# I hope that 3 is INST_WRITE, readed on the example at the end of the manual...
>>> libc.dxl_set_txpacket_instruction(3)
2226179

# write on register 30 goal position
>>> libc.dxl_set_txpacket_parameter(0, 30)
2225950

# Reach the position 200
>>> libc.dxl_set_txpacket_parameter(1, 200)
2226120

# length...?
>>> libc.dxl_set_txpacket_length(4)
2226180

>>> libc.dxl_tx_packet()
1

--> Nothing happen :)
Servo was tested before on Dynamixel Manager...


'rrrrrrr....
Something is wrong somewhere, but I don't know where... !
Hi,

Thanks for your reply...
I tried many things...
So, in relation to your reply I tried this in the IDLE of python

>>> from ctypes import *
>>> libc = windll.dynamixel
>>> libc.dxl_initialize()
1

#id is 2
>>> libc.dxl_set_txpacket_id(2)
2226178

# I hope that 3 is INST_WRITE, readed on the example at the end of the manual...
>>> libc.dxl_set_txpacket_instruction(3)
2226179

# write on register 30 goal position
>>> libc.dxl_set_txpacket_parameter(0, 30)
2225950

# Reach the position 200
>>> libc.dxl_set_txpacket_parameter(1, 200)
2226120

# length...?
>>> libc.dxl_set_txpacket_length(4)
2226180

>>> libc.dxl_tx_packet()
1

--> Nothing happen :)
Servo was tested before on Dynamixel Manager...


'rrrrrrr....
Something is wrong somewhere, but I don't know where... !
Siel
Newbie
Newbie
Posts: 6
Joined: Fri Sep 19, 2008 2:32 pm

Post by Siel » Mon Sep 29, 2008 2:34 pm

Post by Siel
Mon Sep 29, 2008 2:34 pm

In fact, what I am trying to do, is to execute with only one lign, the differents positions that my dynamixel have to reach...
I saw the SYNC_WRITE page 24 of the manual... !
I tried that :

>>> libc.dxl_set_txpacket_id(254)
2226430
>>> libc.dxl_set_txpacket_instruction(131)
2226307
>>> libc.dxl_set_txpacket_parameter(0, 30)
2225950
>>> libc.dxl_set_txpacket_parameter(1, 10)
2225930
>>> libc.dxl_set_txpacket_parameter(2, 2)
2225922
>>> libc.dxl_set_txpacket_parameter(3, 30)
2225950
>>> libc.dxl_set_txpacket_parameter(4, 200)
2226120
>>> libc.dxl_set_txpacket_parameter(5, 3)
2225923
>>> libc.dxl_set_txpacket_parameter(6, 30)
2225950
>>> libc.dxl_set_txpacket_parameter(7, 511)
2226175
>>> libc.dxl_tx_packet()
1


Nothing...

I am not sure I have all understood like

Parameter1 Starting address of the location where the data is to be written
Parameter2 The length of the data to be written (L)


... :D
thanks !
In fact, what I am trying to do, is to execute with only one lign, the differents positions that my dynamixel have to reach...
I saw the SYNC_WRITE page 24 of the manual... !
I tried that :

>>> libc.dxl_set_txpacket_id(254)
2226430
>>> libc.dxl_set_txpacket_instruction(131)
2226307
>>> libc.dxl_set_txpacket_parameter(0, 30)
2225950
>>> libc.dxl_set_txpacket_parameter(1, 10)
2225930
>>> libc.dxl_set_txpacket_parameter(2, 2)
2225922
>>> libc.dxl_set_txpacket_parameter(3, 30)
2225950
>>> libc.dxl_set_txpacket_parameter(4, 200)
2226120
>>> libc.dxl_set_txpacket_parameter(5, 3)
2225923
>>> libc.dxl_set_txpacket_parameter(6, 30)
2225950
>>> libc.dxl_set_txpacket_parameter(7, 511)
2226175
>>> libc.dxl_tx_packet()
1


Nothing...

I am not sure I have all understood like

Parameter1 Starting address of the location where the data is to be written
Parameter2 The length of the data to be written (L)


... :D
thanks !
Siel
Newbie
Newbie
Posts: 6
Joined: Fri Sep 19, 2008 2:32 pm


4 postsPage 1 of 1
4 postsPage 1 of 1