Homing signal processing
14 Jan 2023 18:03 #261962
by andypugh
Replied by andypugh on topic Homing signal processing
You might be able to use the "trisate_bit" component to convert the ed1.out pin to an IO pin so that it can connect to the index-enable net.Signal 'findEdge2' can not add I/O pin 'joint.3.index-enable', it already has OUT pin 'ed1.out'
Please Log in or Create an account to join the conversation.
17 Jan 2023 10:17 #262224
by Masa
Replied by Masa on topic Homing signal processing
hello
I apologize for not being able to reply to db1981, andypugh's post.
I've read the manual many times over the last few days for a solution to this problem. So I found a way to add a phthon program to do what I want in the HAL.
And for the time being, I made Homing possible, so I decided to report it.
The python program is a simple content, just referring to the sample in the manual.
python========================================
#!/usr/bin/env python
import hal
h=hal.component("toggle2index")
h.newpin("in",hal.HAL_BIT,hal.HAL_IN)
h.newpin("index",hal.HAL_BIT,hal.HAL_IO)
h.ready()
ib=0
while 1 :
if ib != h :
ib = h
if h.index == 1:
h.index = 0
python========================================
Make this available in HAL
HAL============================================
net ys4-home-sw joint.3.home-sw-in lcec.0.1.din-2-not
net findEdge1 <= lcec.0.3.TouchProbeStatus-7
net findEdge1 => toggle2index.in
net findEdge2 toggle2index.index <=> joint.3.index-enable
HAL============================================
It is confirmed that HomeSwitch is added and Homing is performed.
I would like to investigate how accurate it is.
I'm not a programmer who can maintain LinuxCNC. Also, I'm not particularly knowledgeable about building systems. Therefore, it would be very helpful to get the opinions and advice of those who have a lot of knowledge.
Thank you very much.
I apologize for not being able to reply to db1981, andypugh's post.
I've read the manual many times over the last few days for a solution to this problem. So I found a way to add a phthon program to do what I want in the HAL.
And for the time being, I made Homing possible, so I decided to report it.
The python program is a simple content, just referring to the sample in the manual.
python========================================
#!/usr/bin/env python
import hal
h=hal.component("toggle2index")
h.newpin("in",hal.HAL_BIT,hal.HAL_IN)
h.newpin("index",hal.HAL_BIT,hal.HAL_IO)
h.ready()
ib=0
while 1 :
if ib != h :
ib = h
if h.index == 1:
h.index = 0
python========================================
Make this available in HAL
HAL============================================
net ys4-home-sw joint.3.home-sw-in lcec.0.1.din-2-not
net findEdge1 <= lcec.0.3.TouchProbeStatus-7
net findEdge1 => toggle2index.in
net findEdge2 toggle2index.index <=> joint.3.index-enable
HAL============================================
It is confirmed that HomeSwitch is added and Homing is performed.
I would like to investigate how accurate it is.
I'm not a programmer who can maintain LinuxCNC. Also, I'm not particularly knowledgeable about building systems. Therefore, it would be very helpful to get the opinions and advice of those who have a lot of knowledge.
Thank you very much.
Please Log in or Create an account to join the conversation.
18 Jan 2023 13:12 #262337
by andypugh
Replied by andypugh on topic Homing signal processing
I would _strongly_ recommend moving this code into a C realtime component if you intend to use it on a real machine.
It should be even easier than the Python version.
See here for details:
linuxcnc.org/docs/stable/html/hal/comp.html
Shouldn't the "if ib != h" (etc) in your code be using h,in ? (maybe the editor mangled it)
The .comp version would look like:
If this is added to the servo thread then it is guaranteed to run ever 1ms, which is not the case for a userspace Python component which could potentially pause for several seconds.
It should be even easier than the Python version.
See here for details:
linuxcnc.org/docs/stable/html/hal/comp.html
Shouldn't the "if ib != h" (etc) in your code be using h,in ? (maybe the editor mangled it)
The .comp version would look like:
component toggle2index;
pin in bit in;
pin io bit index;
function _;
license "GPL2+";
;;
static int ib = 0;
if (ib != in){
ib = in;
if (index == 1){
index = 0;
}
}
If this is added to the servo thread then it is guaranteed to run ever 1ms, which is not the case for a userspace Python component which could potentially pause for several seconds.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
18 Jan 2023 23:45 #262372
by Masa
Replied by Masa on topic Homing signal processing
andypugh, thanks for the great advice.
I plan to try it as my next attempt.
However, I also found a problem. index-enable is usually connected to the Encoder module, and the Encoder's Position is also reset. Since the Ethercat servo drive side is not reset, the coordinates are not updated correctly even if the origin return is performed. I would like to support this as well.
I plan to try it as my next attempt.
However, I also found a problem. index-enable is usually connected to the Encoder module, and the Encoder's Position is also reset. Since the Ethercat servo drive side is not reset, the coordinates are not updated correctly even if the origin return is performed. I would like to support this as well.
Please Log in or Create an account to join the conversation.
19 Jan 2023 08:37 #262390
by rodw
Replied by rodw on topic Homing signal processing
You probably should look at how Dominc manages homing for ci402 devices in his component via read and write functions
github.com/dbraun1981/hal-cia402
But I could not get it to work so its crying out for a custom homemod component.
github.com/dbraun1981/hal-cia402
But I could not get it to work so its crying out for a custom homemod component.
Please Log in or Create an account to join the conversation.
19 Jan 2023 12:13 #262406
by Masa
Replied by Masa on topic Homing signal processing
rodw, thanks for the new info. ,
For people who are not good at English, it may be a bit difficult to jump from this forum to other sites. I would like to try to understand. I'm not a LIinuxCNC programmer, so I don't know how to use github. Even with the README.md explanation, I'm not sure if it really does what I want.
For the time being, I would like to scrutinize the information you have given me and think about it.
Thanks.
For people who are not good at English, it may be a bit difficult to jump from this forum to other sites. I would like to try to understand. I'm not a LIinuxCNC programmer, so I don't know how to use github. Even with the README.md explanation, I'm not sure if it really does what I want.
For the time being, I would like to scrutinize the information you have given me and think about it.
Thanks.
Please Log in or Create an account to join the conversation.
19 Jan 2023 12:33 #262409
by rodw
Replied by rodw on topic Homing signal processing
You don't need to do much.
Linuxcnc's instructions are also helpful (Heading 1.1)
linuxcnc.org/docs/devel/html/code/building-linuxcnc.html
You will need to install the linuxcnc-uspace-dev.deb to install halcompile if you have not built linuxcnc from source for a run in place install.
So I would then do something like
So over time you may build several pieces of software so we will keep all of our source for these in the ~/dev folder...
Then you will have the component installed and you can use Dominic's samples.
Linuxcnc's instructions are also helpful (Heading 1.1)
linuxcnc.org/docs/devel/html/code/building-linuxcnc.html
You will need to install the linuxcnc-uspace-dev.deb to install halcompile if you have not built linuxcnc from source for a run in place install.
So I would then do something like
sudo apt-get install git
cd ~
mkdir dev
cd dev
git clone https://github.com/dbraun1981/hal-cia402
cd hal-cia402
sudo halcopile --install cia402.comp
So over time you may build several pieces of software so we will keep all of our source for these in the ~/dev folder...
Then you will have the component installed and you can use Dominic's samples.
Please Log in or Create an account to join the conversation.
19 Jan 2023 12:37 #262410
by rodw
Replied by rodw on topic Homing signal processing
So if dominc changes his code, to update the software, you just need to enter the ~/dev/hal-cia402 folder and type:
git pull
sudo halcopile --install cia402.comp
Please Log in or Create an account to join the conversation.
19 Jan 2023 12:42 - 19 Jan 2023 12:42 #262411
by rodw
Replied by rodw on topic Homing signal processing
Finally, if you do decide to clone linuxcnc, that will default to master branch (V 2.10)
If you decide you want to use the 2.9 branch instead you just need to enter the linuxcnc-dev/src folder and type
That changes ths source code in the src folder to be the 2.9 branch then you proceed to make te software.
SO basically thats all you need to know.
If you decide you want to use the 2.9 branch instead you just need to enter the linuxcnc-dev/src folder and type
git checkout 2.9
That changes ths source code in the src folder to be the 2.9 branch then you proceed to make te software.
SO basically thats all you need to know.
Last edit: 19 Jan 2023 12:42 by rodw.
Please Log in or Create an account to join the conversation.
19 Jan 2023 13:51 #262415
by andypugh
Is it an absolute encoder? If it is then the same component could subtract the full turns from the feedback position.
Add a pin that takes the encoder position as an input, and a pin that outputs a corrected value to the rest of HAL.
Replied by andypugh on topic Homing signal processing
Since the Ethercat servo drive side is not reset, the coordinates are not updated correctly
Is it an absolute encoder? If it is then the same component could subtract the full turns from the feedback position.
Add a pin that takes the encoder position as an input, and a pin that outputs a corrected value to the rest of HAL.
Please Log in or Create an account to join the conversation.
Time to create page: 0.121 seconds