UART only or CAN BUS compatible?
hi, using the vesc tool and looking for a python CAN-BUS lib. I didn't see anywhere the CAN Communication. Do you know if this works with CAN as well, if so, have you tried it?
Hi, I managed to get the can to work like this: pyvesc.encode(pyvesc.SetRPM(0,can_id=can_id)) Can id is the id of the vesc connected in can. Do not hesitate to ask me for more details.
Vincent LAMBERT.
Hi, I managed to get the can to work like this: pyvesc.encode(pyvesc.SetRPM(0,can_id=can_id)) Can id is the id of the vesc connected in can. Do not hesitate to ask me for more details.
Vincent LAMBERT.
Hi Vincent
Could you elaborate a little more about how you got it to work through CAN? How I'd like it to work, is that I can setup a motorCAN instance VESC(serialport=canId) as motorCAN for example, and then work with that.
I am trying to eget canbus comms working.
message = pyvesc.SetRPM(value, can_id=77)
packet = pyvesc.encode(message)
print('can packet = ',packet)
returns: b'\x02\x07!M\x08\x00\x00\x04\x1a\x8fV\x03'
while vesc tool wprking can bus command sends b'\x02\x07\x22\x4d\x05\x00\x00\x27\x10\x84\x51\x03'
It seems pyvesc.encode is not properly encoing a can messgae ie. 9 bytes(2 grabled) vs 12 bytes for good packet.
in setters.py SetRPM is setting can_id to None.
It is unclear is the canbus id displayed in Vesc Tool is decimal or hex.
class SetRPM(metaclass=VESCMessage): """ Set the RPM. :ivar rpm: Value to set the RPM to. """ id = 8 # COMM_SET_RPM can_id = None fields = [ ('rpm', 'i', 1) ]
I download PyVESC-FW3.33 version and python3 setup.py installed it. with python 3.6.9.
Any help on this would be much appreciated.
I'm not sure about older versions of vesc firmware, but on firmware version 6.02 it looks like the value of _comm_forward_can node is outdated. After changing its hard-coded value from 33 to 34 in line 17 of base.py, I was able to get set_rpm to work with pyvesc.encode(pyvesc.SetRPM(0,can_id=can_id)).