Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptic error codes from mpStartJob #102

Closed
ted-miller opened this issue Jul 31, 2023 · 3 comments · Fixed by #106
Closed

Cryptic error codes from mpStartJob #102

ted-miller opened this issue Jul 31, 2023 · 3 comments · Fixed by #106
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers rv:0.1.0 Reported in MotoROS2 0.1.0 todo Not an issue, just a TODO
Milestone

Comments

@ted-miller
Copy link
Collaborator

ted-miller commented Jul 31, 2023

When enabling a motion mode, the software tries to start the INFORM job. If it fails to start that job, it returns a cryptic error code. You would need to reference the MotoPlus documentation to find the definition.

Ex: Can't start 'INIT_ROS' because: 0x3040

We should map the error codes to a lookup table with human-readable strings.

0x0000 Normal end
0x2010 Robot is in operation
0x2030 In HOLD status (PP)
0x2040 In HOLD status (External)
0x2050 In HOLD status (Command)
0x2060 In error/alarm status
0x2070 In SERVO OFF status
0x2080 Wrong operation mode
0x3040 The home position is not registered
0x3050 Out of range (ABSO data)
0x3400 Cannot operate MASTER JOB
0x3410 The JOB name is already registered in another task.
0x4040 Specified JOB not found
@ted-miller ted-miller added enhancement New feature or request good first issue Good for newcomers rv:0.1.0 Reported in MotoROS2 0.1.0 todo Not an issue, just a TODO labels Jul 31, 2023
@aigallegos
Copy link
Contributor

Hi I would like to be assigned this. I'm pretty sure I can fix the problem I am just new to open source. Thanks!

@ted-miller
Copy link
Collaborator Author

Thanks @aigallegos. We appreciate the help!

When you have a solution worked up, please submit a pull request to the main branch. If you need any info, let us know.

@gavanderhoorn
Copy link
Collaborator

This was actually explicitly left as a TODO a couple of versions ago. We might have been too hasty removing those TODOs.

One is still left, here:

motoros2/src/MotionControl.c

Lines 1253 to 1256 in c245327

//TODO(gavanderhoorn): should this be reported to user, or are causes
//covered by errors in MotionNotReadyCode?
Ros_Debug_BroadcastMsg("Can't turn on servo because: 0x%04X", rData.err_no);
goto updateStatus;

which I believe should also be addressed.

We should map the error codes to a lookup table with human-readable strings.

I believe we already have a function which does this:

//-------------------------------------------------------------------
// Convert error code to string
//-------------------------------------------------------------------
void Ros_ErrorHandling_ErrNo_ToString(int errNo, char* const errMsg, int errMsgSize)
{
switch (errNo)
{
case 0x2010: strncpy(errMsg, "Robot is in operation", errMsgSize); break;
case 0x2030: strncpy(errMsg, "In HOLD status (PP)", errMsgSize); break;
case 0x2040: strncpy(errMsg, "In HOLD status (External)", errMsgSize); break;
case 0x2050: strncpy(errMsg, "In HOLD status (Command)", errMsgSize); break;
case 0x2060: strncpy(errMsg, "In ERROR/ALARM status", errMsgSize); break;
case 0x2070: strncpy(errMsg, "In SERVO OFF status", errMsgSize); break;
case 0x2080: strncpy(errMsg, "Wrong operation mode", errMsgSize); break;
case 0x3040: strncpy(errMsg, "The home position is not registered", errMsgSize); break;
case 0x3050: strncpy(errMsg, "Out of range (ABSO data)", errMsgSize); break;
case 0x3400: strncpy(errMsg, "Cannot operate MASTER JOB", errMsgSize); break;
case 0x3410: strncpy(errMsg, "The JOB name is already registered in another task", errMsgSize); break;
case 0x4040: strncpy(errMsg, "Specified JOB not found", errMsgSize); break;
case 0x5200: strncpy(errMsg, "Over data range", errMsgSize); break;
default: strncpy(errMsg, "Unspecified reason", errMsgSize); break;
}
}

AFAICT, it maps the status codes you list.

@gavanderhoorn gavanderhoorn added this to the 0.1.1 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers rv:0.1.0 Reported in MotoROS2 0.1.0 todo Not an issue, just a TODO
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants