- Posts: 116
- Thank you received: 0
Python Component issueing errors or warnings to LinuxCNC
5 years 5 months ago #207625
by Roiki
Replied by Roiki on topic Python Component issueing errors or warnings to LinuxCNC
You can read the nml source. There are messages for error messages there. They are used internally by the application but are not included in the linuxcnc.command method for sending them on the command channel to the nml error channel. As Andy Pugh pointed out.
I haven't looked at the source enough to see if these would be difficult to implement or not. Or if they exist on the c++ api that's under the python one.
I haven't looked at the source enough to see if these would be difficult to implement or not. Or if they exist on the c++ api that's under the python one.
Please Log in to join the conversation.
5 years 5 months ago #208108
by Stormholt
Replied by Stormholt on topic Python Component issueing errors or warnings to LinuxCNC
I don't know if its a very elegant way but, for my axis tabs I have created a hal pin only to print an error/warning using the "message" hal real time component.
Please Log in to join the conversation.
5 years 5 months ago #208500
by cmorley
Replied by cmorley on topic Python Component issueing errors or warnings to LinuxCNC
So I slapped together some code to test with:
and the message is accepted but never sent it seems.
I can't find much examples of sending messages on the error channel other then emctaskmain.cc
Code:
PyObject *MESSAGE_(pyErrorChannel *s, PyObject *args ) {
char *m;
EMC_OPERATOR_DISPLAY operator_display_msg;
if(!PyArg_ParseTuple(args, "s", &m)) return NULL;
if(!s->c->valid()) {
PyErr_Format( error, "Error buffer invalid" );
return NULL;
}
operator_display_msg.id = 0;
strncpy(operator_display_msg.display, m, LINELEN);
operator_display_msg.display[LINELEN - 1] = 0;
s->c->write(operator_display_msg);
Py_RETURN_NONE;
}
static PyMethodDef Error_methods[] = {
{"poll", (PyCFunction)Error_poll, METH_NOARGS, "Poll for errors"},
{"MESSAGE_", (PyCFunction)MESSAGE_, METH_VARARGS, "Send message"},
{NULL}
};
and the message is accepted but never sent it seems.
I can't find much examples of sending messages on the error channel other then emctaskmain.cc
Please Log in to join the conversation.
5 years 5 months ago #208549
by Roiki
Replied by Roiki on topic Python Component issueing errors or warnings to LinuxCNC
I don't think you send it on the error channel but the command channel. Try it that way and see what happens?
Please Log in to join the conversation.
5 years 5 months ago #208560
by cmorley
Replied by cmorley on topic Python Component issueing errors or warnings to LinuxCNC
Yes that did the trick - thanks.
Unfortunately all display messages can only be accepted in auto mode.
There is an NML_ERROR message but I don't understand how to send this NML message
More research needed..
Unfortunately all display messages can only be accepted in auto mode.
There is an NML_ERROR message but I don't understand how to send this NML message
More research needed..
Please Log in to join the conversation.
5 years 5 months ago #208605
by cmorley
Replied by cmorley on topic Python Component issueing errors or warnings to LinuxCNC
Well it seems EMC_OPERATOR_ERROR_TYPE messages can be made to always display by modifying emctaskmain.cc to accept them.
I just don't understand if there is a disadvantage to always accepting them.
I just don't understand if there is a disadvantage to always accepting them.
Please Log in to join the conversation.
5 years 5 months ago #208654
by andypugh
Replied by andypugh on topic Python Component issueing errors or warnings to LinuxCNC
Do it and see who complains?
Please Log in to join the conversation.
5 years 5 months ago #208673
by cmorley
Replied by cmorley on topic Python Component issueing errors or warnings to LinuxCNC
lol You know you are right.
Thanks Andy
Thanks Andy
Please Log in to join the conversation.
5 years 5 months ago #208679
by cmorley
Replied by cmorley on topic Python Component issueing errors or warnings to LinuxCNC
Ok in master you can use python's linuxcnc module to send messages to the operator.
Please let me know if you test it.
Code:
import linuxcnc
c = linuxcnc.command()
c.error_msg('Error')
c.text_msg('Text')
c.display_msg('Display')
Please let me know if you test it.
Please Log in to join the conversation.
5 years 5 months ago #208737
by mwinterm
Replied by mwinterm on topic Python Component issueing errors or warnings to LinuxCNC
Hello @cmorley,
just tried it out. Works like a charm
Exactly what I was looking for.
Thank you very much!
Regards,
Marc
just tried it out. Works like a charm
Exactly what I was looking for.
Thank you very much!
Regards,
Marc
Please Log in to join the conversation.
Time to create page: 0.074 seconds
