Solved : THCAD with toma_thc config help needed
- rodw
-
- Offline
- Platinum Member
-
Less
More
- Posts: 11256
- Thank you received: 3760
14 Feb 2019 08:13 #126437
by rodw
Replied by rodw on topic THCAD with toma_thc config help needed
The correct way is to deploy a hal file that lives in /lib/hallib with the linuxcnc distribution
github.com/LinuxCNC/linuxcnc/tree/master/lib/hallib
Lets call it plasmalib.hal for now
Users should not change plasmalib.hal. If a hal pin that is configured in this file needs reassignment, then users should create a new hal file that unlinks the pins and reassigns them. By keeping these changes in a totally seperate hal file, it will become very easy to support users. This is how Dewey set up the stuff I'm working with and it works well.
github.com/LinuxCNC/linuxcnc/tree/master/lib/hallib
Lets call it plasmalib.hal for now
Users should not change plasmalib.hal. If a hal pin that is configured in this file needs reassignment, then users should create a new hal file that unlinks the pins and reassigns them. By keeping these changes in a totally seperate hal file, it will become very easy to support users. This is how Dewey set up the stuff I'm working with and it works well.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- tommylight
-
Topic Author
- Away
- Moderator
-
Less
More
- Posts: 20256
- Thank you received: 6890
14 Feb 2019 23:34 #126504
by tommylight
Replied by tommylight on topic THCAD with toma_thc config help needed
It seems to work just fine from what i can test in hal !
Thank you Phill & Co.
Here are some screenshots of it while testing, had to modify it just a bit as it was keeping both outputs high after reaching the above or below set value and they wound not go off. Now they do, they just neede to be declared as 2 separate if/else. Attached is the corrected comp, in case someone wants to give it a try.
ToDo: add PyVCP panel for it and wire it in hal !
Thank you Phill & Co.
Here are some screenshots of it while testing, had to modify it just a bit as it was keeping both outputs high after reaching the above or below set value and they wound not go off. Now they do, they just neede to be declared as 2 separate if/else. Attached is the corrected comp, in case someone wants to give it a try.
ToDo: add PyVCP panel for it and wire it in hal !
component torchud "Torch Up Down";
description
"""
torch up down by voltage calculated from encoder velocity
""";
license "GPLv2 or greater";
option singleton yes;
// Input Pins
pin in bit enable "enable up/down";
pin in float encoder_in "connect to encoder.nn.velocity";
pin in float voltage_offset "to set 0 volts";
pin in float voltage_scale "to set correct voltage";
pin in float setpoint "setpoint voltage";
pin in float tolerance "deviation from setpoint before up/down";
// Output Pins
pin out float arc_voltage "calculated arc voltage";
pin out bit move_up "arc voltage is too low";
pin out bit move_down "arc voltage is too high";
function _;
;;
#include "rtapi_math.h"
FUNCTION(_) {
arc_voltage = (encoder_in - voltage_offset) * voltage_scale;
if(arc_voltage < 0){arc_voltage = 0;}
if(enable && arc_voltage > setpoint + tolerance){
move_down = 1;
}else{
move_down = 0;
}
if(enable && arc_voltage < setpoint - tolerance){
move_up = 1;
}else{
move_up =0;
}
}
The following user(s) said Thank You: phillc54
Please Log in or Create an account to join the conversation.
- tommylight
-
Topic Author
- Away
- Moderator
-
Less
More
- Posts: 20256
- Thank you received: 6890
15 Feb 2019 02:32 - 15 Feb 2019 02:34 #126514
by tommylight
Replied by tommylight on topic Solved THCAD with toma_thc config help needed
Added provisions to send an ARCOK signal if the voltage is within set limits and they can be adjusted separately. Wired the THCAD to the 7i77 encoder input, got the scale and offset roughly correct and everything is looking OK so far. More testing is in order.
Here is the comp
Here is the comp
component torchud "Torch Up Down";
description
"""
torch up down by voltage calculated from encoder velocity
""";
license "GPLv2 or greater";
option singleton yes;
// Input Pins
pin in bit enable "enable up/down";
pin in float encoder_in "connect to encoder.nn.velocity";
pin in float voltage_offset "to set 0 volts";
pin in float voltage_scale "to set correct voltage";
pin in float setpoint "setpoint voltage";
pin in float tolerance "deviation from setpoint before up/down";
pin in float arc_ok_min "min voltage to generate arc ok signal";
pin in float arc_ok_max "max voltage to genarate arc ok signal";
// Output Pins
pin out float arc_voltage "calculated arc voltage";
pin out bit move_up "arc voltage is too low";
pin out bit move_down "arc voltage is too high";
pin out bit arc_ok "signal that arc volatage is ok";
function _;
;;
#include "rtapi_math.h"
FUNCTION(_) {
arc_voltage = (encoder_in - voltage_offset) * voltage_scale;
if(arc_voltage < 0){arc_voltage = 0;}
if(arc_voltage > arc_ok_min && arc_voltage < arc_ok_max){
arc_ok = 1;
}else{
arc_ok = 0;
}
if(enable && arc_voltage > setpoint + tolerance){
move_down = 1;
}else{
move_down = 0;
}
if(enable && arc_voltage < setpoint - tolerance){
move_up = 1;
}else{
move_up =0;
}
}
Last edit: 15 Feb 2019 02:34 by tommylight.
The following user(s) said Thank You: phillc54
Please Log in or Create an account to join the conversation.
- phillc54
-
- Offline
- Platinum Member
-
Less
More
- Posts: 5723
- Thank you received: 2095
15 Feb 2019 02:52 #126515
by phillc54
Replied by phillc54 on topic Solved THCAD with toma_thc config help needed
OOPS, Yes, I should have turned move_down off when turning move_up on and vice versa.
Cheers, Phill
Cheers, Phill
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- rodw
-
- Offline
- Platinum Member
-
Less
More
- Posts: 11256
- Thank you received: 3760
15 Feb 2019 03:01 #126516
by rodw
Replied by rodw on topic Solved : THCAD with toma_thc config help needed
Tommy, Phill great work to get this far. Really looking forward to see the final result! When you have LinuxCNC who needs external hardware anyway?
The following user(s) said Thank You: phillc54
Please Log in or Create an account to join the conversation.
- tommylight
-
Topic Author
- Away
- Moderator
-
Less
More
- Posts: 20256
- Thank you received: 6890
15 Feb 2019 03:08 #126517
by tommylight
Replied by tommylight on topic Solved : THCAD with toma_thc config help needed
Good morning Australia ! Still dark here, 4AM.
Now you can also give it a try and see how it behaves.
Thank you all, off to bed if i can fall asleep at all !
Now you can also give it a try and see how it behaves.
Thank you all, off to bed if i can fall asleep at all !
The following user(s) said Thank You: phillc54, rodw
Please Log in or Create an account to join the conversation.
- tommylight
-
Topic Author
- Away
- Moderator
-
Less
More
- Posts: 20256
- Thank you received: 6890
17 Feb 2019 00:27 #126637
by tommylight
Replied by tommylight on topic Solved : THCAD with toma_thc config help needed
Working on Phill's config, got it to work to a certain point and noticed some fuzzy stuff going on. Reporting at it's original thread, if i can find it.

The following user(s) said Thank You: rodw
Please Log in or Create an account to join the conversation.
- tommylight
-
Topic Author
- Away
- Moderator
-
Less
More
- Posts: 20256
- Thank you received: 6890
17 Feb 2019 21:05 #126694
by tommylight
Replied by tommylight on topic Solved : THCAD with toma_thc config help needed
Added some more configs for full servo systems with Mesa cards, and some with THCAD from Mesa. More to come.
forum.linuxcnc.org/plasma-laser/34978-th...-configs-with-how-to
forum.linuxcnc.org/plasma-laser/34978-th...-configs-with-how-to
Please Log in or Create an account to join the conversation.
Time to create page: 0.166 seconds