Jrk2 G2 reading error messages

Hello,

I am trying to read the error messages form the Jrk G2 18V19 and it works via the Configuration Utility. However I also want to read the error messages with python.
For testing it I have not applied any power to the controller other than USB. In the Configuration Utility I see the message: “VIN is disconnected” also I see the “No Power” error count up as expected.

In my python code I do not always see the “No Power” bit.

In the output below I print out: “Errors currently stopping the motor” and “Error” both received form sending “-s” via the python command provided in the example.

After printing it out 10 times the result is that it only shows the “No Power” bit twice.
Also if i have power applied to the system I still get bit 2: " Motor driver error" also seen in the output below. The second bit is never shown in the Configuration Utility. I have also applied the pies of code that reads the data from the Jrk G2 module. Please help by explainig why i dont always see the “No Power” bit but do always see the " Motor driver error" bit (but not in utility)

Also by manualy using the jrk2cmd -s command in cmd i get the same results.

Best regards,
Marcel

PYTHON CODE OUTPUT

[‘Awaiting command’, ‘No power’]
error: 4, 0b100

[‘Awaiting command’, ‘No power’]
error: 4, 0b100

[‘Awaiting command’, ‘No power’]
error: 3, 0b11
No Power!

[‘Awaiting command’, ‘No power’]
error: 4, 0b100

[‘Awaiting command’, ‘No power’]
error: 3, 0b11
No Power!

[‘Awaiting command’, ‘No power’]
error: 4, 0b100

[‘Awaiting command’, ‘No power’]
error: 4, 0b100

[‘Awaiting command’, ‘No power’]
error: 4, 0b100

[‘Awaiting command’, ‘No power’]
error: 4, 0b100

[‘Awaiting command’, ‘No power’]
error: 4, 0b100

def error_status(self):

    self.jrk2cmd('--clear-errors')

    status = yaml.safe_load(self.jrk2cmd('-s'))

    #print(status['Overall status'])

    print(status['Errors currently stopping the motor'])

    error = status['Error']

    print(f'error: {error}, {bin(error)}')

    if 1 == (error >> 1 & 1):

        print("No Power!")

    print('\n')



def jrk2cmd(self, *args):

    return subprocess.check_output(['jrk2cmd'] + list(args))

Hello, Marcel.

The “Error” status you are reading is actually the “error” value used in the PID calculation, not the bitmap of the error flags. The print(status['Errors currently stopping the motor']) line in your code is giving you a reliable readout of the errors being triggered (which are “Awaiting command” and “No power” from the output you posted).

Brandon

Thanks,

I am not realy sure how I missed that. I actually use “Error” in another part of my code.
I will be using " Errors currently stopping the motor" from now on.

Best regards

2 Likes