For reference here is a list of social media links for ellisware.com:
The FANUC FOCAS shared library from the FANUC FOCAS CD A02B-0207-K737 version 4.1 or higher must first be installed and registered in Ubuntu 14.04 LTS.
$ sudo cp libfwlib32.so.1.0.0 /usr/local/lib/libfwlib32.so.1.0.0 $ sudo ldconfig $ sudo ln -s /usr/local/lib/libfwlib32.so.1.0.0 /usr/local/lib/libfwlib32.so
Next up we need to get the MTConnect adapter from GitHub.
$ cd ~ $ git clone https://github.com/mtconnect/adapter.git
We only actually need a limited subset of files from the adapter downloaded from GitHub. For convenience in building the binary we will copy all the needed files to the same directory. (Note, so wildcards can be used more than the needed files are copied.)
$ mkdir fanuc $ cp ~/adapter/fanuc/adapter.ini ~/fanuc/adapter.ini $ cp ~/adapter/fanuc/fanuc.xml ~/fanuc/fanuc.xml $ cp ~/adapter/fanuc/*.cpp ~/fanuc/ $ cp ~/adapter/fanuc/*.hpp ~/fanuc/ $ cp ~/adapter/src/*.cpp ~/fanuc/ $ cp ~/adapter/src/*.hpp ~/fanuc/ $ cp ~/adapter/minIni_07/*.c ~/fanuc/ $ cp ~/adapter/minIni_07/*.h ~/fanuc/
Once the files are in the ~/fanuc/ directory, we need to modify the source code. The GitHub adapter was meant for Windows, and their are several functions that need to be modified.
$ sudo nano ~/fanuc/fanuc_adapter.cpp Remove: #include <excpt.h> Change: __try and __exception to try/catch(...) Change: Sleep(5000) to sleep(5) Change: _strnicmp() to strncasecmp() Add Before : short ret = :: cnc_allclibhndl3... long level = 3; std::string filename = "focas.log"; const char * c = filename.c_str(); short log = ::cnc_startupprocess(level, c); Add After: cnc_freelibhndl.... cnc_exitprocess();
Finally the header file for Linux from the FOCAS cd is copied to the directory. Note the name change required as the source files refer to to Fwlib32.h.
$ sudo cp fwlib32.h ~/fanuc/Fwlib32.h
With the source code modified, its time to compile the binary. Sorry for the sloppy g++ command, this could be cleaned up with a nice CMakeLists.txt.
$ cd ~/fanuc/ $ g++ minIni.c device_datum.cpp fanuc_axis.cpp fanuc_path.cpp service.cpp condition.cpp cutting_tool.cpp string_buffer.cpp logger.cpp client.cpp server.cpp adapter.cpp fanuc_adapter.cpp FanucAdapter.cpp -lfwlib32 -lpthread -o adapter
Finally setup the adapter.ini file with the appropriate settings for your machine and run the binary.
$ ./adapter debug adapter.ini
Conclusion I’m certain one day the source code for the Linux FANUC adapter will be available from GitHub as the code is just a slight adaptation from the Windows version. Until then, I hope you enjoyed this tutorial!
In this tutorial we install the MTConnect FANUC Adapter in Windows and connect to a FANUC FS0iD control. The source code is downloaded and compiled before some settings are made to establish a connection to the machine.
1. Download the MTConnect Adapter source code from: https://github.com/mtconnect/adapter
2. Extract the source code to your PC
3. Copy the appropriate Fwlib32.h file from FANUC FOCAS cd into the /adapter/fanuc/ directory for the control we are connecting to.
4. Copy all of the .dll and library files from the FANUC FOCAS cd into the /adapter/fanuc/ directory on your PC.
4.5 Copy the Fwlib32.dll file from the FOCAS cd to C:\Windows\System32\
5. Open the /fanuc/fanuc.sln solution file in Microsoft Visual C++ 2010.
6. Right click on the project and open the properties dialog from the context menu.
7. Select Linker->Input from the left menu.
8. Change the Configuration drop down box to Release 0iD
9. Remove the /fwlib/ from the additional dependencies so they properly point to the libraries.
10. Close the properties dialog.
11. Change the build drop down to Release 0iD
12. Press F7 to build the solution.
13. Copy /adapter/fanuc/adapter.cfg to /adapter/fanuc/Release0iD/adapter.cfg
14. Open the adapter.cfg file with a text editor and change the IP Address to match the machine we are connecting to.
15. From the command prompt, run the compiled binary with the option debug.
16. Test by having your agent connect to this adapter! Once the adapter is tested it can be installed into windows by running: