Open Zebrafish007 opened 4 years ago
Hi, I never tried to use this on windows, but I think you should write the name of the device that is shown in the device manager. So something like COM1.
Hi there,
As a user of the pyTMCL module on Windows, I can confirm that the line should read:
serial_port = Serial('COM*')
Replace * with the number that appears in the Device Manager once your USB device is connected
Hi Emma,
The issue is that serial_port = Serial('COM') can't be used because the CAN-USB is not showing as a 'COM' device. Using Zadig 2.4 to change the drivers in any selectable from the presented list didn't work either.
In the meantime I've got this far using the ntcan python lib from ESD:
MODULE_ADDRESS = 0 net=0 # logical CAN Network [0, 255] RxQS=2000 # RxQueueSize [0, 10000] RxTO=2000 # RxTimeOut in Millisconds TxQS=1 # TxQueueSize [0, 10000] TxTO=1000 # TxTimeOut in Millseconds
cif = ntcan.CIF(net,RxQS,RxTO,TxQS,TxTO)
print ('"Initialize CANBUS: %s"' % cif)
sys.stdout.flush()
# set baudrate 0 = 1MBaud
# CAN-API-Description
bus = pyTMCL.connect(cif, CAN=False)
print ('bus :', bus)
sys.stdout.flush()
motor = bus.get_motor(MODULE_ADDRESS)
print ('motor action 0 : ', motor)
motor.target_speed = 20000
print ('motor action 1 : ', motor)
motor.rotate_left = 12340
print ('motor action 2 : ', motor)
sys.stdout.flush()
sleep(5)
try:
motor.stop()
print ('And the crowd cheered and echood "Throw us a party"!')
sys.stdout.flush()
except can.CanError:
print("Message NOT sent")
sys.stdout.flush()
import ntcan import pyTMCL
With libusb-win32 (1.2.6.0) in device-manager it shows up under "libusb-win32 devices". With WinUSB (6.1.7600.16385) its under "Unversal Serial Bus devices. Then with "libbusbK (3.0.7.0) it shows as "libusbK USB Devices". But with "USB Serial (CDC) it now shows under "Ports (COM & LPT) as "USB2292(COM4), however, its still not working.
There also appears some class inheritance issues for all methods under self.axis in the motor class.
Hi,
I am struggling to get my ESD CAN-USB/2 device working with the python-tmcl (pyTMCL) software. What do I need to write for "serial_port = Serial("/dev/tty.usbmodem1241")" for below code as I have an usb/can interface device.
Cheers,
Installed: Win 10 Pro, x64 python 3.7.4 pyUSB 1.0.2 LibUSB1 1.7.1 CAN 3.3.2
from serial import Serial from time import sleep import TMCL serial-address as set on the TMCM module.
MODULE_ADDRESS = 1 Open the serial port presented by your rs485 adapter
serial_port = Serial("/dev/tty.usbmodem1241") Create a Bus instance using the open serial port
bus = TMCL.connect(serial_port) Get the motor
motor = bus.get_motor(MODULE_ADDRESS) From this point you can start issuing TMCL commands to the motor as per the TMCL docs. This example will rotate the motor left at a speed of 1234 for 2 seconds
motor.rotate_left(1234) sleep(2) motor.stop()