sending current position over UDP ?

More
27 Feb 2016 15:20 #70708 by flipflop
Hey!
Is here a way to send updates of current position over UDP? What is the best method? Don't want to reinvent wheel. Googling didn't help for some reason.

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

More
27 Feb 2016 19:19 #70719 by PCW
The short answers are " yes" , and "it depends"

If you explained what you are trying to do, its more likely someone could provide a better answer

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

More
27 Feb 2016 19:27 #70720 by flipflop
i'm just playing with android. Wanna build a simple app that would just display the current position of the mill and its rpm.

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

More
27 Feb 2016 20:15 #70728 by PCW
Since you just need to read hal pins there's probably something clever that can be done
either with halcmd or a python network script with the hal interface (a userspace hal component)

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

More
27 Feb 2016 20:26 - 27 Feb 2016 20:27 #70729 by flipflop
Do I understand it correctly that emc2 exposes all its hal pins to the operating system? Does it basically have these values in some files that can be read from some external script, so I will just need to build a script that either would read those files in a loop and send values over udp, or (which is better) look for changes in these files (or receive notifications of such changes from emc2) and then transfer these new values over udp? How do I access coordinates from python?
Anyways, may be you know of any handy tutorial?
Last edit: 27 Feb 2016 20:27 by flipflop.

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

More
27 Feb 2016 22:21 #70732 by andypugh

i'm just playing with android. Wanna build a simple app that would just display the current position of the mill and its rpm.


Do you want to just do that, or write something to do that?

If a ready-made solution is acceptable: wiki.linuxcnc.org/cgi-bin/wiki.pl?Rockhopper_Web_Server

When I want to sit in the warm house waiting for the machine on the cold garage to finish, I use ssh.
ssh -Y andypugh@mill.local
halcmd -kf
loadusr halmeter -s pin motion.program-line

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

More
28 Feb 2016 06:07 #70743 by mariusl
You definitely do it in a Python script that is loaded at run time by HAL. I have done that before with the arduino and except for a short delay every now and then, it give good throughput.

I will see if I can find that work again and post it here for you to look at.

Regards
Marius


www.bluearccnc.com

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

More
28 Feb 2016 06:14 #70744 by mariusl
Have a look here for the sample code

UDP COMMS

Regards
Marius


www.bluearccnc.com

The following user(s) said Thank You: flipflop

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

More
28 Feb 2016 13:26 #70747 by flipflop
It looks like the first file there is a hal setting file, the third file is a python script file, and the second one looks like your code for arduino? If you provided a bit more comments, it woull have been much easier. So far what I see is manipulation with pins and their states, but if I don't want to make my script count pin state changes, is there a way to read coordinates directly?

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

More
28 Feb 2016 14:50 - 28 Feb 2016 14:54 #70750 by mariusl
The code was not meant to be for public use but rather just a test to see what can be done on UDP.
The bits you want to look at is the network stuff, not really the arduino or i/o stuff. You can connect to HAL signals in a similar fashion as what I did with the I/O.
You will have to use a bit of imagination I am afraid.

P.S. Read the thread as it gives a lot of information. Also the comments in the Python file

Regards
Marius


www.bluearccnc.com

Last edit: 28 Feb 2016 14:54 by mariusl.

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

Time to create page: 0.125 seconds
Powered by Kunena Forum