emcrsh: server part locks up

More
16 Oct 2011 00:00 #13940 by jpka
Hi!
I try to control Emc2 software via 'emcrsh', because i read about this is recommended way to do some non-trivial tasks like SMT Pick and place machine, and other types of external control.
I'm configure my system in standard way so i able milling well. Then, only i change is add 'loadusr emcrsh' in .hal file.
I not find any working example (command sequence) for emcrsh, so i try to write from scratch.
Here is my terminal log:
telnet 10.1.1.73 5007
Trying 10.1.1.73...
Connected to 10.1.1.73.
Escape character is '^]'.
hello EMC x 1.0
HELLO ACK EMCNETSVR 1.1
set verbose on
set verbose on
SET VERBOSE ACK
set enable EMCTOO
set enable EMCTOO
SET ENABLE ACK
get time
get time
TIME 1318719448.462683
set estop OFF
set estop OFF
SET ESTOP ACK
set update auto
set update auto
SET UPDATE ACK
set machine on              (x)
set machine on              (x)
set machine on              (x)
set estop off                  (x)
get mode                      (x)...
^]

telnet> q
Connection closed.

...but in places shown as (x), i not receive anything, and all stops until i disconnect telnet, and connect again (and 'hello' again, etc) - then 'set machine on' command, which first time always stop telnet server, second time always work. I reproduce it multiple times, and i reproduce it not only in hand mode, but also in simple C code which work in raw string send/receive mode, like telnet.
Where i am wrong? Probably command order?..
Thanks!

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

More
16 Oct 2011 11:38 #13946 by jpka
I just found topic which describes exactly same problem:
www.linuxcnc.org/component/option,com_ku...ew/catid,10/id,1633/
But it still not has a solution.

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

More
20 Oct 2011 13:39 #14070 by jpka
Hi!
Still no luck. I also check jitter and try increase Base_period, but it is not helpful.
Any chances to turn it to work?..
Please give me the direction where to search about fixing Emcrsh. Any success stories about using Emcrsh exist?.. Or, maybe another way to control Emc2 from my software, is exist?
Many thanks!

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

More
20 Oct 2011 14:59 #14072 by andypugh
I don't think it is very heavily used, so very few, if any, forum users have any experience.
You could try asking on the mailing list, which more of the developers read.
(Look at the "Community" link at the top)

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

More
22 Oct 2011 23:50 #14116 by andypugh
I don't know if you were the one who raised the Sourceforge bug report, but that has elicited a workaround, at least:

thread.gmane.org/gmane.linux.distributions.emc.devel/4983

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

More
23 Oct 2011 13:37 #14135 by ArcEye
jpka wrote:

set update auto
SET UPDATE ACK
set machine on (x)


Hi

There has been a bit of discussion on emcrsh both here and on the user list, so I thought that I would try it.

The command sequence you posted does produce the result you specified, ie emcrsh seems to lock up and does not respond until restarted on 2.4.5

However, I did not try your sequence to start with and because update defaults to auto anyway, I just did the sequence below.
hello EMC emcrsh 2.4.5
set enable EMCTOO
set verbose on
set echo off
set estop off
set machine on
set mode manual
set home 0 (again for 1 and 2)
set mode mdi
set mdi g00 x20 y20 z20
shutdown

It worked perfectly, homed the axes then moved to the given co-ordinates.
I did not do extensive testing, just wanted to home and test axis movement, which were the major control items.

I will dig through the emcrsh code later to see if anything leaps out at me as to why and whether this tallies with the bugfix that Andy highlighted.

For now appears the factor which caused the lock-up was the set update auto command.
Seems to work OK if you don't use it.

regards

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

More
24 Oct 2011 15:29 #14174 by ArcEye
Hi

Just a quick update.

The workaround from Eric Johnson that Andy flagged up, is basically to issue a
set set_wait none
after enabling.

I tested this and found that emcrsh no longer hung no matter how many
set update none | auto
set machine on | off

etc. commands were issued.

I had full functionality controlling a pre-loaded Axis gui, with emcrsh launched from a terminal after Axis.

The only issue I found, was that emcrsh does not read the .ini file for default file path even if you specify it.
It defaults to ../../nc_files unless launched with the --path switch.

This was easily overcome by creating a symlink ~/emc2/nc_files which pointed to where my default gcode files actually are.

Hopefully this helps

regards

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

More
25 Oct 2011 20:11 - 25 Oct 2011 20:12 #14250 by jpka
Hi!
Thanks for your replies, either here on web forum, and at emc-users mailing list.
It looks like this problem now solved.
I try to answer questions i get from mailing list and from here:

Are you entering those commands through a telnet
session, i.e. manually typing them?

I use both cases with same result. (I attach my tiny C program here, please see below)

First thing to do would be to use one of the standard configurations, like
stepper_inch, and only change it by adding "loadusr emcrsh" to the
associated hal file. This can isolate the problem from emcrsh specifically
with something to do with your specific configuration.

Sorry but i currently don't know how to use 'stepper_inch', but yes, only i change in my setup is adding "loadusr emcrsh", but it was not in 'stepper_inch' but in almost clean liveCD installation.

If the problem persists, try removing the update command.

It is not helpful.

Also, why are you doing a "set estop off" after a "set machine on"

Reversed order is not work, i don't know why. (again, it can be easy tested using my program below)

BTW, you can use "set echo off" to eliminate the command echo.

Yes, i try it but my C programming skill too low, so when i switch echo off, *some* commands not send answer at all, and i can't easy handle this. But real programmers maybe can help me with it.

It's weird that the sample config works but switching to emcrsh locks it up. Are you sure adding emcrsh was the only change between the working and broken configs?

