BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Sun Oct 21, 2018 12:12 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: python example checksums
PostPosted: Fri May 23, 2014 8:01 pm 
Offline
New User

Joined: Fri May 23, 2014 7:46 pm
Posts: 3
I just purchased my first motor controller, the Roboclaw 2x15A. I have it connected to a Raspberry Pi via USB port in Mode 15. I was trying out the python example code you have posted on your site.

The motors smoothly spin up and down forward and reverse, but none of the read values seem to work such as battery voltage, board temp, motor current, etc.. They are all -1 (due to bad checksum?). Is there something wrong with the checksum calculations in the script? Or am I doing something wrong?

Thanks!


Top
 Profile  
 
 Post subject: Re: python example checksums
PostPosted: Tue Jun 03, 2014 8:03 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
I have not had a chance to check the RPi library against the latest firmwares. It should still work but it is possible there is an incompatibility in the read function of the python library. I expect to have time to update the arduino and RPi libraries in the next week or two.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: python example checksums
PostPosted: Fri Jun 06, 2014 8:24 pm 
Offline
New User

Joined: Fri May 23, 2014 7:46 pm
Posts: 3
Great! Thanks for taking a look at it.


Top
 Profile  
 
 Post subject: Re: python example checksums
PostPosted: Sat Jun 14, 2014 12:49 am 
Offline
Citizen

Joined: Sat Jun 14, 2014 12:41 am
Posts: 5
I can confirm this is also an issue running the python script on Ubuntu Linux 14.04. We recently purchased a Roboclaw 2x30A and upgraded our firmware to 4.1.2. We are also having a major problem reading encoder counts. Even through the Windows demo application the encoder values will fluctuate between very small negative integer values. Our encoders are US Digital with 500 CPR disks. We have validated the encoders with an oscilloscope and Phidgets Encoder board.


Top
 Profile  
 
 Post subject: Re: python example checksums
PostPosted: Fri Jun 20, 2014 5:08 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
Dss42, please only post about your problem in one place. I don't want to have to repeat the same thing in a half dozen places or miss one and then have people think the problem isn't being worked on. Right now as I posted in the other forum post your made, I am checking the problem with the Python code. Most likely something in the python code isn't working with some command in the new firmware.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: python example checksums
PostPosted: Fri Jun 20, 2014 5:44 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
Found the problem in the python example. As of 4.1.2 we added an extra byte to the "get status" function on the roboclaw. This extra byte was corrupting the serial stream on the python code because it didn't know about it and it doesn't clear the serial buffer after an error.

Found the problem. The Read Error State command was only reading one byte, leaving one byte in the serial buffer on the PC which then trashed the checksum on all the remaining commands. The "Get Errors" command changed in 4.1.2 because we added more error/warning states so it no requires reading a word instead of a byte.

Change line 581 in the python code from:

val = readbyte()

to this

val = readword()

I made the fix and tested this on windows using Python27. I will update the pithing library file in a few minutes as well.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: python example checksums
PostPosted: Sun Jun 22, 2014 4:48 am 
Offline
New User

Joined: Fri May 23, 2014 7:46 pm
Posts: 3
Excellent! Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO