Newbie @ EMC2 : How to reroute EMC2 (HAL) ouput?

More
22 Oct 2011 10:11 #14098 by Grimg
Hi all.

I'm new to EMC2 (~month or so). Also been using linux (UBUNTU 8.04 - 11.10) for a couple of years, but I installed 10.04 from live CD with EMC2.

Anyway, my question is: Is it possible to reroute output from EMC2 (HAL) to a .txt file?

Best regards,

Grim.

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

More
22 Oct 2011 23:04 #14113 by andypugh
Grimg wrote:

Anyway, my question is: Is it possible to reroute output from EMC2 (HAL) to a .txt file?.

Yes, though I don't know of any good examples, and I have never done it.

You need to use "halsampler" in Userspace and "sampler" in HAL.

www.linuxcnc.org/docview/html/man/man1/halsampler.1.html

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

More
23 Oct 2011 10:49 #14128 by Grimg
Thank you for your answer. I'll give it a try and post my results.

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

More
30 Oct 2011 12:31 #14420 by Grimg
[PIPING ISSUES]

OK, so in the last couple of days, I've managed to connect sampler in HAL i halsampler in userspace and make it to print some values from siggen to terminal window.

BUT, I just can't print that values to file. I have ony managed to print "hal-ish" type (for example sampler.0.pin.1.txt) of info from the pins (from siggen) that I have connected to sampler. I don't need that. I just need e.g. signal from siggen > siggensignal.txt

I've looked on net for solutions and found none.

Is information that I am looking for in those hal files, or I am doing something wrong?

The content of those files are something like this:

Usage:
net rpc Run functions using RPC transport
net rap Run functions using RAP transport
net ads Run functions using ADS transport
net file Functions on remote opened files
net share Functions on shares
net session Manage sessions
net server List servers in workgroup
net domain List domains/workgroups on network
net printq Modify printer queue
net user Manage users
net group Manage groups
net groupmap Manage group mappings
net sam Functions on the SAM database
net validate Validate username and password
net groupmember Modify group memberships
net admin Execute remote command on a remote OS/2 server
net service List/modify running services
net password Change user password on target server
net changetrustpw Change the trust password
net changesecretpw Change the secret password
net time Show/set time
net lookup Look up host names/IP addresses
net join Join a domain/AD
net dom Join/unjoin (remote) machines to/from a domain/AD
net cache Operate on the cache tdb file
net getlocalsid Get the SID for the local domain
net setlocalsid Set the SID for the local domain
net setdomainsid Set domain SID on member servers
net getdomainsid Get domain SID on member servers
net maxrid Display the maximul RID currently used
net idmap IDmap functions
net status Display server status
net usershare Manage user-modifiable shares
net usersidlist Display list of all users with SID
net conf Manage Samba registry based configuration
net registry Manage the Samba registry
net eventlog Process Win32 *.evt eventlog files
net help Print usage information

Any thoughts?

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

More
30 Oct 2011 14:02 #14425 by andypugh
Grimg wrote:

The content of those files are something like this:

Usage:
net rpc Run functions using RPC transport
net rap Run functions using RAP transport
net help Print usage information

Any thoughts?


That is a completely _different_ net command.

We need to know more about your environment, are you working with EMC2 up and live, outside EMC2 from the command prompt? Or what.

www.linuxcnc.org/docview/html/hal_basic_hal.html
Might help, but if you are typing those commands at the terminal prompt then you need to either prefix them all with "halcmd" or start a realtime session with "halrun"
linuxcnc.org/docs/html/man/man1/halrun.1.html

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

More
31 Oct 2011 11:36 #14459 by Grimg
Step 1. I try to execute next commands in terminal to check if I can pipe signal info to .txt file.

cd emc2
halrun
loadrt siggen
loadrt sampler depth=600 cfg=ffffffff
loadrt threads name1=thrd1 period1=1000000
net sig2 siggen.0.cosine => sampler.0.pin.1
net sig3 siggen.0.sine => sampler.0.pin.2
net sig4 siggen.0.square => sampler.0.pin.3
addf siggen.0.update thrd1
addf sampler.0 thrd1
setp siggen.0.amplitude 10
start
loadusr halsampler -t
stout >> halabuka.txt

If this works, I'll go to step 2.

Step 2. Run EMC2(with TkEMC gui), basic 3 axis config (XYZ) made by Stepconf wizard with modified custom.hal file with commands from step 1 (with appropriate changes in cfg for 3 axis signals), open file with G commands and run it.

Comment1: 3 axis config is working fine, I have run it separately.
Comment2: All this I am running on 3 years old Asus laptop ( :S ). If I run EMC and don't touch anything while it runs, there are no problems :laugh: .

From my observations while running over and over step 1 (every time I use halrun -U before next try) I think that the last line from step 1

stout >> halabuka.txt

somehow never gets executed. Instead I get sampler.0.pin.1.txt , sampler.0.pin.2.txt and sampler.0.pin.3.txt with contents like from my last post. Command halsampler -t executes - it starts printing in terminal window values from siggen - terminal does respond to commands, you just can't see what are you typing because halsampler prints really fast values in terminal.

Question1: There was FILENAME option in halsampler command (I have saved it on my laptop), but when I open that page now that option does not exist anymore. Was it deleted or changed?


Once again, any thoughts are welcome.

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

More
31 Oct 2011 11:48 #14461 by andypugh
Grimg wrote:

Step 1. I try to execute next commands in terminal to check if I can pipe signal info to .txt file.

...
stout >> halabuka.txt


I suspect that the last command won't work inside a halrun session. It might work if you open a second terminal. If you exit the halrun session to get to a shell prompt, then all the RT stuff is unloaded.

Question1: There was FILENAME option in halsampler command (I have saved it on my laptop), but when I open that page now that option does not exist anymore. Was it deleted or changed?

it still seems to be there: www.linuxcnc.org/docview/html/man/man1/halsampler.1.html

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

More
31 Oct 2011 12:06 #14463 by Grimg
I will try stout >> halabuka.txt in terminal

Question1: There was FILENAME option in halsampler command (I have saved it on my laptop), but when I open that page now that option does not exist anymore. Was it deleted or changed?

it still seems to be there: www.linuxcnc.org/docview/html/man/man1/halsampler.1.html

Oh, that's strange. I"ve could sworn I didn"t see that page...

Thanks for help.

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

More
31 Oct 2011 12:48 #14464 by Grimg
Ok, I have just tried some possible commands and command: "script" in bash seems most promising.

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

More
31 Oct 2011 19:25 #14473 by Grimg
Finally I have managed to reroute output from EMC2 to .txt file.
All I needed to do is add this to my custom.hal file:

loadrt sampler depth=600 cfg=bbbbbbbbb
net xstep => sampler.0.pin.0
net xdir => sampler.0.pin.1
net ystep => sampler.0.pin.2
net ydir => sampler.0.pin.3
net zstep => sampler.0.pin.4
net zdir => sampler.0.pin.5
net astep => sampler.0.pin.6
net adir => sampler.0.pin.7
net xenable => sampler.0.pin.8
addf sampler.0 servo-thread
start
loadusr halsampler XYZsempler.txt

Also, I have noticed that when you specify FILENAME for halsampler, the command recognizes other parameters e.g. -t as another FILENAME and reports error. I don't know if it's bug or something else.

Thanks andypugh for help.

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

Time to create page: 0.093 seconds
Powered by Kunena Forum