Search Results (Searched for: )
- langdons
- langdons
10 Nov 2024 19:37
Replied by langdons on topic New basic setup recommendations
New basic setup recommendations
Category: General LinuxCNC Questions
If you get a new computer working with a parallel port, the old HAL config should be fine.
However, you will probably need to update the port address.
You can find the port address with lspci -v
Ethernet adapters almost certainly add a little latency.
Did you try a different monitor?
Does the old computer make a startup beep?
However, you will probably need to update the port address.
You can find the port address with lspci -v
Ethernet adapters almost certainly add a little latency.
Did you try a different monitor?
Does the old computer make a startup beep?
- Routerworks
- Routerworks
10 Nov 2024 19:09
New basic setup recommendations was created by Routerworks
New basic setup recommendations
Category: General LinuxCNC Questions
I have been using linuxcnc for a few years now with a much older Dell dimension e521 computer with an installed parallel port card. Worked great, very satisfied. Recently it decided not to boot, no power to keyboard or mouse. Changed cmos battery but still won't get past "Dell" logo. No response to keyboard. Think it's time to replace whole system.
Looking for a used computer perferably with a parallel port or at least a slot for one. Possibly should converto to ethernet card such as "Mesa 7I96" or something close.
Fortunately I copied by filling setup folder with working ini and hal files.
My question are as follows:
1.) Should I upgrade to a newer version of linuxcnc (using 2.8...)?
2.) I have a new all in one desktop with an ethernot port. Can't add parallel port. Do ethernet to parallel port adapters work without timing issues?
3.) What is a stable version to upgrade to (all in one install) or should I stay with my older version? Is there much gain as it seemed to be working fine.
4.) Can I use the same ini and hal files with a newer version or do I have to do a whole new setup. Trying to avoid that as dual Y steppers was a hastle and now I want to add a 4th A axis.
Any comments would be greatly appreciated from those much more experienced at this than myself.
Regards,
Routerworks
Looking for a used computer perferably with a parallel port or at least a slot for one. Possibly should converto to ethernet card such as "Mesa 7I96" or something close.
Fortunately I copied by filling setup folder with working ini and hal files.
My question are as follows:
1.) Should I upgrade to a newer version of linuxcnc (using 2.8...)?
2.) I have a new all in one desktop with an ethernot port. Can't add parallel port. Do ethernet to parallel port adapters work without timing issues?
3.) What is a stable version to upgrade to (all in one install) or should I stay with my older version? Is there much gain as it seemed to be working fine.
4.) Can I use the same ini and hal files with a newer version or do I have to do a whole new setup. Trying to avoid that as dual Y steppers was a hastle and now I want to add a 4th A axis.
Any comments would be greatly appreciated from those much more experienced at this than myself.
Regards,
Routerworks
- denhen89
10 Nov 2024 18:45
After switching from wheezy to Debian 12 only X axis runs smooth (sometimes) was created by denhen89
After switching from wheezy to Debian 12 only X axis runs smooth (sometimes)
Category: General LinuxCNC Questions
Hello,
since yesterday morning i am trying to get my machine to work. All started when i wanted to do a job for someone and could not access the rclone onedrive or actually i could, but the files could not be opened. (input/output error) Also, the PC was very slow, but i thought i will just send the files through mail so that i get the job done first and then take care of the slow pc, but even loading gmail took years. I somehow got the job done and then i decided that it might be smart to upgrade from wheezy with Linuxcnc 2.8.4 to some newer version (2.9.2 / 2.9.3).
The problem: After upgrading to Debian and using the same config, the motors does not work, they do some ultra small laggy moves, but the X-Axis is somehow moving perfectly fine after the homing sequence is done. Y (slave axis) and Z axis are making some strange noises every couple seconds, sometimes a bit quicker depending on some changes like changes of base period or so. I have tried so many things since the upgrade to Debian, that i actually cannot tell you exactly everything i did, but i will write down everything i remember:
1. I didnt want to format the pc that was attached to the cnc router, so i took a pc that was working perfectly fine some time ago on that same machine, with latencys below 8000
2. I installed Debian, did some isolcpus settings that showed me good latencys in the latency test. I was thinking everything works fine so i also do the Onedrive setup and then i thought i will attach the pcs to the machine, setup the correct parport addresses for both parallel cards and continue to work, but this was not the case, because then the problem started with the strange movements of the stepper motors, but after homing X-Axis worked perfectly
3. After trying PREEMPT and RT kernel i still had the same problem
4. I took the SSD out and attached it to the original PC that was attached earlier, that was so slow and where i had the onedrive Output/input error. I dont know if that can be done without any problem, but the pc started up perfectly and i just changed the isolcpus setting, because its a different cpu with 4 instead of 6 cores. Also i did the isolcpus, because without the latency went up pretty quickly - after isolcpus it looked good.
Unfortunately same problem, strange axis movement, sometimes i got a latency error message when starting linuxcnc.
5. decided to format the pc, but this time i used the Linuxcnc 2.9.2 installed iso. Same problem
- please keep in mind, 2 different pcs, with the exact same problems, but both pcs were working fine on that machine and on a other machine
6. I though this might be a problem with the LPT cards (not sure why, but if you are totally lost you just try everything you can), so i tried to use only one, or changed the slots and also i have tried to use the other LPT cable that is only used when i use the different config for the Rotary Axis (the second LPT card is there just for the Rotary axis configs (seperate A and C axis). Same problem, nothing changed
7. the last thing i tried was to use a older Linuxcnc installed ISO, the 2.8.4 (as i remember correctly, but at least it was 2.8.x) - same problem
So, i am that much lost and thinking how it is possible that 2 PCS that were working perfectly fine with the same machine (and also for a different machine), with thesame configs, do not anymore work. Also, switching LPT cards and cables do no changes.
The last thing that comes in my mind that i could try is to install wheezy again, but i cant imagine this will change the problem. The machine is a pretty simple CNC router with slave axis, no mpg, no special buttons or so, so i really dont care if its 2.8 version or 2.9. It was running PERFECTLY FINE with 2.8.4 on wheezy. I just wanted to fix onedrive and the slow pc problem.
I can imagine that it will be difficult to help me out, but maybe someone had some similar problem and might have some ideas what i could try
Here a video ( www.youtube.com/shorts/kfr2WJ-MDAc ) where you can see:
X axis moving perfectly fine,
then the Y axis and then Z axis. (totally laggy)
Thanks in advance
Br,
Denis
since yesterday morning i am trying to get my machine to work. All started when i wanted to do a job for someone and could not access the rclone onedrive or actually i could, but the files could not be opened. (input/output error) Also, the PC was very slow, but i thought i will just send the files through mail so that i get the job done first and then take care of the slow pc, but even loading gmail took years. I somehow got the job done and then i decided that it might be smart to upgrade from wheezy with Linuxcnc 2.8.4 to some newer version (2.9.2 / 2.9.3).
The problem: After upgrading to Debian and using the same config, the motors does not work, they do some ultra small laggy moves, but the X-Axis is somehow moving perfectly fine after the homing sequence is done. Y (slave axis) and Z axis are making some strange noises every couple seconds, sometimes a bit quicker depending on some changes like changes of base period or so. I have tried so many things since the upgrade to Debian, that i actually cannot tell you exactly everything i did, but i will write down everything i remember:
1. I didnt want to format the pc that was attached to the cnc router, so i took a pc that was working perfectly fine some time ago on that same machine, with latencys below 8000
2. I installed Debian, did some isolcpus settings that showed me good latencys in the latency test. I was thinking everything works fine so i also do the Onedrive setup and then i thought i will attach the pcs to the machine, setup the correct parport addresses for both parallel cards and continue to work, but this was not the case, because then the problem started with the strange movements of the stepper motors, but after homing X-Axis worked perfectly
3. After trying PREEMPT and RT kernel i still had the same problem
4. I took the SSD out and attached it to the original PC that was attached earlier, that was so slow and where i had the onedrive Output/input error. I dont know if that can be done without any problem, but the pc started up perfectly and i just changed the isolcpus setting, because its a different cpu with 4 instead of 6 cores. Also i did the isolcpus, because without the latency went up pretty quickly - after isolcpus it looked good.
Unfortunately same problem, strange axis movement, sometimes i got a latency error message when starting linuxcnc.
5. decided to format the pc, but this time i used the Linuxcnc 2.9.2 installed iso. Same problem
- please keep in mind, 2 different pcs, with the exact same problems, but both pcs were working fine on that machine and on a other machine
6. I though this might be a problem with the LPT cards (not sure why, but if you are totally lost you just try everything you can), so i tried to use only one, or changed the slots and also i have tried to use the other LPT cable that is only used when i use the different config for the Rotary Axis (the second LPT card is there just for the Rotary axis configs (seperate A and C axis). Same problem, nothing changed
7. the last thing i tried was to use a older Linuxcnc installed ISO, the 2.8.4 (as i remember correctly, but at least it was 2.8.x) - same problem
So, i am that much lost and thinking how it is possible that 2 PCS that were working perfectly fine with the same machine (and also for a different machine), with thesame configs, do not anymore work. Also, switching LPT cards and cables do no changes.
The last thing that comes in my mind that i could try is to install wheezy again, but i cant imagine this will change the problem. The machine is a pretty simple CNC router with slave axis, no mpg, no special buttons or so, so i really dont care if its 2.8 version or 2.9. It was running PERFECTLY FINE with 2.8.4 on wheezy. I just wanted to fix onedrive and the slow pc problem.
I can imagine that it will be difficult to help me out, but maybe someone had some similar problem and might have some ideas what i could try
Here a video ( www.youtube.com/shorts/kfr2WJ-MDAc ) where you can see:
X axis moving perfectly fine,
then the Y axis and then Z axis. (totally laggy)
Thanks in advance
Br,
Denis
- rammfr
- rammfr
10 Nov 2024 18:40 - 10 Nov 2024 18:45
Replied by rammfr on topic Ethercat, EL6751 and CANOpen
Ethercat, EL6751 and CANOpen
Category: EtherCAT
Wow, this would be great!Here are 2 projects:
In the end I do want a ethercat config for 4 servostar axis, ids 11,12,13,14
BR Franz
- profibus_latest was working without any SDOs, see ethercat-config from my previous posted project. But here I do have the described timing issues.
- profibus_mit_startup is the thing I tried today. I do not get a working sdo config... I simply exported 'startup' of the el6731 in Twincat as csv, then I added the sdos to the ethercat config.
In the end I do want a ethercat config for 4 servostar axis, ids 11,12,13,14
BR Franz
- Lcvette
10 Nov 2024 18:30
github.com/LinuxCNC/linuxcnc/issues/3174
Replied by Lcvette on topic probe basic - toolpath/file preview loading error
probe basic - toolpath/file preview loading error
Category: QtPyVCP
it appears to be a linuxcnc error, i can replicate in axis and it throws an interp error, happened somewhere between 2.9.3-83-g1d5d02d836 and 2.9.3-2099-g9f5a1c8f50Adding my two cents here...
I get a similar error message when trying to load a g-code file in PB. No issues with the backplot but the attached error message pops up when I load the file.
I think I narrowed it down to the tool number being >199.
When I commented out the T407, T823, and T642 it loaded with no complaints. And when I edited the file it would load fine at T199 (other two commented out) but puked when changed to T200.
I can load the tools in/out of my ATC using the PB interface, and call them up via MDI with no errors.
I can work around this for a short time by renumbering tools, but this is going to be annoying since I imported my F360 library to LCNC and I've got tools up to the 1100-range in the table.
github.com/LinuxCNC/linuxcnc/issues/3174
- nick_namsep
- nick_namsep
10 Nov 2024 18:16
Replied by nick_namsep on topic General Questions about using ethercat
General Questions about using ethercat
Category: EtherCAT
Thanks for the response, and indeed i am new to Linuxcnc and Ethercat. In the past i have made my own controllers etc but i want to use a bit better of a system that is why i want to switch to servo instead of stepper etc. But what i am trying to figure out is if i need a motion controller? and if so what is it used for etc etc i kinda wanna learn the ropes from using ethercat as well as linuxcnc but before buying some really expensive servo's etc just thought about putting the question out here. But thanks for the replies i will look into the video's!
- okielaxplyr
- okielaxplyr
10 Nov 2024 17:58
Replied by okielaxplyr on topic PNCconfig error
PNCconfig error
Category: General LinuxCNC Questions
it is working as it should now. Not sure why. If it errors again I will post the file.
- jurod
10 Nov 2024 17:46 - 11 Nov 2024 16:50
Replied by jurod on topic Remap 3D Cubic Spline Interpolation code by Python
Remap 3D Cubic Spline Interpolation code by Python
Category: O Codes (subroutines) and NGCGUI
Very well. Thanks.
I also made adjustments for the XYZA and XYZBC axes.
Axes XYZA:
Axes XYZBC:
I also made adjustments for the XYZA and XYZBC axes.
Axes XYZA:
#! /usr/bin/python3
"""
3-D spline interpolation
(with graph drawing by matplotlib)
"""
import matplotlib.pyplot as plt
import sys
import os
import traceback
class SplineInterpolation:
def __init__(self, ts, ds):
""" Initialization
:param list ts: item number list of given points
:param list ds: coordinate list of given points
"""
self.ts, self.ds = ts, ds
self.n = len(self.ts) - 1
h = self.__calc_h()
w = self.__calc_w(h)
matrix = self.__gen_matrix(h, w)
v = [0] + self.__gauss_jordan(matrix) + [0]
self.b = self.__calc_b(v)
self.a = self.__calc_a(v)
self.d = self.__calc_d()
self.c = self.__calc_c(v)
def interpolate(self, t):
""" Interpolation
:param float t: value for a interpolate target
:return float : computated y-value
"""
try:
i = self.__search_i(t)
return self.a[i] * (t - self.ts[i]) ** 3 \
+ self.b[i] * (t - self.ts[i]) ** 2 \
+ self.c[i] * (t - self.ts[i]) \
+ self.d[i]
except Exception as e:
raise
def __calc_h(self):
""" H calculation
:return list: h-values
"""
try:
return [self.ts[i + 1] - self.ts[i] for i in range(self.n)]
except Exception as e:
raise
def __calc_w(self, h):
""" W calculation
:param list h: h-values
:return list : w-values
"""
try:
return [
6 * ((self.ds[i + 1] - self.ds[i]) / h[i]
- (self.ds[i] - self.ds[i - 1]) / h[i - 1])
for i in range(1, self.n)
]
except Exception as e:
raise
def __gen_matrix(self, h, w):
""" Matrix generation
:param list h: h-values
:param list w: w-values
:return list mtx: generated 2-D matrix
"""
mtx = [[0 for _ in range(self.n)] for _ in range(self.n - 1)]
try:
for i in range(self.n - 1):
mtx[i][i] = 2 * (h[i] + h[i + 1])
mtx[i][-1] = w[i]
if i == 0:
continue
mtx[i - 1][i] = h[i]
mtx[i][i - 1] = h[i]
return mtx
except Exception as e:
raise
def __gauss_jordan(self, matrix):
""" Solving of simultaneous linear equations
with Gauss-Jordan's method
:param list mtx: list of 2-D matrix
:return list v: answers list of simultaneous linear equations
"""
v = []
n = self.n - 1
try:
for k in range(n):
p = matrix[k][k]
for j in range(k, n + 1):
matrix[k][j] /= p
for i in range(n):
if i == k:
continue
d = matrix[i][k]
for j in range(k, n + 1):
matrix[i][j] -= d * matrix[k][j]
for row in matrix:
v.append(row[-1])
return v
except Exception as e:
raise
def __calc_a(self, v):
""" A calculation
:param list v: v-values
:return list : a-values
"""
try:
return [
(v[i + 1] - v[i])
/ (6 * (self.ts[i + 1] - self.ts[i]))
for i in range(self.n)
]
except Exception as e:
raise
def __calc_b(self, v):
""" B calculation
:param list v: v-values
:return list : b-values
"""
try:
return [v[i] / 2.0 for i in range(self.n)]
except Exception as e:
raise
def __calc_c(self, v):
""" C calculation
:param list v: v-values
:return list : c-values
"""
try:
return [
(self.ds[i + 1] - self.ds[i]) / (self.ts[i + 1] - self.ts[i]) \
- (self.ts[i + 1] - self.ts[i]) * (2 * v[i] + v[i + 1]) / 6
for i in range(self.n)
]
except Exception as e:
raise
def __calc_d(self):
""" D calculation
:return list: c-values
"""
try:
return self.ds
except Exception as e:
raise
def __search_i(self, t):
""" Index searching
:param float t: t-value
:return int i: index
"""
i, j = 0, len(self.ts) - 1
try:
while i < j:
k = (i + j) // 2
if self.ts[k] < t:
i = k + 1
else:
j = k
if i > 0:
i -= 1
return i
except Exception as e:
raise
class Graph:
def __init__(self, xs_0, ys_0, zs_0, xs_1, ys_1, zs_1):
self.xs_0, self.ys_0, self.zs_0, self.xs_1, self.ys_1, self.zs_1 = xs_0, ys_0, zs_0, xs_1, ys_1, zs_1
def plot2d(self):
try:
plt.title("2-D Spline Interpolation in XY/XZ")
plt.scatter(
self.xs_1, self.ys_1, c = "g",
label = "interpolated points XY", marker = "+"
)
plt.scatter(
self.xs_0, self.ys_0, c = "r",
label = "given points XY"
)
plt.scatter(
self.xs_1, self.zs_1, c = "b",
label = "interpolated points XZ", marker = "+"
)
plt.scatter(
self.xs_0, self.zs_0, c = "k",
label = "given points XZ"
)
plt.xlabel("x")
plt.ylabel("y,z")
plt.legend(loc = 2)
plt.grid(color = "gray", linestyle = "--")
#plt.show()
#plt.savefig("spline_interpolation.png")
except Exception as e:
raise
def plot3d(self):
ax = plt.figure().add_subplot(projection='3d')
x = self.xs_1
y = self.ys_1
z = self.zs_1
ax.scatter(x, y, z, c='b', label='Interpolated points')
ax.scatter(X, Y, Z, c='r', label='Given points')
# Make legend, set axes limits and labels
ax.legend()
ax.set_xlim(min(X),max(X))
ax.set_ylim(min(Y),max(Y))
ax.set_zlim(min(Z),max(Z))
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
# Customize the view angle so it's easier to see that the scatter points lie
# on the plane y=0
ax.view_init(elev=20., azim=-35)
plt.show()
if __name__ == '__main__':
# (N + 1) points
T,X,Y,Z,A = [],[],[],[],[]
fileName = './points_input.txt'
import csv
with open(fileName, 'r') as f:
reader = csv.reader(f)
point_data = list(reader)
for line in point_data:
X.append(float(line[0]))
Y.append(float(line[1]))
Z.append(float(line[2]))
A.append(float(line[3]))
print('X:', X)
print('Y:', Y)
print('Z:', Z)
print('A:', A)
n=0
for x in X:
T.append(n+1.0)
n += 1
print('T: ', T)
#T = [1.0,2.0,3.0,4.0,5.0,6.0]
#X = [0.0, 2.0, 3.0, 5.0, 7.0, 8.0]
#Y = [0.8, 2.8, 3.2, 1.9, 4.5, 2.5]
#Z = [-0.5, 1.8, 2.2, 0.9, 3.5, -1.5]
S = 0.1 # Step for interpolation
S_1 = 1 / S # Inverse of S
xs_g, ys_g, zs_g, as_g = [], [], [], [] # List for graph
try:
# 3-D spline interpolation
si = SplineInterpolation(T, X)
for t in [t / S_1 for t in range(int(T[0] / S), int(T[-1] / S) + 1)]:
x= si.interpolate(t)
#print("{:8.4f}, {:8.4f}".format(t, x))
xs_g.append(x)
si = SplineInterpolation(T, Y)
for t in [t / S_1 for t in range(int(T[0] / S), int(T[-1] / S) + 1)]:
y = si.interpolate(t)
#print("{:8.4f}, {:8.4f}".format(t, y))
ys_g.append(y)
si = SplineInterpolation(T, Z)
for t in [t / S_1 for t in range(int(T[0] / S), int(T[-1] / S) + 1)]:
z = si.interpolate(t)
#print("{:8.4f}, {:8.4f}".format(t, z))
zs_g.append(z)
si = SplineInterpolation(T, A)
for t in [t / S_1 for t in range(int(T[0] / S), int(T[-1] / S) + 1)]:
a = si.interpolate(t)
#print("{:8.4f}, {:8.4f}".format(t, z))
as_g.append(a)
# Write output to file
file_out = 'output_file.txt'
print('Writing output to ',file_out)
n=0
output = open(file_out, 'w')
for x in xs_g:
string=("G1 X{:4.2f} Y{:4.2f} Z{:4.2f} A{:4.2f}\n".format(xs_g[n], ys_g[n], zs_g[n], as_g[n]))
output.write(string)
n += 1
# Closing file
output.close()
# Graph drawing
g = Graph(X, Y, Z, xs_g, ys_g, zs_g)
g.plot2d()
g.plot3d()
except Exception as e:
traceback.print_exc()
sys.exit(1)
Axes XYZBC:
#! /usr/bin/python3
"""
3-D spline interpolation
(with graph drawing by matplotlib)
"""
import matplotlib.pyplot as plt
import sys
import os
import traceback
class SplineInterpolation:
def __init__(self, ts, ds):
""" Initialization
:param list ts: item number list of given points
:param list ds: coordinate list of given points
"""
self.ts, self.ds = ts, ds
self.n = len(self.ts) - 1
h = self.__calc_h()
w = self.__calc_w(h)
matrix = self.__gen_matrix(h, w)
v = [0] + self.__gauss_jordan(matrix) + [0]
self.b = self.__calc_b(v)
self.a = self.__calc_a(v)
self.d = self.__calc_d()
self.c = self.__calc_c(v)
def interpolate(self, t):
""" Interpolation
:param float t: value for a interpolate target
:return float : computated y-value
"""
try:
i = self.__search_i(t)
return self.a[i] * (t - self.ts[i]) ** 3 \
+ self.b[i] * (t - self.ts[i]) ** 2 \
+ self.c[i] * (t - self.ts[i]) \
+ self.d[i]
except Exception as e:
raise
def __calc_h(self):
""" H calculation
:return list: h-values
"""
try:
return [self.ts[i + 1] - self.ts[i] for i in range(self.n)]
except Exception as e:
raise
def __calc_w(self, h):
""" W calculation
:param list h: h-values
:return list : w-values
"""
try:
return [
6 * ((self.ds[i + 1] - self.ds[i]) / h[i]
- (self.ds[i] - self.ds[i - 1]) / h[i - 1])
for i in range(1, self.n)
]
except Exception as e:
raise
def __gen_matrix(self, h, w):
""" Matrix generation
:param list h: h-values
:param list w: w-values
:return list mtx: generated 2-D matrix
"""
mtx = [[0 for _ in range(self.n)] for _ in range(self.n - 1)]
try:
for i in range(self.n - 1):
mtx[i][i] = 2 * (h[i] + h[i + 1])
mtx[i][-1] = w[i]
if i == 0:
continue
mtx[i - 1][i] = h[i]
mtx[i][i - 1] = h[i]
return mtx
except Exception as e:
raise
def __gauss_jordan(self, matrix):
""" Solving of simultaneous linear equations
with Gauss-Jordan's method
:param list mtx: list of 2-D matrix
:return list v: answers list of simultaneous linear equations
"""
v = []
n = self.n - 1
try:
for k in range(n):
p = matrix[k][k]
for j in range(k, n + 1):
matrix[k][j] /= p
for i in range(n):
if i == k:
continue
d = matrix[i][k]
for j in range(k, n + 1):
matrix[i][j] -= d * matrix[k][j]
for row in matrix:
v.append(row[-1])
return v
except Exception as e:
raise
def __calc_a(self, v):
""" A calculation
:param list v: v-values
:return list : a-values
"""
try:
return [
(v[i + 1] - v[i])
/ (6 * (self.ts[i + 1] - self.ts[i]))
for i in range(self.n)
]
except Exception as e:
raise
def __calc_b(self, v):
""" B calculation
:param list v: v-values
:return list : b-values
"""
try:
return [v[i] / 2.0 for i in range(self.n)]
except Exception as e:
raise
def __calc_c(self, v):
""" C calculation
:param list v: v-values
:return list : c-values
"""
try:
return [
(self.ds[i + 1] - self.ds[i]) / (self.ts[i + 1] - self.ts[i]) \
- (self.ts[i + 1] - self.ts[i]) * (2 * v[i] + v[i + 1]) / 6
for i in range(self.n)
]
except Exception as e:
raise
def __calc_d(self):
""" D calculation
:return list: c-values
"""
try:
return self.ds
except Exception as e:
raise
def __search_i(self, t):
""" Index searching
:param float t: t-value
:return int i: index
"""
i, j = 0, len(self.ts) - 1
try:
while i < j:
k = (i + j) // 2
if self.ts[k] < t:
i = k + 1
else:
j = k
if i > 0:
i -= 1
return i
except Exception as e:
raise
class Graph:
def __init__(self, xs_0, ys_0, zs_0, xs_1, ys_1, zs_1):
self.xs_0, self.ys_0, self.zs_0, self.xs_1, self.ys_1, self.zs_1 = xs_0, ys_0, zs_0, xs_1, ys_1, zs_1
def plot2d(self):
try:
plt.title("2-D Spline Interpolation in XY/XZ")
plt.scatter(
self.xs_1, self.ys_1, c = "g",
label = "interpolated points XY", marker = "+"
)
plt.scatter(
self.xs_0, self.ys_0, c = "r",
label = "given points XY"
)
plt.scatter(
self.xs_1, self.zs_1, c = "b",
label = "interpolated points XZ", marker = "+"
)
plt.scatter(
self.xs_0, self.zs_0, c = "k",
label = "given points XZ"
)
plt.xlabel("x")
plt.ylabel("y,z")
plt.legend(loc = 2)
plt.grid(color = "gray", linestyle = "--")
#plt.show()
#plt.savefig("spline_interpolation.png")
except Exception as e:
raise
def plot3d(self):
ax = plt.figure().add_subplot(projection='3d')
x = self.xs_1
y = self.ys_1
z = self.zs_1
ax.scatter(x, y, z, c='b', label='Interpolated points')
ax.scatter(X, Y, Z, c='r', label='Given points')
# Make legend, set axes limits and labels
ax.legend()
ax.set_xlim(min(X),max(X))
ax.set_ylim(min(Y),max(Y))
ax.set_zlim(min(Z),max(Z))
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
# Customize the view angle so it's easier to see that the scatter points lie
# on the plane y=0
ax.view_init(elev=20., azim=-35)
plt.show()
if __name__ == '__main__':
# (N + 1) points
T,X,Y,Z,B,C = [],[],[],[],[],[]
fileName = './points_input.txt'
import csv
with open(fileName, 'r') as f:
reader = csv.reader(f)
point_data = list(reader)
for line in point_data:
X.append(float(line[0]))
Y.append(float(line[1]))
Z.append(float(line[2]))
B.append(float(line[3]))
C.append(float(line[4]))
print('X:', X)
print('Y:', Y)
print('Z:', Z)
print('B:', B)
print('C:', C)
n=0
for x in X:
T.append(n+1.0)
n += 1
print('T: ', T)
#T = [1.0,2.0,3.0,4.0,5.0,6.0]
#X = [0.0, 2.0, 3.0, 5.0, 7.0, 8.0]
#Y = [0.8, 2.8, 3.2, 1.9, 4.5, 2.5]
#Z = [-0.5, 1.8, 2.2, 0.9, 3.5, -1.5]
S = 0.1 # Step for interpolation
S_1 = 1 / S # Inverse of S
xs_g, ys_g, zs_g, bs_g, cs_g = [], [], [], [], [] # List for graph
try:
# 3-D spline interpolation
si = SplineInterpolation(T, X)
for t in [t / S_1 for t in range(int(T[0] / S), int(T[-1] / S) + 1)]:
x= si.interpolate(t)
#print("{:8.4f}, {:8.4f}".format(t, x))
xs_g.append(x)
si = SplineInterpolation(T, Y)
for t in [t / S_1 for t in range(int(T[0] / S), int(T[-1] / S) + 1)]:
y = si.interpolate(t)
#print("{:8.4f}, {:8.4f}".format(t, y))
ys_g.append(y)
si = SplineInterpolation(T, Z)
for t in [t / S_1 for t in range(int(T[0] / S), int(T[-1] / S) + 1)]:
z = si.interpolate(t)
#print("{:8.4f}, {:8.4f}".format(t, z))
zs_g.append(z)
si = SplineInterpolation(T, B)
for t in [t / S_1 for t in range(int(T[0] / S), int(T[-1] / S) + 1)]:
b = si.interpolate(t)
#print("{:8.4f}, {:8.4f}".format(t, b))
bs_g.append(b)
si = SplineInterpolation(T, C)
for t in [t / S_1 for t in range(int(T[0] / S), int(T[-1] / S) + 1)]:
c = si.interpolate(t)
#print("{:8.4f}, {:8.4f}".format(t, c))
cs_g.append(c)
# Write output to file
file_out = 'output_file.txt'
print('Writing output to ',file_out)
n=0
output = open(file_out, 'w')
for x in xs_g:
string=("G1 X{:4.2f} Y{:4.2f} Z{:4.2f} B{:4.2f} C{:4.2f}\n".format(xs_g[n], ys_g[n], zs_g[n], bs_g[n], cs_g[n]))
output.write(string)
n += 1
# Closing file
output.close()
# Graph drawing
g = Graph(X, Y, Z, xs_g, ys_g, zs_g)
g.plot2d()
g.plot3d()
except Exception as e:
traceback.print_exc()
sys.exit(1)
- langdons
- langdons
10 Nov 2024 16:27
Replied by langdons on topic How to configure pause/resume over pin 10 of parallel port?
How to configure pause/resume over pin 10 of parallel port?
Category: HAL
The PMDX board is configured (with jumpers) to ignore the input value of pin 17.
The data buffer is set to out (from PC to motor drivers) and is always enabled, regardless of E-Stop signal form the E-Stop button.
The data buffer is set to out (from PC to motor drivers) and is always enabled, regardless of E-Stop signal form the E-Stop button.
- langdons
- langdons
10 Nov 2024 16:20
How to configure pause/resume over pin 10 of parallel port? was created by langdons
How to configure pause/resume over pin 10 of parallel port?
Category: HAL
I have a CNC machine that uses a PMDX-122 breakout board.
It is connected to my PC via a parallel port PCIe card and a parallel port cable.
The PC runs LinuxCNC on Debian.
LinuxCNC can communicate with the breakout board without problem.
How can I configure my HAL config file so LinuxCNC pauses whatever it is doing when the PC recieves a signal on pin 10 on the parallel port and resumes whatever it was doing when the PC stops recieving a signal on pin 10 after a slight delay (to allow the router bit to accelerate)?
I would also like to configure the home switches.
Pins 11, 12, 13, and 15 are available for miscellaneous communication to the PC.
It is connected to my PC via a parallel port PCIe card and a parallel port cable.
The PC runs LinuxCNC on Debian.
LinuxCNC can communicate with the breakout board without problem.
How can I configure my HAL config file so LinuxCNC pauses whatever it is doing when the PC recieves a signal on pin 10 on the parallel port and resumes whatever it was doing when the PC stops recieving a signal on pin 10 after a slight delay (to allow the router bit to accelerate)?
I would also like to configure the home switches.
Pins 11, 12, 13, and 15 are available for miscellaneous communication to the PC.
- PCW
10 Nov 2024 15:16
Replied by PCW on topic hm2/hm2_7i92.0: Error finishing read!
hm2/hm2_7i92.0: Error finishing read!
Category: Driver Boards
31 s32 RW 235371 servo-thread.tmax
So the maximum servo thread time is ~ 1/4 of the servo period so looks fine.
So the maximum servo thread time is ~ 1/4 of the servo period so looks fine.
- PCW
10 Nov 2024 14:39
Replied by PCW on topic Raspberry Pi4B and Mesa7C80 setup for a beginner
Raspberry Pi4B and Mesa7C80 setup for a beginner
Category: Driver Boards
You can actually ignore all the inmux setup in the manual
and not have any inmux related statements in the configuration
string.
One of the best ways to determine the pin/parameter names is with halcmd or halshow
for example, this command in a terminal when LinuxCNC is running:
halcmd show pin hm2
Will show all hardware pins, while:
halcmd show pin *inmux*
will show all inmux pins
You can also do this with halshow, You can launch halshow from axis
with Machine --> Show Hal Configuration. The "Watch" tab of halshow
allows you to monitor pins in real time.
and not have any inmux related statements in the configuration
string.
One of the best ways to determine the pin/parameter names is with halcmd or halshow
for example, this command in a terminal when LinuxCNC is running:
halcmd show pin hm2
Will show all hardware pins, while:
halcmd show pin *inmux*
will show all inmux pins
You can also do this with halshow, You can launch halshow from axis
with Machine --> Show Hal Configuration. The "Watch" tab of halshow
allows you to monitor pins in real time.
- GDTH
10 Nov 2024 14:30
Replied by GDTH on topic General Questions about using ethercat
General Questions about using ethercat
Category: EtherCAT
From what i am able to gather from your question is that you dont understand how to retrofit or use linuxcnc yet. It is deffinitly something you have to put time into.
Simply said, ethercat is just a communcation protcol for your motion controller to talk to your motors. With ethercat you just use ethernet cable which simplify the hardware side. Ethercat is not new but there are deffinitly more people doing it with mesa cards (so more examples to follow).
The ethernet cable just goes into your pc or RPI. I tend to get a seccond hand pc, with a pci slot left over and put a ethernet card which will be the dedicated ethercat connection.
here and example:
For IO stuff we tend to use the beckhoff system. EK1100 with some EL1818 and EL2818 modules
As for what brand. Yes, there is a difference between brands. Leadshine is realy good, however it also comes with a pricetag. I got Lichuan servo motors for half the price. There are also Stepper motors with an integraded driver, i think omc also sell them.
i would recommend you to watch some videos and read through some topics on how things are done. Marco reps has also done some nice videos on ethercat and linuxcnc:
Simply said, ethercat is just a communcation protcol for your motion controller to talk to your motors. With ethercat you just use ethernet cable which simplify the hardware side. Ethercat is not new but there are deffinitly more people doing it with mesa cards (so more examples to follow).
The ethernet cable just goes into your pc or RPI. I tend to get a seccond hand pc, with a pci slot left over and put a ethernet card which will be the dedicated ethercat connection.
here and example:
For IO stuff we tend to use the beckhoff system. EK1100 with some EL1818 and EL2818 modules
As for what brand. Yes, there is a difference between brands. Leadshine is realy good, however it also comes with a pricetag. I got Lichuan servo motors for half the price. There are also Stepper motors with an integraded driver, i think omc also sell them.
i would recommend you to watch some videos and read through some topics on how things are done. Marco reps has also done some nice videos on ethercat and linuxcnc:
- nick_namsep
- nick_namsep
10 Nov 2024 13:52
General Questions about using ethercat was created by nick_namsep
General Questions about using ethercat
Category: EtherCAT
Hello,
I mainly have a few questions about Ethercat in combination with linuxcnc. I want to retrofit a machine that i currently own and possibly some more machines in the future. I have looked at a ton of different options for motors and servo's and came across the Ethercat servo's and servo drivers from leadshine. That system looks amazing just a few small cables very fast and extremely accurate. However i don't fully understand how it works and what i need to make it work because i see some convoluted things in some videos. My main Question is what do i need to make the motors work. Just make them able to run G-code. Because in some video's i see that they use a motion controller and in other they don't like is it necessary? Or could i just plug them into the back of my pc/pi or whatever system i end up using. And the other thing that i am still trying to figure out is does anyone know the quality of the drivers and servo from omc-stepperonline? i have used there stepperdrivers and motors which are great but is their system as good as the ones from leadshine? or is it a whitelabel?
Im sorry if any of these questions are answered already but i just was not able to find a definitive answer to them
I mainly have a few questions about Ethercat in combination with linuxcnc. I want to retrofit a machine that i currently own and possibly some more machines in the future. I have looked at a ton of different options for motors and servo's and came across the Ethercat servo's and servo drivers from leadshine. That system looks amazing just a few small cables very fast and extremely accurate. However i don't fully understand how it works and what i need to make it work because i see some convoluted things in some videos. My main Question is what do i need to make the motors work. Just make them able to run G-code. Because in some video's i see that they use a motion controller and in other they don't like is it necessary? Or could i just plug them into the back of my pc/pi or whatever system i end up using. And the other thing that i am still trying to figure out is does anyone know the quality of the drivers and servo from omc-stepperonline? i have used there stepperdrivers and motors which are great but is their system as good as the ones from leadshine? or is it a whitelabel?
Im sorry if any of these questions are answered already but i just was not able to find a definitive answer to them
- cmorley
- cmorley
10 Nov 2024 13:48
Replied by cmorley on topic Dragon settings
Dragon settings
Category: Qtvcp
Die Einstellungen sollten automatisch gespeichert werden.
Können Sie Ihre INI-Datei veröffentlichen? Welche Einstellungen werden nicht gespeichert? Welche Version von Linuxcnc?
Können Sie Ihre INI-Datei veröffentlichen? Welche Einstellungen werden nicht gespeichert? Welche Version von Linuxcnc?
Time to create page: 0.448 seconds