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

More
07 Sep 2021 05:09 - 07 Sep 2021 05:40 #219814 by Grotius
Hi,

For the libopencascade.so project:

You can do a "sudo make install" for the libopencascade.so "makefile". It's then installed to the system. It will then be found by the testproject.
The project has includepaths:

INCLUDEPATH +=  /usr/local/include/opencascade/ \
                /usr/include/eigen3/ \
                /usr/include/ \
                /usr/local/lib/ \

*At compile time of the opencascade.pro it asks for a file ...  etc. see picture from last entry.
Please sent the picture agian. I don't see it.

*Any clue how to send the feedback of the drive back to the cnc over the nml channel. This is most pressing. No step forward.
Hi no clue, but we can find out.
A more general question would be, how to send data from hal to the nml channel.

In the file nml.hh :
/* Read and Write Functions. */
    int write(NMLmsg * nml_msg, int *serial_number = NULL);
/code]

line 1585 of nml.cc, this is interesting:
[code]
cms->set_mode(CMS_WRITE);
cms->write(nml_msg, serial_number);   

Once your app compiles, we can test some nml stuff.
Last edit: 07 Sep 2021 05:40 by Grotius.

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

More
07 Sep 2021 07:41 #219821 by udoS
@Grotius

I'm talking about Page 6 @  06 Sep 2021 13:29 #219758

the other stuff I will try out today.

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

More
07 Sep 2021 07:58 #219824 by udoS
@Grotius

That woked better then I thought. Good start into the day. LOLOL
Attachments:
The following user(s) said Thank You: Grotius

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

More
07 Sep 2021 19:32 - 07 Sep 2021 20:51 #219871 by udoS
Attachments:
Last edit: 07 Sep 2021 20:51 by udoS.
The following user(s) said Thank You: Grotius

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

More
07 Sep 2021 22:06 #219889 by Grotius
Hi,

Nice work !

0.
Now you can change the background of the widget to something you like.
The background is now stretched: "Aspect_FM_STRETCH", but there are more settings available.

1.
To setup the cone z upwards, edit the file :
draw_primitives.cpp line 14 + line 21 must be : gp_Dir axis=gp::DZ();

2.
To send tool position data from nml to the opencascade you could consider a function like below.
The typedef is used to avoid confilects between qt and lcnc source files.
typedef RCS_STAT_CHANNEL mystattype;
mystattype *status_channel;
QStringList list;

QVariant Nml_plugin::get_tcp_pos(){
    EMC_STAT *emcStatus;
    for(int i=0; i<1; i++){
      usleep(100);
      if(!status_channel->valid()) continue;
      if(status_channel->peek() != EMC_STAT_TYPE) continue;
      emcStatus = static_cast<EMC_STAT*>(status_channel->get_address());

      list.clear();
      list.push_back(QString::number(emcStatus->motion.traj.position.tran.x,'f',3));
      list.push_back(QString::number(emcStatus->motion.traj.position.tran.y,'f',3));
      list.push_back(QString::number(emcStatus->motion.traj.position.tran.z,'f',3));
    }

    QVariant data(list);
    return data;
}

3.
Then to setup the cone (only once) in opencascade :
void Opencascade::load_tool_cone(QVariant data){
    QStringList list=data.toStringList();
    double bottomdiameter = list.at(0).toDouble();
    double topdiameter = list.at(1).toDouble();
    double height = list.at(2).toDouble();
    Ais_ToolCone = draw_primitives().draw_3d_cone({0,0,0},bottomdiameter,topdiameter,height);
    Ais_ToolCone = draw_primitives().colorize(Ais_ToolCone,Quantity_NOC_GREEN,0);
    m_context->Display(Ais_ToolCone,Standard_False);
}

4.
And for translating the cone. Following your nml xyz positons.We pick the quaternion function.
void Opencascade::translate_tool_cone(QVariant data){
    QStringList list=data.toStringList();
    double x = list.at(0).toDouble();
    double y = list.at(1).toDouble();
    double z = list.at(2).toDouble();
    Ais_ToolCone = draw_primitives().rotate_translate_3d_quaternion(Ais_ToolCone,{x,y,z},0,0,0);
    m_context->Redisplay(Ais_ToolCone,Standard_False);
    m_context->Display(Ais_ToolCone,Standard_False);
}
You can see i used the QVariant datatype to sent the data visa versa.
You can expand the Stringlist with extra axis values.
Ok good luck!

I hope the gcode parser can read this type of gcode.

 

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

More
07 Sep 2021 22:07 - 07 Sep 2021 22:10 #219890 by Grotius
P.s. i uploaded a archive today on the other forum thread. It contains above code examples, this for info.
For above post, The coneshape (only once) in opencascade.h  : Handle(AIS_Shape) Ais_ToolCone;
Last edit: 07 Sep 2021 22:10 by Grotius.

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

More
08 Sep 2021 17:18 #219976 by Grotius
Hi,

I looked for your question. The first solution i found is :
command_channel = new RCS_CMD_CHANNEL(emcFormat, "emcCommand", "xemc", filename.toStdString().c_str());
EMC_MOTION_SET_AOUT out;
out.now=1;
out.index=1;
out.start=12345;
out.end=54321;
command_channel->write(&out);

EMC_MOTION_SET_DOUT dout;
dout.now=1;
dout.index=1;
dout.start=1;
dout.end=0;
command_channel->write(&dout);

 
Attachments:

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

More
08 Sep 2021 19:35 #219994 by udoS
@Grotius AND  .....

I was talking about the equivalent of the joint.n.pos.fb in the hal.
I get vel.cmd and pos.cmd from nml RCS_STATUS
How tho send my encoder position back at RCS_......   to the cnc to have the loop closed. Not hal.

Thanks for any helpful reply.

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

More
10 Sep 2021 07:34 #220109 by udoS
@andypugh

My problem is as follows:
I have a plugin in c++ reading the joint motor cmd over the RCS_STATUS_CHANNAL nml .
Same goes for the velocity .
I feed that into my drive and get a pos-feedback. ( I could feed it into HAL but that's not what I want. If I can avoid it ) .
Now how and where to can I send that feedback. I do not want to use the hal if that is possible. But where to and how is the hal sending that feedback signal .
Or where do I have to put that Value so that is available to the cnc.

Best rgds to all

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

More
19 Sep 2021 09:49 #221072 by udoS
This is where I'm as of today. (Yesterday... )
and still going...

 

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

Time to create page: 0.112 seconds
Powered by Kunena Forum