Labview UI project for Linuxcnc

More
24 Aug 2019 00:42 - 24 Aug 2019 00:46 #143022 by auto-mation-assist
One of the more interesting commands is the EMC_TASK_PLAN_INIT it executes and then sets additional values from the sub commands it calls up from a list.
The command that I manually issued to port 5005 was:
0000 0001 0000 0002 0000 0001 0000 0004 0000 0004 0000 01F5 0000 0000 0000 0000

(time=1566596833.133562,pid=8641): Socket opened by host with IP address 10.10.20.1.
(time=1566596841.388166,pid=8641): read 20 bytes from 4
(time=1566596841.388190,pid=8641): TCPSVR request received: fd = 4, serial_number=1, request_type=2, buffer_number=1
(time=1566596841.388204,pid=8641): read 4 bytes from 4
(time=1566596841.388222,pid=8641): rcs_sem_post(2457600) called.
(time=1566596841.388253,pid=8641): wrote 12 bytes to 4
Issuing EMC_TASK_PLAN_INIT -- ( +515,+20, +8,)
NML_INTERP_LIST(0x55ebcd591d20)::append(nml_msg_ptr{size=32,type=EMC_TRAJ_SET_TERM_COND}) : list_size=1, line_number=0
NML_INTERP_LIST(0x55ebcd591d20)::append(nml_msg_ptr{size=96,type=EMC_TRAJ_SET_G5X}) : list_size=2, line_number=0
NML_INTERP_LIST(0x55ebcd591d20)::append(nml_msg_ptr{size=96,type=EMC_TRAJ_SET_G92}) : list_size=3, line_number=0
NML_INTERP_LIST(0x55ebcd591d20)::append(nml_msg_ptr{size=32,type=EMC_TRAJ_SET_ROTATION}) : list_size=4, line_number=0
NML_INTERP_LIST(0x55ebcd591d20)::append(nml_msg_ptr{size=40,type=EMC_TRAJ_SET_SPINDLESYNC}) : list_size=5, line_number=0
NML_INTERP_LIST(0x55ebcd591d20)::append(nml_msg_ptr{size=32,type=EMC_SPINDLE_OFF}) : list_size=6, line_number=0
NML_INTERP_LIST(0x55ebcd591d20)::append(nml_msg_ptr{size=32,type=EMC_SPINDLE_OFF}) : list_size=7, line_number=0
NML_INTERP_LIST(0x55ebcd591d20)::append(nml_msg_ptr{size=24,type=EMC_COOLANT_MIST_OFF}) : list_size=8, line_number=0
NML_INTERP_LIST(0x55ebcd591d20)::append(nml_msg_ptr{size=24,type=EMC_COOLANT_FLOOD_OFF}) : list_size=9, line_number=0
NML_INTERP_LIST(0x55ebcd591d20)::append(nml_msg_ptr{size=96,type=EMC_TRAJ_SET_OFFSET}) : list_size=10, line_number=0
NML_INTERP_LIST(0x55ebcd591d20)::append(nml_msg_ptr{size=32,type=EMC_TRAJ_SET_TERM_COND}) : list_size=11, line_number=0
emcTaskPlanInit() returned 0
NML_INTERP_LIST(0x55ebcd591d20)::get(): {size=32, type=EMC_TRAJ_SET_TERM_COND}, list_size=10
emcTaskPlanLevel() returned 0
task: main loop took 0.068981 seconds
Issuing EMC_TRAJ_SET_TERM_COND -- ( +222,+32, +0, +2,0.000000,)
NML_INTERP_LIST(0x55ebcd591d20)::get(): {size=96, type=EMC_TRAJ_SET_G5X}, list_size=9
emcTaskPlanLevel() returned 0
Issuing EMC_TRAJ_SET_G5X -- ( +224,+96, +0, +1,-0.000000,0.000303,-1.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,)
NML_INTERP_LIST(0x55ebcd591d20)::get(): {size=96, type=EMC_TRAJ_SET_G92}, list_size=8
emcTaskPlanLevel() returned 0
Issuing EMC_TRAJ_SET_G92 -- ( +227,+96, +0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,)
NML_INTERP_LIST(0x55ebcd591d20)::get(): {size=32, type=EMC_TRAJ_SET_ROTATION}, list_size=7
emcTaskPlanLevel() returned 0
Issuing EMC_TRAJ_SET_ROTATION -- ( +226,+32, +0,0.000000,)
NML_INTERP_LIST(0x55ebcd591d20)::get(): {size=40, type=EMC_TRAJ_SET_SPINDLESYNC}, list_size=6
emcTaskPlanLevel() returned 0
Issuing EMC_TRAJ_SET_SPINDLESYNC -- ( +232,+40, +0,0.000000,\000,)
NML_INTERP_LIST(0x55ebcd591d20)::get(): {size=32, type=EMC_SPINDLE_OFF}, list_size=5
emcTaskPlanLevel() returned 0
Issuing EMC_SPINDLE_OFF -- ( +1305,+32, +0,)
NML_INTERP_LIST(0x55ebcd591d20)::get(): {size=32, type=EMC_SPINDLE_OFF}, list_size=4
emcTaskPlanLevel() returned 0
Issuing EMC_SPINDLE_OFF -- ( +1305,+32, +0,)
NML_INTERP_LIST(0x55ebcd591d20)::get(): {size=24, type=EMC_COOLANT_MIST_OFF}, list_size=3
emcTaskPlanLevel() returned 0
Issuing EMC_COOLANT_MIST_OFF -- ( +1405,+24, +0,)
NML_INTERP_LIST(0x55ebcd591d20)::get(): {size=24, type=EMC_COOLANT_FLOOD_OFF}, list_size=2
emcTaskPlanLevel() returned 0
Issuing EMC_COOLANT_FLOOD_OFF -- ( +1407,+24, +0,)
NML_INTERP_LIST(0x55ebcd591d20)::get(): {size=96, type=EMC_TRAJ_SET_OFFSET}, list_size=1
emcTaskPlanLevel() returned 0
Issuing EMC_TRAJ_SET_OFFSET -- ( +223,+96, +0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,)
NML_INTERP_LIST(0x55ebcd591d20)::get(): {size=32, type=EMC_TRAJ_SET_TERM_COND}, list_size=0
emcTaskPlanLevel() returned 0
Issuing EMC_TRAJ_SET_TERM_COND -- ( +222,+32, +0, +2,0.005000,)
task: main loop took 0.003233 seconds
Last edit: 24 Aug 2019 00:46 by auto-mation-assist. Reason: Changed: The command that I manually issued

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

