Notes on running EMC2 with a remote GUI
Notes on running the EMC GUI remotely
Goal: To run EMC on my Bridgeport with a PC mounted in a cabinet
attached to the rear of the machine, and another small form
factor or notebook mounted on a boom in the front. This way
the parallel port connection from the control PC to the servo controller
can be kept short and the GUI computer can be just about
anywhere Ethernet can go. These notes may change over time. Any suggestions or corrections are welcome at kwallace AT wallacecompany D0T com.
(Reference documents:
http://www.linuxcnc.org/handbook/part3/remoteg.html
Sample nml's that come with EMC2 - /etc/emc2/sample-configs/common/client.nml and .../server.nml
NFS information - http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Debian_Etch_Server_And_Diskless_EMC2_Thin_Clients
Multiple UI's - http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Running_Multiple_User_Interfaces )
See the Multiple UI's document above to see the different ways that EMC can be remotely operated. The method described below redirects (or actually directs to an additional stream?) NML messages between the GUI and the other EMC elements.
EMC needs to have 1 through 4 running:
1. GUI - AXIS (set in .ini file under [DISPLAY])
2. TASK - milltask (set in .ini under [TASK])
3. MOTION - motmod (set in .ini under [EMCMOT])
4. IO - io (set in .ini under [EMCIO])
This project will run only the GUI remotely.(At this time the AXIS GUI does not work, but tkemc does.)
Additionally, EMC user files will be located on a file server in /common/EMC_Library, mounted to /home/user_name/emc2 on the server and client PC's.
I have DHCP running but no local DNS so my configurations use IP addresses instead of computer names. Maybe some day I'll fix this.
(It appears that other than the comments in my clientXX.nml and serverXX.nml files, they are the same, so only one file is needed. The files will be different if you use "localhost", as in other sample .nml files)
Control or Server PC Setup
1. Connect to NFS file server
a. Open /System/Administration/Synaptic Package Manager. Select nfs-common and portmap for installation. Select Apply and approve the dependencies.
b. change /etc/passwd, /etc/group UID and GID numbers to match user's account settings on file server.
c. reset file permission for owner and group in user's home directory.
"chown -R XXX:XXX /home/user_name "
d. Reboot to apply the user account settings. There may be a better way to do this.
e. create /home/user_name/emc2 directory.
f. mount file server's EMC library directory to user's emc2 directory.
"mount 192.168.55.15:/common/EMC_Library /home/kwallace/emc2" (Should really update the fstab file)
2. Redirect GUI NML
In /home/user_name/emc2/configs/config_name/ , check for, copy or create a server.nml file. (my serverXX.nml here)
(I created a serverXX.nml file for each client IP address)
3. Activate the new .nml file
Edit .ini file for your configuration:
From: |
To: |
... [EMC] NML_FILE = emc.nml ... |
... [EMC] NML_FILE = serverXX.nml ... |
(Also check that DISPLAY is not set to axis, tkemc works. I created a serverXX.ini file for each client IP address. I am constantly confusing the .ini and .nml files, so a better naming system than serverXX might be useful.)
4. Connect EMC to the LAN
Add or uncomment "EMCSERVER = emcsvr" under [EMCSERVER] in the serverXX.ini file.
Client or GUI PC Setup:
1. Install EMC2
2. Connect to NFS file server
a. Open /System/Administration/Synaptic Package Manager. Select nfs-common and portmap for installation. Select Apply and approve the dependencies.
b. change /etc/passwd, /etc/group UID and GID numbers to match user's account settings on file server.
c. reset file permission for owner and group in user's home directory.
"chown -R XXX:XXX /home/user_name "
d. Reboot to apply the user account settings. There may be a better way to do this.
e. create /home/user_name/emc2 directory.
f. mount file server's EMC library directory to user's emc2 directory.
"mount 192.168.55.15:/common/EMC_Library /home/kwallace/emc2" (Should really update the fstab file)
3. Redirect GUI NML
In /home/user_name/emc2/configs/config_name/ , check for, copy or create a server.nml file. (my clientXX.nml here)
(I created a clientXX.nml file for each client IP address)
4. Activate the new .nml file
Edit .ini file for your configuration:
From: |
To: |
... [EMC] NML_FILE = emc.nml ... |
... [EMC] NML_FILE = clientXX.nml ... |
(Also check that DISPLAY is not set to axis, tkemc works. I created a clientXX.ini file for each client IP address. I am constantly confusing the .ini and .nml files, so a better naming system than serverXX might be useful.)
Connecting:
1. Start EMC on the control (server) PC and select the configuration that matches the client IP address.
1. Start EMC on the client PC and select the configuration that matches the client IP address.
Notes from Reference Documents:
(tcl/tkemc.tcl -ini emc.ini - may be useful for a headless server, cleaned and optimized for real time control.)
"When everthing is finally run xemc will send
messages via TCP to emcsvr which will then be placed in
shared memory buffers to be read by IO and TASK. TASK will
then forward messages as necessary to the MOTION kernel
module.
-- Will "
(emcsvr will listen for any connection request on the net?)
How I Set Up a Fedora EMC Client:
The server/client system above was based on both PC's being EMC/Ubuntu systems. It would be much more convenient to be able to have any PC on the network be a client.
I first copied tkemc.tcl from the server (/usr/share/emc/tcl/tkemc.tcl) to my home directory, /home/kwallace/emc_remote. From a terminal window, I invoked tkemc.tcl and corrected "missing file" errors until it ran. Here is a list of the files I copied to my home directory:
balloon.tcl emcdebug.tcl emc.tcl |
libemcini.so.0 libtk8.4.so.0 tkbackplot.tcl |
emchelp.tcl emctesting.tcl libnml.so.0 |
libXaw7.so.7 tkemc.tcl emcsh |
genedit.tcl libtcl8.4.so.0 |
I created the directories called for in the error messages and copied the corresponding files to these locations:
/usr/share/emc/tcl/emc.tcl
/usr/share/emc/tcl/bin/genedit.tcl
/usr/share/emc/tcl/bin/emctesting.tcl
/usr/share/emc/tcl/bin/emcdebug.tcl
/usr/share/emc/tcl/bin/tkbackplot.tcl
/usr/share/emc/tcl/scripts/balloon.tcl
/usr/share/emc/tcl/scripts/emchelp.tcl
Somewhere in the process, I needed to create a clientXX.ini and clientXX.nml per the instructions above. You can make these before you start.
tkemc seems to work properly but the colors are not the same as tkemc on the server, so I must be missing a configuration file or two.
Here is the configuration file link - TkEmc. I found TkEmc on the server here - /etc/X11/app-defaults, so created the direcrtory and copied the file over. Now the screen looks normal.