Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux compat #7

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
392d784
Update for Visual Studio 2013
ellisware Mar 4, 2016
a523a35
Introducing Basic Parameter, Diagnostic, and Macro Variable Read
ellisware Mar 8, 2016
73f80d9
Update for Program Name and Number
ellisware Mar 30, 2016
1a1ca1d
Add empty README.md
mmxe Sep 15, 2016
4917142
Add files from FANUC Focas CD. Linux docs on CD state "library for Li…
mmxe Sep 15, 2016
654ec50
Changed all printf's to gLogger-> so we use one messaging systems ins…
mmxe Sep 15, 2016
53ce317
Fix Linux compile warnings where %d should be %ld for long int
mmxe Sep 15, 2016
9e235cc
Add Linux compatibility changes from ellisware.com blog http://www.el…
mmxe Sep 15, 2016
95e791b
Fix incorrect format specifier compiler warnings (%d vs %ld)
mmxe Sep 15, 2016
ce8b2e5
Add CMakeList.txt files in top level, src folder, fanuc folder and mi…
mmxe Sep 15, 2016
06b0111
Remove .sdf .sln .vcproj .vcxproj files pulled from merging ellisware…
mmxe Sep 15, 2016
6cd54dd
Change capital "Fwlib32" to lowercase "fwlib32" so we don't need user…
mmxe Sep 15, 2016
d32bf3c
Update README.md
mmxe Sep 15, 2016
a74b12b
change Fwlib32 to "fwlib32" to match fwlib32.h file name change
mmxe Sep 21, 2016
0adfeb2
use more recent updates
mmxe Sep 21, 2016
f727d36
Add the documentation .pdf files from the FOCAS CD from Fanuc
mmxe Sep 21, 2016
e0826bc
Simplify and fix argument parsing for config file. Remove newline cha…
mmxe Sep 24, 2016
6d6ec01
Log to a file by default instead of stderr in *nix systems. Add *nix …
mmxe Sep 24, 2016
083285e
Merge branch 'linux-compat' of https://github.com/mmxe/adapter into l…
mmxe Sep 24, 2016
2b386ff
Name the adapter log file based on the name of the .ini file used to …
mmxe Nov 9, 2016
60b0f97
Minor clean-up for log file formats and message clarity
mmxe Nov 9, 2016
409e29c
Add flag for Linux to prevent occassional crashes due to SIGPIPE signals
mmxe Nov 9, 2016
9fc7618
Make log message more clear
mmxe Nov 9, 2016
764475d
Modify text in help message (-h flag)
mmxe Nov 21, 2016
2670c57
Add an ifdef check to enable different flags on send() for *nix envir…
mmxe Nov 21, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*~
Debug
Release
Release*
*.o
*.obj
*.suo
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required (VERSION 2.8.12)
project (adapter_fanuc)

add_subdirectory (./src)
add_subdirectory (./fanuc)
add_subdirectory (./minIni_07)


47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Introduction
These instructions are specific to the fanuc adapter on the linux compatible branch of my copy of the mtconnect/adapter repository

Installation

to install on a x64 system, add the libc6-dev-i386 library and multilib for g++.
apt-get install libc6-dev-i386
sudo apt-get install g++-multilib

To build:

git clone https://github.com/mmxe/adapter.git
git checkout linux-compat
cd adapter
cmake .
sudo make install

Install process doesn't copy config file. Copy it from adapter/fanuc/adapter.ini into /etc/mtconnect/adapter/ and edit to your liking.

Run adapter_fanuc /etc/mtconnect/adapter/adapter.ini

My install responds like this:
2016-09-15T17:11:13.347944Z - Info: Arguments: 1
2016-09-15T17:11:13.348857Z - Info: Ini File: adapter/fanuc/adapter.ini
2016-09-15T17:11:13.351756Z - Info: Showing hidden axis.
2016-09-15T17:11:13.352613Z - Info: Adding sample macro 'gauge1' at location 500
2016-09-15T17:11:13.354319Z - Info: Adding pmc 'Fovr' at location -12
2016-09-15T17:11:13.355044Z - Info: Adding pmc 'r100' at location 50500
2016-09-15T17:11:13.355729Z - Info: Adding parameter 'iochannel' at location 20
2016-09-15T17:11:13.355994Z - Info: Adding parameter 'cuttime' at location 6754
2016-09-15T17:11:13.356081Z - Info: Adding parameter 'powerontime' at location 6750
2016-09-15T17:11:13.356496Z - Info: Adding diagnostic 'XposError' at location 15202
2016-09-15T17:11:13.356558Z - Info: Adding diagnostic 'DCLink' at location 10752
2016-09-15T17:11:13.356643Z - Info: Adding alarm 'alarm1' at location 1
2016-09-15T17:11:13.356721Z - Info: Adding alarm 'alarm2' at location 2
2016-09-15T17:11:13.356923Z - Info: Adding alarm 'alarm3' at location 3
2016-09-15T17:11:13.356969Z - Info: Adding alarm 'alarm4' at location 4
2016-09-15T17:11:13.357281Z - Info: Adding critical 'critical1' at location 0
2016-09-15T17:11:13.357366Z - Info: Adding critical 'critical2' at location 0
2016-09-15T17:11:13.357670Z - Info: Adding critical 'critical3' at location 0
2016-09-15T17:11:13.357741Z - Info: Adding critical 'critical4' at location 0
2016-09-15T17:11:13.357820Z - Info: Server started, waiting on port 7878

Notice it's listening on Port 7878 for an agent to make a request. It doesn't contact an actual Fanuc controller until an agent makes a request.

Next steps:
Get it do daemonize properly, and to be able to run either multiple instances of the program on different ports (without colliding log files as will happen now) OR to fork multiple processes based on how many hosts and ports are defined in the config file.
10 changes: 10 additions & 0 deletions fanuc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
add_executable (adapter_fanuc fanuc_axis.cpp fanuc_path.cpp fanuc_adapter.cpp FanucAdapter.cpp)
target_include_directories (adapter_fanuc PUBLIC ../src ../minIni_07)

find_package(Threads REQUIRED)

set_target_properties(adapter_fanuc PROPERTIES COMPILE_FLAGS "-m32 -lfwlib32 -pthread" LINK_FLAGS "-m32 -lfwlib32")

target_link_libraries(adapter_fanuc fwlib32 adapter_generic minIni pthread)

install (TARGETS adapter_fanuc DESTINATION /usr/local/bin)
Binary file added fanuc/FOCAS2_Linux.pdf
Binary file not shown.
Binary file added fanuc/FOCAS2_LinuxJ.pdf
Binary file not shown.
53 changes: 49 additions & 4 deletions fanuc/adapter.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,57 @@
[adapter]

port = 7878
service = MTC Focus 1

service = MTConnect FOCAS Service



[focus]
host = 10.211.55.5

host = 192.168.82.16
#port is fixed at 8193

[macros]
#Name=500

#Name2=100 etc...
gauge1 = 500

[pmc]
SspeedOvr = 30
Fovr = 12
# PMC Types G=0, F=1, Y=2, X=3, A=4, R=5, T=6, K=7, C=8, D=9
# PMC Address G22 would by 00022, R99 would be 50099 etc.
# For Two's compliment values such as feedrate override specify a negative (-)
# SspeedOvr = 30
Fovr = -00012

r100 = 50500

[settings]
# If CNC Parameters 3115#0 and 3115#1 are set
# displayhidden = no means axis are ignored
# displayhidden = yes means axis are collected regardless
displayhidden = yes
# displayhidden = no

[parameters]
# ONLY Specify parameters of double type without individual axis
iochannel = 20
cuttime = 6754
powerontime = 6750

[diagnostics]
# Format aNNNN where a = the axis number (1-32) and NNNN = diagnostic number
XposError = 15202
DCLink = 10752

[alarms]
alarm1 = 1
alarm2 = 2
alarm3 = 3
alarm4 = 4

[critical]
critical1 = 1
critical2 = 2
critical3 = 3
critical4 = 4
38 changes: 0 additions & 38 deletions fanuc/fanuc.sln

This file was deleted.

Loading