More
24 Aug 2019 14:50 #143096 by auto-mation-assist
I have been searching for how to input the 'task set mode' enum number and it appears to me right now that over the years this may have been removed or perhaps re coded. In older versions of Lcnc "extern int emcTaskSetMode(int mode);" is present in emc.hh but not in more recent versions versions of emc.hh. It does make me wonder if past clean up work on Lcnc removed some NML related items that should have stayed in order to maintain full functionality of TCP port 5005. Is this a possibility ??

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

More
24 Aug 2019 15:34 #143099 by dgarrett

In older versions of Lcnc "extern int
emcTaskSetMode(int mode);" is present in emc.hh
but not in more recent versions versions of
emc.hh. It does make me wonder if past clean up
work on Lcnc removed some NML related items that
should have stayed in order to maintain full
functionality of TCP port 5005. Is this a
possibility ??


commit: df74db6f9 Thu Nov 28 12:40:17 2013 -0700
task: move a bunch of function declarations
to a more specific header

Ref: github.com/LinuxCNC/linuxcnc/commit/df74db6f9

First incorporated in v2.6.0:
$ git tag --contains df74db6f9 
v2.6.0
...
The following user(s) said Thank You: auto-mation-assist

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

More
25 Aug 2019 04:56 #143118 by auto-mation-assist
I have now downloaded all available versions of Lcnc from start in 2003 to present latest 2.9 for ref. I do see the changes that were made in 2.6.0 as compared to 2.5.0 and will look at those carefully in the next few days.

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

More
26 Aug 2019 05:01 - 26 Aug 2019 05:03 #143191 by auto-mation-assist
My additions of all the older extern integers did not get the results I had hoped for as a simple resolution. I did change void emcTaskPlanExit() to 'int' from void and the other locations required and recompiled. It only gave me this warning, emc/task/emctask.cc:516:1: warning: no return statement in function returning non-void [-Wreturn-type]. Adding a return statement did not help. I will bring it back to "void' and recompile to see that makes a difference. I shall continue to figure out on how to get the enum variables entered via hex encoded commands to port 5005 for the commands that require them.

I also took some time to look at the status request responses and noticed that entering NMLTYPE 1499 actually routes to 1999 internally by Lcnc since this is what is reported in a typical status message. The same for other status requests using type 1599. This leads me to suspect that there is a possibility that NMLTYPE 1999 is being used for every type of status request now. My byte count shows 8244 for type 1999 status request and it has a message length of 139741. This using my QTvcp development system not updated since around march of this year..

An additional 20 byte message is send just prior to sending status data and contains the below items (all 4bytes in length).
Typically looks like (Hex): 0000 0001 0000 0002 0000 2034 0002 21DD 0000 0001
0 - 0000 0001 Remote Request type
4 - 0000 0002 Buffer number
8 - 0000 2034 Status part of the message in bytes (8244)
12 - 0002 21DD message lenght (139741)
16 - Serial number echo that user sent.
This is immediately followed by: FFFF FFFF FFFF FFFF FFFF FFFF and then the status message itself in my tests.
Last edit: 26 Aug 2019 05:03 by auto-mation-assist.
The following user(s) said Thank You: tommylight

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

