Building new Full Qt c/c++ HMI (incl. nml and EtherCAT )

More
28 Aug 2021 13:16 #219000 by Grotius
Hi,

Hmm. Are you using c++ compiler in Qt? I suspect it's a Qt config thing.
Maybe try to clone the updated repository again? You run Linux-pro and did the skynet install?
 

Please Log in or Create an account to join the conversation.

More
30 Aug 2021 20:31 #219188 by udoS
@GrotiusI told you what happened installing the Linux-Pro.  So I installed my basic.Debian Buster 4.9.0-19 Kernel PREEMPTOSADL 5.0.21-rt16Installed LogicLab PLC with EtherCAT.Installed CodeLite for Plugin dev.Installed LinuxCNC-dev 2.9Installed Qtcreator 4.8 with Qt 5.12.4 and 5.15.2Now running Qt-Lcnc-nexT HMIGetting now the axis pos cmd from linuxcnc directly into the plc.Now I need more of the parameter addresses from the nml commands.I have those you got in your Qt-hmi so I continue with them but at the end I want to run without the HAL. So I need the complete Set.
I wish Reinhard could help with that. Seems he is really deep into it. His Code is there but its all Spanish Village to me. LOL.

Please Log in or Create an account to join the conversation.

More
30 Aug 2021 20:58 #219190 by Grotius
Hi UdoS,

Ok. Reinhard suggested to do the nml stuff. His app is working now, see other thread.
But i don't know how far Reinhard is with the actual coding of the nml interface. Problably he has to port some
stuff from java to c++, but i don't know.
It's a matter of day's when his code is available for you i suggest.

* His Code is there but its all Spanish Village to me.
When it's there we can take a look at it.
But for you at the moment, if you do right mouse click in qt on a "nml symbol" and you follow the "symbol under cursor"
you can retrieve a lot info. Try it. I use it a lot when programming opencascade.




 

Please Log in or Create an account to join the conversation.

More
31 Aug 2021 08:03 #219228 by udoS
@Grotius
Yes, I'm aware of that. Finding the stuff in Qt.

How can we find the pins from the cnc automatically just like the HAL does, only in c/c++.
Isn't that what it all comes down to. ? Only that instead of the HAL it would be the PLC_Plugin.

Best rgds

Please Log in or Create an account to join the conversation.

More
31 Aug 2021 14:19 #219251 by Grotius
Hi Udo,

* How can we find the pins from the cnc automatically just like the HAL does, only in c/c++.
I looked at that, but there's no universal for loop that can do that at once for the whole content of nml.
The hal infrastructure has only a few datatypes and has already index functions that print content values.

I think you have to build the index function yourself. It's a boring task, but like the example below,
it's just a matter of time until you get there and have all values indexed.
std::string nmlfile="/opt/linuxcnc/configs/common/linuxcnc.nml";
const char *cstr = nmlfile.c_str();

// Command channel
RCS_CMD_CHANNEL *c = new RCS_CMD_CHANNEL(emcFormat, "emcCommand", "xemc", cstr);
EMC_TASK_SET_STATE state;
state.state=EMC_TASK_STATE_ENUM(EMC_TASK_STATE_ON);
c->write(&state);

EMC_TASK_SET_MODE mode;
mode.mode=EMC_TASK_MODE_AUTO;
c->write(&mode);

// Status channel
RCS_STAT_CHANNEL *status = new RCS_STAT_CHANNEL(emcFormat, "emcStatus", "xemc", cstr);
EMC_STAT *emcStatus = static_cast<EMC_STAT*>(status->get_address());

    std::cout<<"distance to go:"<<emcStatus->motion.traj.distance_to_go<<std::endl;
    EmcPose pose=emcStatus->motion.traj.dtg;
    std::cout<<"pose.a:"<<pose.a<<std::endl;
    std::cout<<"lube state:"<<emcStatus->io.lube.state<<std::endl;
    std::cout<<"current line:"<<emcStatus->task.currentLine<<std::endl;
    std::cout<<"spindle speed:"<<emcStatus->motion.spindle->speed<<std::endl;

EMC_TASK_STAT *task = static_cast<EMC_TASK_STAT*>(status->get_address());

    // task->

EMC_IO_STAT *io = static_cast<EMC_IO_STAT*>(status->get_address());

    // io->tool.toolTableCurrent

EMC_TOOL_STAT *toolstatus = static_cast< EMC_TOOL_STAT*>(status->get_address());

Prints :
distance to go:0
pose.a:0
lube state:0
current line:0
spindle speed:0

Please Log in or Create an account to join the conversation.

More
31 Aug 2021 14:55 #219257 by Reinhard
Hi guys,

sorry, but I have to disappoint you. NML does not work that way.
NML is far from behaviour of any well known shared memory.
I don't know why, but clients don't get access to shared memory buffer. Instead each client receives its own static copy of the shared memory buffer.

So if you're interested in status update, you first have the backend ask to do a copy. Then you can read out "your" copy of status buffer.

If you want a gui to react on data changes, you have to do another copy at the client side. With the copy you can decide, whether data has changed or not. So the boring truth of nml: data gets copied on backend and then on frontend again.

@udoS
whats the sense of wanting an index function for nml status members?
I did that in the interface layer for JCNCScreen. I have a dictionary of all ValueModels accessible by name.
So i.e. to query relative postion you do something like "dict[xRel].getValue()"
or even better:
using event system, just connect the valuemodel with a dro or whatever widget you like to.

Please Log in or Create an account to join the conversation.

More
31 Aug 2021 18:38 #219270 by Grotius
Hi Reinhard,

Last week i tested Udo's app. When the app loads the nml is created. (once)
Then in the program loop it updates the dro values without any problems.
It does not copy any data forward's and backward's. It's just showing the lcnc values as expected.
 

Please Log in or Create an account to join the conversation.

More
31 Aug 2021 20:36 #219286 by udoS
@ Grotius; Reinhard;
Hi to both of you.

I don't really know how it works but from Grotius Qt-C-HMI I just figured and tried.
What I understand now is that you need to open a channel only once and then you can poll all the values that are in the dictionary of that channel. You just need to know the path to a particular value.
That's what I'm looking for.
Which channel contains what parameters and where are they buried. LOL.

Best rgds

Please Log in or Create an account to join the conversation.

More
01 Sep 2021 12:11 - 01 Sep 2021 12:19 #219329 by udoS
@Grotius@Reinhard

Now here are the Values for X, Y, Z from Lcnc --> nml --> plc .  Puuhhh. 

Do you know how to return the feedback to the cnc over a iml-cmd.
Last edit: 01 Sep 2021 12:19 by udoS.

Please Log in or Create an account to join the conversation.

More
01 Sep 2021 12:49 #219331 by Reinhard

It does not copy any data forward's and backward's.

Sure, that you don't use statuschannel->peek() ?

Please Log in or Create an account to join the conversation.

Time to create page: 0.126 seconds
Powered by Kunena Forum