halshow with PathPilot 2

More
19 Sep 2018 08:54 - 01 Oct 2018 13:06 #117740 by rafferty
With these fixes ADMIN HALSHOW now works under PathPilot V2.1.3.

Can now also open a new shell while PathPilot is running and run halcmd, halmeter, halscope and halshow in that shell.

Required are one or two files not in PathPilot 2, they are halshow.tcl and haltcl. They are in the LinuxCNC distribution and in Stigoe's LinuxCNC Mint build Compiling full LinuxCNC to get realtime components for use with PathPilot 2 . Both are scripts.

The haltcl file is needed only for halrun which appears to work, halrun -U will certainly shutdown a running PathPilot but bringing up a new environment needs testing.

I tried to do this with minimum changes, no existing files are modified, all done by creating directories and linking to existing files.

The following lines assume /home/operator/tmc is a link to the current PathPilot (as it normally would be be)
mkdir -p /home/operator/repos/tormach_linuxcnc/linuxcnc/
cd /home/operator/repos/
ln -s /home/operator/repos/tormach_linuxcnc/ pathpilot3
cd tormach_linuxcnc/linuxcnc/
mkdir bin
mkdir tcl
mkdir tcl/bin
sudo chmod 4755 home/operator/tmc/bin/rtapi_app
ln -s /home/operator/tmc/bin/rtapi_app /home/operator/repos/tormach_linuxcnc/linuxcnc/bin/rtapi_app
ln -s /home/operator/tmc/rtlib home/operator/repos/tormach_linuxcnc/linuxcnc/rtlib
ln -s /home/operator/tmc/tcl/hal.so /home/operator/repos/tormach_linuxcnc/linuxcnc/tcl/hal.so
ln -s /home/operator/tmc/tcl/linuxcnc.tcl /home/operator/repos/tormach_linuxcnc/linuxcnc/tcl/linuxcnc.tcl
ln -s /home/operator/tmc/tcl/linuxcnc.so /home/operator/repos/tormach_linuxcnc/linuxcnc/tcl/linuxcnc.so
ln -s /home/operator/tmc/scripts/halrun /home/operator/tmc/bin/halrun

Copy in the one required file
copy the halshow.tcl file to /home/operator/repos/tormach_linuxcnc/linuxcnc/tcl/bin/ 

Optionally copy in and edit the haltcl file for halrun
copy the haltcl file to /home/operator/tmc/bin/ and change the first two lines to 
#!/usr/bin/tclsh8.6
load /home/operator/repos/tormach_linuxcnc/linuxcnc/tcl/hal.so

Add the folloing three lines to the end of .bashrc to run hal commands from a shell (sorry, one existing file is modified)
export LD_LIBRARY_PATH="/home/operator/tmc/lib"
export PATH="/home/operator/tmc/bin":$PATH
export LINUXCNC_RTLIB_DIR="/home/operator/tmc/rtlib"

Let me know if it works for you, if not I'll try and work out what I've left out.

Good luck.

---

Update:

halrun is running from a shell.

halrun -I file name works, as does the command "source filename" at the halrun interactive prompt (halcmd: )

The optional haltcl file doesn't seem to be required, I've not committed to removing yet, just renamed it out of reach until I work out why it seemed necessary at some stage.

Update2:

fixed first code section so the 3 directories are created in the right place.
Last edit: 01 Oct 2018 13:06 by rafferty. Reason: correct error in code list
The following user(s) said Thank You: andypugh, Clive s, tivoi, racedirector
More
30 Sep 2018 06:34 #118218 by rudydp
Replied by rudydp on topic halshow with PathPilot 2
The directory structure and links do not make sense to me. Either the directories bin, tlc and tlc/bin are in the wrong place (in repos), or the links in which they are referred to may be wrong.

Can you please check them again.
More
01 Oct 2018 05:29 #118268 by racedirector
Thanks for this but a few things seem to be an issue.

Firstly you seem to create bin, tcl and tcl/bin in the wrong place, I created them in /home/operator/repos/tormach_linuxcnc/linuxcnc/ and then did the linking and all works.

What is the purpose of the pathpilot3 link? Doesn't seem to do anything