More
26 Aug 2019 07:24 - 26 Aug 2019 07:31 #143194 by auto-mation-assist
I checked my earlier file modifications and found that a problem with my editing. I have been able to enter the enum values now.
1 = manual mode, 2 = auto, 3 = mdi.
I need to check on this value further: (read 35 bytes from 4) in the below responses
.
Manual Mode
(time=1566803508.455991,pid=14498): Socket opened by host with IP address 10.10.20.1.
(time=1566803519.480054,pid=14498): read 20 bytes from 4
(time=1566803519.480080,pid=14498): TCPSVR request received: fd = 4, serial_number=1, request_type=2, buffer_number=1
(time=1566803522.060326,pid=14498): read 35 bytes from 4
(time=1566803522.060359,pid=14498): rcs_sem_post(6750208) called.
(time=1566803522.060391,pid=14498): wrote 12 bytes to 4
Issuing EMC_TASK_SET_MODE -- ( +504,+24, +3, +1,)

Auto Mode
(time=1566803618.732544,pid=14498): Socket opened by host with IP address 10.10.20.1.
(time=1566803622.541164,pid=14498): read 20 bytes from 4
(time=1566803622.541190,pid=14498): TCPSVR request received: fd = 4, serial_number=1, request_type=2, buffer_number=1
(time=1566803626.041421,pid=14498): read 35 bytes from 4
(time=1566803626.041455,pid=14498): rcs_sem_post(6750208) called.
(time=1566803626.041488,pid=14498): wrote 12 bytes to 4
Issuing EMC_TASK_SET_MODE -- ( +504,+24, +4, +2,)

MDI Mode
(time=1566803813.570980,pid=14498): Socket opened by host with IP address 10.10.20.1.
(time=1566803818.783676,pid=14498): read 20 bytes from 4
(time=1566803818.783711,pid=14498): TCPSVR request received: fd = 4, serial_number=1, request_type=2, buffer_number=1
(time=1566803822.563868,pid=14498): read 35 bytes from 4
(time=1566803822.563901,pid=14498): rcs_sem_post(6750208) called.
Issuing EMC_TASK_SET_MODE -- ( +504,+24, +8, +3,)

in the above: the +505 is NMLType, +24 is bytes for the task, +8 is serial number, +3 is enum selection value
Last edit: 26 Aug 2019 07:31 by auto-mation-assist.
The following user(s) said Thank You: tommylight

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

More
28 Aug 2019 08:21 - 28 Aug 2019 08:38 #143416 by auto-mation-assist
Progress has been good. I have the status polling working out of TCP port 5005 now and did the basic decoding for position data and display for X, Y , Z and A. Testing at the rate of 200 times per second for full status buffer updates and transferring 8264 bytes of status buffer data each time. Sending status update requests every 5ms. Nice and speedy.
Last edit: 28 Aug 2019 08:38 by auto-mation-assist. Reason: Added the word 'for' in (decoding for position data)

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

More
28 Aug 2019 19:28 - 01 Sep 2019 14:59 #143471 by auto-mation-assist
For my testing the status 5005 TCP port I developed this small sub program as part of my labview gui to verify that things were working well. It ran for 4 hours with no problems. Will work on decoding additional status items next. A while back I mentioned adding some external task parameters back it. This involved three files. emc.hh, emctask.cc and task.hh.

This a a snap shot of the temporary vi that I used for communicating with LinuxCnc over the network using the NML interface on port 5005.

You may notice that C axis position display is not present. I forgot to add the display for it but its position data is being processed.

Attachments:
Last edit: 01 Sep 2019 14:59 by auto-mation-assist. Reason: Added note for the missing C axis position display.
The following user(s) said Thank You: phillc54

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

More
31 Aug 2019 21:02 - 31 Aug 2019 21:06 #143747 by auto-mation-assist
I have been working refining some code and further testing. Here are my present helper notes for requesting status data. If anyone has any info on data offsets within the received status data I would love to get that information. Actual position values are no problem since the values can be found easily in the 8244 bytes of status data.



And here is some of my info for sending commands with those that have options available via enums. The arrow on the buffer is pointing the wrong way. I will fix that in my notes.



I will be working on the command formats that use and require variable user data to be entered instead of enums next.
Attachments:
Last edit: 31 Aug 2019 21:06 by auto-mation-assist. Reason: The arrow on the buffer is pointing the wrong way. I will fix that in my notes.

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

More
01 Sep 2019 04:23 #143756 by auto-mation-assist
Converted more of my notes into a drawing. This one is for the command format to send to port 5005 for commands that set instantly with no further input required. In this sample I use Mist On.

Attachments:

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

Time to create page: 0.188 seconds
Powered by Kunena Forum