GithubHelp home page GithubHelp logo

roboclaw_python_library's Introduction

This is the official RoboClaw Python library. Included is the library itself as well as examples of the library in use.

roboclaw_python_library's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

roboclaw_python_library's Issues

SetM1VelocityPID and SetM2VelocityPID do not work

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.

unicode strings are not supported, please encode to bytes: '\x80'

roboclaw error

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'

Timeout code error

In the roboclaw_3.py program, timeout=1 has to be replaced by timeout=self.timeout

Motor controllers sends no meta information (e.g. temperature) when connected via python script

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.