Home switch State

General discussion of using Roboclaw motor controllers
Post Reply
ejunkins
Posts: 13
Joined: Mon Mar 18, 2019 8:28 am
Home switch State

Post by ejunkins »

Hi,

I am having issues with being able to query the state of my home switch using the python software given in roboclaw.py . Reading the user manual on page 74 it says that the error code for the home switches is 0x4000 and 0x8000. When I use the function Read Status (from the python library ReadError() ) I get 0 as the returned error code. At the same time I have the Basic Motion GUI open and see both of the limit switches tripped. The motor controllers respond to all other commands as expected, and I am running the latest firmware on the RoboClaws.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Home switch State

Post by Basicmicro Support »

1. Make sure you have the latest software(Basicmicro Motion Studio, not older Ion Motion/Studio software).
2. Make sure your firmware is up to date(should already be if you are using Basicmicro Studio)

Make sure you are using the latest version of the Python Library. It was updated with the last release to work with the new Read Status/Error command.

The new manual is still in revision but should be released in the next week or so. Until then here is the updated table for the Read Status/Error command.

Code: Select all

Normal					0x000000
ESTOP					0x000001
temperature Error			0x000002
Temperature 2 Error			0x000004
Main Voltage High Error			0x000008
Logic Voltage High Error		0x000010
Logic Voltage Low Error			0x000020
M1 Driver Fault Error			0x000040
M2 Driver Fault Error			0x000080
M1 Speed Error				0x000100
M2 Speed Error				0x000200
M1 Position Error			0x000400
M2 Position Error			0x000800
M1 Current Error			0x001000
M2 Current Error			0x002000
M1 Over Current Warning			0x010000
M2 Over Current Warning			0x020000
Main Voltage High Warning		0x040000
Main Voltage Low Warning		0x080000
Temperature Warning			0x100000
Temperature2 Warning			0x200000
S4 Signal Triggered			0x400000
S5 Signal Triggered			0x800000
NOte we are currently only using 24 bits of the 32 bits. The unused bits are reserved for future use.
ejunkins
Posts: 13
Joined: Mon Mar 18, 2019 8:28 am
Re: Home switch State

Post by ejunkins »

I am using Basicmicro Motion Stuido, using firmware version 4.1.33. The python library was downloaded on Tuesday 6/11/2019.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Home switch State

Post by Basicmicro Support »

The python command to read status returnsxz a 32bit value. Post your code or email support@basicmicro.com and I'll take a look at it.
ejunkins
Posts: 13
Joined: Mon Mar 18, 2019 8:28 am
Re: Home switch State

Post by ejunkins »

The function I'm using is:


def _get_Errors(self):
' ''
Gets the error status of the motor controllers

return:
list [2] (int): Error code per motor controller

' ''
errors = [0] * 2
for i in range(2):
errors = self.rc.ReadError(self.address)[1]
return errors

self.address = [0x80, 0x81]

The element [1] of this should be the error code according to the source code,

def ReadError(self,address):
return self._read2(address,self.Cmd.GETERROR)

However even when my limit switches are tripped this value is 0. In fact both values in this are 0 always. But all other roboclaw functions work as expected
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Home switch State

Post by Basicmicro Support »

Thanks that was the information I needed. Please download the python library from the server again. I've updated it. Apparently, the change was only in the development copy and not put in the release directory yet. It has been now.
ejunkins
Posts: 13
Joined: Mon Mar 18, 2019 8:28 am
Re: Home switch State

Post by ejunkins »

Great, all working now, thanks!

Post Reply