Beispiel #1
0
# MAIN
#------------------------------------------------------------------------------
if __name__ == '__main__':
    iface = get_iface('ixxat')
    io_service = canio2.IOService(iface)
    
    NODE_ID = 1
    node = CANopenNode(NODE_ID, io_service) 
    waiter = canio2.TriggersWaiter(io_service)
    
    print 'Resetting node...' 
    if node.reset(5000) == False:
        print 'Boot Timeout'
        sys.exit(1)
    print 'Node state after reset: ' + str(node.state)
    node.state = CANopenNode.STATES.OPERATIONAL
    print 'Node state : ' + str(node.state)

    print('* Drive Initialization.')
    print('\tClear Faults.')
    node.wu16(0x6040,0x80) 
    print('\tMotor parameters Setup.')
    node.wu16(0x6402,1) # motor type
    node.wu16(0x6410,1,7000) # cont. current limit, ma
    node.wu16(0x6410,2,8000) # out current limit, ma
    node.wu8(0x6410,3,1) # pole paires
    node.wu16(0x6410,4,3000) # max speed in current mode
    node.wu16(0x6410,5,400) # Thermal constant
    print('\tPosition Sensor Setup.')
    node.wu16(0x2210, 1, 500) # enc. pulse n
    node.wu16(0x2210, 2, 1) # pos. sensor type
Beispiel #2
0
#------------------------------------------------------------------------------
# init
#------------------------------------------------------------------------------
iface = get_iface('ixxat')
io_service = canio2.IOService(iface)

#------------------------------------------------------------------------------
# Main
#------------------------------------------------------------------------------
NODE_ID = 1
node = CANopenNode(NODE_ID, io_service)

print 'Node state:', node.state

print 'Setting state to:', CANopenNode.STATES.STOPPED
node.state = CANopenNode.STATES.STOPPED
print 'Node state: ', node.state

print 'Setting state to:', CANopenNode.STATES.PRE_OPERATIONAL
node.state = CANopenNode.STATES.PRE_OPERATIONAL
print 'Node state:', node.state

print 'Setting state to:', CANopenNode.STATES.OPERATIONAL

node.state = CANopenNode.STATES.OPERATIONAL
print 'Node state: ', node.state

for i in range(10):
    print 'Resetting node...'
    if node.reset(5000) == False:
        print 'Error: Boot Timeout'