RoboClaw 2x15A, Python3, Windows: Unable to read version
Posted: Thu Jan 10, 2019 2:36 am
Hello,
I have written a program in Python3 in which I want to include a motor control with a RoboClaw2x15A.
Currently I am working on Windows10, but maybe I will swap to a Raspberry Pi in the future.
The Python Lib for Raspberry Pi is written for Python2, so I got the same _port-error as in the thread.
http://forums.basicmicro.com/viewtopic.php?f=2&t=542
Thus I did the changes mentioned from "robof" in forum and had no error anymore.
I checked the connection with
and it is working.
But trying to get data from the roboclaw does not really work.
Executing
does give me only the "GETVERSION Failed" output.
I also tried to read the encoder-value and measured the response time for the "rc.ReadEncM1(address)" -function and that is always a little bit more than 3seconds.
Do you have a python3 library available for further testing? Or may you help me with my communiction problem?
Thanks
simons
EDIT:
I changed the adress value from "0x80" to "80" before I tested all of these, because otherwise I got the error
Tested everything in python2 and that is working.
So the problem must be at the conversion of the address, so it can be used in python3
I have written a program in Python3 in which I want to include a motor control with a RoboClaw2x15A.
Currently I am working on Windows10, but maybe I will swap to a Raspberry Pi in the future.
The Python Lib for Raspberry Pi is written for Python2, so I got the same _port-error as in the thread.
http://forums.basicmicro.com/viewtopic.php?f=2&t=542
Thus I did the changes mentioned from "robof" in forum and had no error anymore.
I checked the connection with
Code: Select all
a = rc.Open
if a ==1:
print("okay")
else:
print("not okay")
But trying to get data from the roboclaw does not really work.
Executing
Code: Select all
version = rc.ReadVersion(address)
if version[0]==False:
print("GETVERSION Failed")
else:
print( repr(version[1]))
I also tried to read the encoder-value and measured the response time for the "rc.ReadEncM1(address)" -function and that is always a little bit more than 3seconds.
Do you have a python3 library available for further testing? Or may you help me with my communiction problem?
Thanks
simons
EDIT:
I changed the adress value from "0x80" to "80" before I tested all of these, because otherwise I got the error
Code: Select all
File "C:\Users\Simon\Desktop\testbed\GUI\roboclaw.py", line 717, in ReadVersion
str+=data[0]
TypeError: must be str, not int
So the problem must be at the conversion of the address, so it can be used in python3