When I run the ping.py on my raspberry pi, I am getting inconsistent results.
Sometimes the dynamixel model number is returned, sometimes it is not.
The issue appears to correlate with whether there is a status packet or not.
As this is provided sample code I'm hoping there's some explanation for this.
I found that if I modify ping.py (see code below) to set the initial BAUD rate to 500K then immediately change it to 1m (and don't change anything else). I can run the ping code in a loop (as fast as it will run) and it will run 10k (or more) cycles before it does not get a status packet back.
The below is manual running of the ping.py code in terminal.
pi@srsVE1:~/DynamixelSDK-3.4.1/python/protocol1_0 $ python ping.py
Succeeded to open the port!
Succeeded to change the baudrate!
[ID:001] ping Succeeded. Dynamixel model number : 12
pi@srsVE1:~/DynamixelSDK-3.4.1/python/protocol1_0 $ python ping.py
Succeeded to open the port!
Succeeded to change the baudrate!
[ID:001] ping Succeeded. Dynamixel model number : 12
pi@srsVE1:~/DynamixelSDK-3.4.1/python/protocol1_0 $ python ping.py
Succeeded to open the port!
Succeeded to change the baudrate!
[ID:001] ping Succeeded. Dynamixel model number : 12
pi@srsVE1:~/DynamixelSDK-3.4.1/python/protocol1_0 $ python ping.py
Succeeded to open the port!
Succeeded to change the baudrate!
[TxRxResult] There is no status packet!
[ID:001] ping Succeeded. Dynamixel model number : 0
pi@srsVE1:~/DynamixelSDK-3.4.1/python/protocol1_0 $ python ping.py
Succeeded to open the port!
Succeeded to change the baudrate!
[TxRxResult] There is no status packet!
[ID:001] ping Succeeded. Dynamixel model number : 0
pi@srsVE1:~/DynamixelSDK-3.4.1/python/protocol1_0 $ python ping.py
Succeeded to open the port!
Succeeded to change the baudrate!
[TxRxResult] There is no status packet!
[ID:001] ping Succeeded. Dynamixel model number : 0
pi@srsVE1:~/DynamixelSDK-3.4.1/python/protocol1_0 $ python ping.py
Succeeded to open the port!
Succeeded to change the baudrate!
[TxRxResult] There is no status packet!
[ID:001] ping Succeeded. Dynamixel model number : 0
pi@srsVE1:~/DynamixelSDK-3.4.1/python/protocol1_0 $ python ping.py
Succeeded to open the port!
Succeeded to change the baudrate!
[ID:001] ping Succeeded. Dynamixel model number : 12
++++modified bits of ping.py+++++++++++++++++++++++
Set port baudrate to TEMP
if dynamixel.setBaudRate(port_num, BAUDRATE_TEMP):
print("Succeeded to change the TEMP baudrate!")
else:
print("Failed to change the baudrate!")
print("Press any key to terminate...")
getch()
quit()
Set port baudrate to PERM
if dynamixel.setBaudRate(port_num, BAUDRATE_PERM):
print("Succeeded to change the PERM baudrate!")
else:
print("Failed to change the baudrate!")
print("Press any key to terminate...")
getch()
quit()
Try to ping the Dynamixel
Get Dynamixel model number
count = 1
while True:
dxl_model_number = dynamixel.pingGetModelNum(port_num, PROTOCOL_VERSION, DXL_ID)
if dynamixel.getLastTxRxResult(port_num, PROTOCOL_VERSION) != COMM_SUCCESS:
dynamixel.printTxRxResult(PROTOCOL_VERSION, dynamixel.getLastTxRxResult(port_num, PROTOCOL_VERSION))
elif dynamixel.getLastRxPacketError(port_num, PROTOCOL_VERSION) != 0:
dynamixel.printRxPacketError(PROTOCOL_VERSION, dynamixel.getLastRxPacketError(port_num, PROTOCOL_VERSION))
if dxl_model_number == 12:
print("[ID:%03d] ping Succeeded. Dynamixel model number : %d" % (DXL_ID, dxl_model_number))
count = count + 1
else:
print "model number not returned"
print count
break