ESC_ASCII_VALUE = 0x1b

COMM_SUCCESS = 0  # Communication Success result value
COMM_TX_FAIL = -1001  # Communication Tx Failed

# Initialize PortHandler Structs
# Set the port path
# Get methods and members of PortHandlerLinux or PortHandlerWindows
port_num = dynamixel.portHandler(DEVICENAME)

# Initialize PacketHandler Structs
dynamixel.packetHandler()

# Initialize groupBulkWrite Struct
groupwrite_num = dynamixel.groupBulkWrite(port_num, PROTOCOL_VERSION)

# Initialize Groupsyncwrite instance
groupread_num = dynamixel.groupBulkRead(port_num, PROTOCOL_VERSION)

index = 0
dxl_comm_result = COMM_TX_FAIL  # Communication result
dxl_addparam_result = 0  # AddParam result
dxl_getdata_result = 0  # GetParam result
dxl_goal_position = [DXL_MINIMUM_POSITION_VALUE,
                     DXL_MAXIMUM_POSITION_VALUE]  # Goal position

dxl_error = 0  # Dynamixel error
dxl_led_value = [0, 255]  # Dynamixel LED value for write
dxl1_present_position = 0  # Present position
dxl2_led_value_read = 0  # Dynamixel moving status
ESC_ASCII_VALUE             = 0x1b

COMM_SUCCESS                = 0                             # Communication Success result value
COMM_TX_FAIL                = -1001                         # Communication Tx Failed

# Initialize PortHandler Structs
# Set the port path
# Get methods and members of PortHandlerLinux or PortHandlerWindows
port_num = dynamixel.portHandler(DEVICENAME)

# Initialize PacketHandler Structs
dynamixel.packetHandler()

# Initialize groupBulkWrite Struct
groupwrite_num = dynamixel.groupBulkWrite(port_num, PROTOCOL_VERSION)

# Initialize Groupsyncwrite instance
groupread_num = dynamixel.groupBulkRead(port_num, PROTOCOL_VERSION)

index = 0
dxl_comm_result = COMM_TX_FAIL                              # Communication result
dxl_addparam_result = 0                                     # AddParam result
dxl_getdata_result = 0                                      # GetParam result
dxl_goal_position = [DXL_MINIMUM_POSITION_VALUE, DXL_MAXIMUM_POSITION_VALUE]         # Goal position

dxl_error = 0                                               # Dynamixel error
dxl_led_value = [0, 255]                                    # Dynamixel LED value for write
dxl1_present_position = 0                                   # Present position
dxl2_led_value_read = 0                                     # Dynamixel moving status