My install didn't need the haltcl file, ADMIN HALSHOW works without it.

Anyhow, again thanks for the effort, it works great!
More
01 Oct 2018 13:00 #118286 by rafferty
Replied by rafferty on topic halshow with PathPilot 2
Yes, you are both correct, the bin, tcl and tcl bin should be in /home/operator/repos/tormach_linuxcnc/linuxcnc/. I edited my list so the pathpilot3 link could be created easily and didn't look further ahead. I'll correct my earlier post to fix this.

About the pathpilot3 link, dumping files in tmc bin, lib, rtlib and tcl directories it looks like LinuxCNC/PathPilot was configured using a build path that contained pathpilot3.

Have a look at tmc/bin/halshow, a text file
#!/usr/bin/tclsh8.6
source /home/operator/repos/pathpilot3/linuxcnc/tcl/bin/halshow.tcl

Could be the link is needed if PathPilot hasn't set up the runtime environment. I've been running halshow -I <file> in one shell and then halshow in another shell (or some other hal command).

I'll have a look in the next couple of days at what exactly is needed for shell use and MDI ADMIN use.

Thank you both for the corrections.
The following user(s) said Thank You: racedirector
More
01 Oct 2018 23:30 #118326 by rafferty
Replied by rafferty on topic halshow with PathPilot 2
The pathpilot3 link is needed to run halscope from a shell.

Still not sure about the haltcl file, previously I said I'd renamed it out of the way to see if it was required but as I look today it's still there.

I moved it now, doesn't seem to be needed, but puzzled why I thought it was.
More
01 Dec 2018 16:35 #121679 by smgvbest
Replied by smgvbest on topic halshow with PathPilot 2
It's actually easier than this
edit ~/tmc/bin/halshow

change
#!/usr/bin/tclsh8.6
source /home/operator/repos/pathpilot3/linuxcnc/tcl/bin/halshow.tcl

to
#!/usr/bin/tclsh8.6
source ~/tmc/tcl/bin/halshow.tcl

copy halshow.tcl from linuxcnc to ~/tmc/tcl/bin
make sure operator is owner, should be since you copied from that ID

you can get halshow.tcl from the git repo
github.com/LinuxCNC/linuxcnc/blob/master/tcl/bin/halshow.tcl

copy/paste into an editor and save it

this worked for me.
minimal changes needed
More
01 Dec 2018 19:52 #121686 by rafferty
Replied by rafferty on topic halshow with PathPilot 2
Wow, that is a lot less work!

It was three months ago when I was looking at this, my ageing brain has discarded the details of the changes.

I had two aims, 1) have a working halshow from Pathpilot and 2) being able to run the various hal tools from a terminal without starting PathPilot.

Have you tested my 2nd aim, the hal tools in a terminal without PathPilot running?
More
02 Dec 2018 19:58 #121725 by smgvbest
Replied by smgvbest on topic halshow with PathPilot 2
Change these
copy the haltcl file to /home/operator/tmc/bin/ and change the first two lines to 
#!/usr/bin/tclsh8.6
load /home/operator/repos/tormach_linuxcnc/linuxcnc/tcl/hal.so
Add the folloing three lines to the end of .bashrc to run hal commands from a shell (sorry, one existing file is modified)
export LD_LIBRARY_PATH="/home/operator/tmc/lib"
export PATH="/home/operator/tmc/bin":$PATH
export LINUXCNC_RTLIB_DIR="/home/operator/tmc/rtlib"

to
copy the haltcl file to /home/operator/tmc/bin/ and change the first two lines to 
#!/usr/bin/tclsh8.6
load /home/operator/tcl/hal.so
Add the following three lines to the end of .bashrc to run hal commands from a shell (sorry, one existing file is modified)
export LD_LIBRARY_PATH="~/tmc/lib"
export PATH=~/tmc/bin:~/tmc/scripts:$PATH
export LINUXCNC_RTLIB_DIR="~/tmc/rtlib"

that should do the same thing
I haven't checked it but if that was all you had to do that change to PATH should be all that's needed
Moderators: cncbasher
Time to create page: 0.087 seconds
Powered by Kunena Forum