コード例 #1
0
    if dxl_addparam_result != 1:
        fprintf(stderr, "[ID:%03d] groupBulkWrite addparam failed", DXL1_ID)
        quit()

    # Add parameter storage for Dynamixel#2 LED value
    dxl_addparam_result = ctypes.c_ubyte(
        dynamixel.groupBulkWriteAddParam(groupwrite_num, DXL2_ID,
                                         ADDR_PRO_LED_RED, LEN_PRO_LED_RED,
                                         dxl_led_value[index],
                                         LEN_PRO_LED_RED)).value
    if dxl_addparam_result != 1:
        fprintf(stderr, "[ID:%03d] groupBulkWrite addparam failed", DXL2_ID)
        quit()

    # Bulkwrite goal position and LED value
    dynamixel.groupBulkWriteTxPacket(groupwrite_num)
    if dynamixel.getLastTxRxResult(port_num, PROTOCOL_VERSION) != COMM_SUCCESS:
        dynamixel.printTxRxResult(
            PROTOCOL_VERSION,
            dynamixel.getLastTxRxResult(port_num, PROTOCOL_VERSION))

    # Clear bulkwrite parameter storage
    dynamixel.groupBulkWriteClearParam(groupwrite_num)

    while 1:
        # Bulkread present position and moving status
        dynamixel.groupBulkReadTxRxPacket(groupread_num)
        if dynamixel.getLastTxRxResult(port_num,
                                       PROTOCOL_VERSION) != COMM_SUCCESS:
            dynamixel.printTxRxResult(
                PROTOCOL_VERSION,
コード例 #2
0
        break

    # Add parameter storage for Dynamixel#1 goal position
    dxl_addparam_result = ctypes.c_ubyte(dynamixel.groupBulkWriteAddParam(groupwrite_num, DXL1_ID, ADDR_PRO_GOAL_POSITION, LEN_PRO_GOAL_POSITION, dxl_goal_position[index], LEN_PRO_GOAL_POSITION)).value
    if dxl_addparam_result != 1:
        fprintf(stderr, "[ID:%03d] groupBulkWrite addparam failed", DXL1_ID)
        quit()

    # Add parameter storage for Dynamixel#2 LED value
    dxl_addparam_result = ctypes.c_ubyte(dynamixel.groupBulkWriteAddParam(groupwrite_num, DXL2_ID, ADDR_PRO_LED_RED, LEN_PRO_LED_RED, dxl_led_value[index], LEN_PRO_LED_RED)).value
    if dxl_addparam_result != 1:
        fprintf(stderr, "[ID:%03d] groupBulkWrite addparam failed", DXL2_ID)
        quit()

    # Bulkwrite goal position and LED value
    dynamixel.groupBulkWriteTxPacket(groupwrite_num)
    dxl_comm_result = dynamixel.getLastTxRxResult(port_num, PROTOCOL_VERSION)
    if dxl_comm_result != COMM_SUCCESS:
        print(dynamixel.getTxRxResult(PROTOCOL_VERSION, dxl_comm_result))

    # Clear bulkwrite parameter storage
    dynamixel.groupBulkWriteClearParam(groupwrite_num)

    while 1:
        # Bulkread present position and moving status
        dynamixel.groupBulkReadTxRxPacket(groupread_num)
        dxl_comm_result = dynamixel.getLastTxRxResult(port_num, PROTOCOL_VERSION)
        if dxl_comm_result != COMM_SUCCESS:
            print(dynamixel.getTxRxResult(PROTOCOL_VERSION, dxl_comm_result))

        # Check if groupbulkread data of Dynamixel#1 is available