Adding "loadusr emcrsh" is really only i change. But Emc software itself, and Axis GUI, never locks up, regardless of this. Only that lock up is "emcrsh" server (daemon) itself, and unlocks when TCP/IP reconnect to it (you may see obsolete commented-up code parts to avoid it, in my C example). When "emcrsh" part locked up, Emc itself works just fine, and i'm able to mill.

What are you doing in your base thread that 100 microseconds is not enough?

I don't know. I write about 'base thread' value only because i found, during blind random tests, that if i increase this value, then i get described effect. Maybe it can be helpful for problem catching.

Here's a config based on emcrsh that i'm trying to use for testing, it works well on my machines and may be a useful starting point for you: <git.linuxcnc.org/gitweb?p=emc2.git;a=tre...a1aadbb0191741d0d5a6>

Thank you, i look on it but currently not find a way to use it, i'm too novice now. I try to use it soon, when i dive into EMC philosophy and software structure.

I don't know if you were the one who raised the Sourceforge bug report, but that has elicited a workaround, at least:
thread.gmane.org/gmane.linux.distributions.emc.devel/4983

No, it is not my bugreport, but it describes exactly same problem. Thanks!

However, I did not try your sequence to start with and because update defaults to auto anyway, I just did the sequence below.
(code...)

I repeat this and get same resuls as before, locking up at (x) places:
*Very important that i now turn on computer and start EMC first time after boot-up, and do nothing (press any buttons etc.) with Axis GUI manually:*
hello EMC emcrsh 2.4.5    <-- i use exactly same command as in your example, while i have 2.4.6
HELLO ACK EMCNETSVR 1.1
set enable EMCTOO
set enable EMCTOO
set verbose on
set verbose on
SET VERBOSE ACK
set echo off
set echo off
SET ECHO ACK
set estop off
SET ESTOP ACK	<--  small delay, sure it's OK
set machine on (x)
set mode manual (x)
set mode manual (x)
set mode manual (x)
set estop off (x)
set estop off (x)

...BUT...
now i press ^], q, then start telnet again, and... viola!
hello EMC emcrsh 2.4.5
HELLO ACK EMCNETSVR 1.1
set enable EMCTOO
set enable EMCTOO
set verbose on
set verbose on
SET VERBOSE ACK
set echo off
set echo off
SET ECHO ACK
set estop off
SET ESTOP ACK <--  small delay, sure it's OK
set machine on
SET MACHINE ACK
set home 0
SET HOME ACK  <--  small delay, sure it's OK
set home 1
SET HOME ACK  <--  small delay, sure it's OK
set home 2
SET HOME ACK  <--  small delay, sure it's OK
set home 3      <- i have 4 axis, not 3
SET HOME ACK  <--  small delay, sure it's OK
set mode mdi
SET MODE ACK
set mdi g00 x20 y20 z20  <-- It work, it work!
SET MDI ACK
shutdown
Connection closed by foreign host.

When i write my test program, i run it multiple times, either using 'set update auto', 'none' or not using it at all. Then i notice that *first* time after start Emc, it *always* locks at 'set machine on'. (but command itself is work: machine turns on.) Second time it always pass 'set machine on', but *sometimes* locks on some of subsequental commands like (usually) 'set mode mdi'.

And solution is...

Just a quick update.
The workaround from Eric Johnson that Andy flagged up, is basically to issue a
set set_wait none
after enabling.


After this, i get working setup without lock-ups. I test it using C program i attach here. Sorry for my novice code "style".
Emcrsh is still full of questions, i write it in new topic.

Thank you very much! :-)

File Attachment:

File Name: emctest.txt
File Size:6 KB
Attachments:
Last edit: 25 Oct 2011 20:12 by jpka. Reason: add attach (native C files not allowed - rename it to txt)

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

More
26 Oct 2011 02:07 #14264 by dgarrett
to get emcrsh to use a non default ini file:

$ emcrsh -- -ini path_to_ini_file

works for me (emc2.5.0~pre2)
the -- separator is required:


$ emcrsh --help
Usage:
emcrsh [Options]
Options:
--help this help
--port <port number> (default=5007)
--name <server name> (default=EMCNETSVR)
--connectpw <password> (default=EMC)
--enablepw <password> (default=EMCTOO)
--sessions <max sessions> (default=-1) (-1 ==> no limit)
--path <path> (default=../../nc_files/)
emcOptions:
-ini <inifile> (default=emc.ini)

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

More
26 Oct 2011 08:03 - 26 Oct 2011 08:07 #14269 by ArcEye
Hi Dewey

I was using 2.4.5 because that is what jpka was using but didn't see any major code changes that would explain.

I loaded the .ini file using the emcrsh -- -ini ~/emc2/configs/sim/axis_mm.ini notation,
and it was taking, because I could query get inifile and emcrsh returned the path I had entered.

However if I entered a set open test.ngc the debug return was can't open ../../test.ngc, so it had reverted to the default
and not read the [DISPLAY] PROGRAM_PREFIX = ~/emc2/ngc/ from the .ini file

I did try not specifying any .ini file and then creating symlinks called emc.ini to the actual .ini file I was using and placing them in various directories to see if emcrsh would pick them up, but it didn't. There was no pre-existing emc.ini anywhere in my .../config directory.

Scanning the code for emcrsh, I saw that whilst it loaded the .ini file, it did not make any calls to inifile.Find(..) etc to search for the PROGRAM_PREFIX tag.
At this point, having found a workable solution that met jpka's needs I did not trace through further as I have no actual need for the facility at present, I was just interested in its operation.

regards
Last edit: 26 Oct 2011 08:07 by ArcEye.

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

Time to create page: 0.095 seconds
Powered by Kunena Forum