This is the official RoboClaw Python library. Included is the library itself as well as examples of the library in use.
basicmicro / roboclaw_python_library Goto Github PK
View Code? Open in Web Editor NEWThe official RoboClaw Python library
The official RoboClaw Python library
This is the official RoboClaw Python library. Included is the library itself as well as examples of the library in use.
Although the new library correctly identifies the need to remove the 'long' int with a new return statement, PID numbers are NOT integers (not can they be declared as so), so to succeed, the call to write4444 needs to cast the rescaled values as integers, not leave them 'as is'.
Hence the current lines:
return self._write4444(address,self.Cmd.SETM1PID,d65536, p65536, i*65536,qpps)
will fail, with a type error when it tries to bitshift, but:
return self._write4444(address,self.Cmd.SETM1PID,int(d65536),int(p65536),int(i*65536),qpps)
will execute as expected.
Making this change to both SetM1VelocityPID and SetM2VeclocityPID ensures the driver works as expected.
Roboclaw python library error - I'm new to serial in python,but and I understood that the address needs to be in a different format. Can you please pour in your input?
An example file(provided in repo) I ran is:- python3 roboclaw_simplepwm.py
Error:- TypeError: Unicode strings are not supported, please encode to bytes: '\x80'
the log is:-
Traceback (most recent call last):
File "roboclaw_simplepwm.py", line 13, in
rc.ForwardM1(address,32) #1/4 power forward
File "/home/krishna/capastone/claw_python/roboclaw_python_library-master/roboclaw_python/roboclaw.py", line 649, in ForwardM1
return self._write1(address,self.Cmd.M1FORWARD,val)
File "/home/krishna/capastone/claw_python/roboclaw_python_library-master/roboclaw_python/roboclaw.py", line 313, in _write1
self._sendcommand(address,cmd)
File "/home/krishna/capastone/claw_python/roboclaw_python_library-master/roboclaw_python/roboclaw.py", line 128, in _sendcommand
self._port.write(chr(address))
File "/home/krishna/.local/lib/python3.8/site-packages/serial/serialposix.py", line 616, in write
d = to_bytes(data)
File "/home/krishna/.local/lib/python3.8/site-packages/serial/serialutil.py", line 65, in to_bytes
raise TypeError('unicode strings are not supported, please encode to bytes: {!r}'.format(seq))
TypeError: unicode strings are not supported, please encode to bytes: '\x80'
In the roboclaw_3.py program, timeout=1
has to be replaced by timeout=self.timeout
Hey,
I have the following Roboclaw motor controller:
this one
When I connect it via the Basic Micro Motion Studio Software I receive all of the meta information like temperature.
However when I try to query the exact same meta information with a python script I just get (0, 0) as a result.
I noticed that I only can't get those information with my python script when I enable the "multi unit mode" in the micro motion sutdio software.
If I disable the multi unit mode I get the correct values.
The problem is that I need the the multi unit mode and I need the additional information like temperature at the same time.
I investigated a little bit further and noticed that I get the (0, 0) because in the _read2 method
the val1[0]
is a 0 and therefore considered false.
def _read2(self,address,cmd):
trys = self._trystimeout
while 1:
self._port.flushInput()
self._sendcommand(address,cmd)
val1 = self._readword()
if val1[0]:
crc = self._readchecksumword()
if crc[0]:
if self._crc&0xFFFF!=crc[1]&0xFFFF:
return (0,0)
return (1,val1[1])
trys-=1
if trys==0:
break
return (0,0)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.