Absolute homing
- eduard
- Topic Author
- Offline
- Premium Member
- Posts: 80
- Thank you received: 12
thanks for the help to identify this hal pin for custom homing. After a several day trial and error I didn manage to find a solution how to switch between servo homing and linuxcnc homing.
I would like to home the servo once with custom homing. The servo finding the home switch then homed.
Now at this point just commenting out the hal custom homing and ini homecomp to use absolute homing 2, without movement.
Here is the INI part:
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1000000
#HOMING use EL8 drives internal homing. Uncomment the line below and in the HAL as well. Home the machine, then comment out.
HOMEMOD=el8_homecomp
and the HAL part:
#HOMING use EL8 drives internal homing. Uncomment the line below and in the ini as well. Home the machine, then comment out.
net x-home-request joint.0.request-custom-homing => cia402.0.home
net x-homing joint.0.is-custom-homing <= cia402.0.stat-homing
net x-homed joint.0.custom-homing-finished <= cia402.0.stat-homed
What is the solution to use a simple hal pin to switch between this two homing modes?
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
- Posts: 3982
- Thank you received: 1723
net x-home-request joint.0.request-custom-homing => cia402.0.home
with
setp joint.0.request-custom-homing FALSE
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23159
- Thank you received: 4856
Please Log in or Create an account to join the conversation.
- eduard
- Topic Author
- Offline
- Premium Member
- Posts: 80
- Thank you received: 12
But still have to comment out everything about servo homing, and from the ini as well.
But now when the machine is on, everything is homed automagically.
# ABSOLUTE HOMING ON ALL AXES
# If internal homing is commented out on all drives and in the INI file (#HOMEMOD=el8_homecomp), this will home the machine when powering on.
net machine-on halui.machine.is-on => halui.home-all
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
- Posts: 3982
- Thank you received: 1723
Looking at the compile result of 'el8_homecomp.comp' (ie 'el8_homecomp.c') I see this 'do_homing' function:
bool do_homing(void)
{
int joint_num;
int homing_flag = 0;
bool beginning_allhomed = get_allhomed();
do_homing_sequence();
/* loop thru joints, treat each one individually */
for (joint_num = 0; joint_num < all_joints; joint_num++) {
if (!H[joint_num].joint_in_sequence) { continue; }
if (!GET_JOINT_ACTIVE_FLAG(&joints[joint_num])) { continue; }
// CUSTOM joint homing state machine for everybody:
homing_flag += custom_1joint_state_machine(joint_num);
}
if ( homing_flag > 0 ) { /* one or more joint is homing */
homing_active = 1;
} else { /* is a homing sequence in progress? */
if (sequence_state == HOME_SEQUENCE_IDLE) {
/* no, single joint only, we're done */
homing_active = 0;
}
}
// return 1 if homing completed this period
if (!beginning_allhomed && get_allhomed()) {homing_active=0; return 1;}
return 0;
}
While in my test component I get this:
bool do_homing(void)
{
int joint_num;
int homing_flag = 0;
bool beginning_allhomed = get_allhomed();
do_homing_sequence();
/* loop thru joints, treat each one individually */
for (joint_num = 0; joint_num < all_joints; joint_num++) {
if (!H[joint_num].joint_in_sequence) { continue; }
if (!GET_JOINT_ACTIVE_FLAG(&joints[joint_num])) { continue; }
if (customH[joint_num].is_custom_homing) {
// CUSTOM joint homing state machine:
homing_flag += custom_1joint_state_machine(joint_num);
} else {
// DEFAULT joint homing state machine:
homing_flag += base_1joint_state_machine(joint_num);
}
}
if ( homing_flag > 0 ) { /* one or more joint is homing */
homing_active = 1;
} else { /* is a homing sequence in progress? */
if (sequence_state == HOME_SEQUENCE_IDLE) {
/* no, single joint only, we're done */
homing_active = 0;
}
}
// return 1 if homing completed this period
if (!beginning_allhomed && get_allhomed()) {homing_active=0; return 1;}
return 0;
}
So the 'el8_homecomp.c' does not contain the switch between CUSTOM and DEFAULT homing:
if (customH[joint_num].is_custom_homing) {
// CUSTOM joint homing state machine:
homing_flag += custom_1joint_state_machine(joint_num);
} else {
// DEFAULT joint homing state machine:
homing_flag += base_1joint_state_machine(joint_num);
}
Looks like it was maybe not intended for the user to be able to choose between the homing method.
Please Log in or Create an account to join the conversation.
- rodw
- Away
- Platinum Member
- Posts: 10757
- Thank you received: 3542
It was never designed to mix and match methods in the one machine configuration
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
- Posts: 3982
- Thank you received: 1723
It was never designed to mix and match methods in the one machine configuration
Not sure what makes you think that as the homecomp doc clearly states that it is intended to enable the user to setup each joint to use the default or the custom homing routine:
This module creates input hal pins joint.n.request-custom-homing that enable an alternate joint homing state machine for requested joints.
linuxcnc.org/docs/html/man/man9/homecomp.9.html
This seems to work just fine in the testing I have done and I don't really see why it shouldn't work as homing is done for each joint.
The only reason 'el8-homecomp.comp' does not offer that option is that the author of that particular homing component decided to remove that functionality.
[edit]
That is what I meant with this comment (ie 'it' meaning 'el8-homecomp.comp'):
Looks like it was maybe not intended for the user to be able to choose between the homing method.
Please Log in or Create an account to join the conversation.
- rodw
- Away
- Platinum Member
- Posts: 10757
- Thank you received: 3542
github.com/rodw-au/cia402_homecomp/tree/main
I went back to the original homecomp code so it should work. I only get small bursts of time to work on this so I forget what is meant to be supported. (My first homecomp was obsoleted by massive changes to the framework)
Note my pin names are different. There is a PR there to change them back to the default names which I am deliberating over accepting or not. Give me your thoughts on this.
I've had some help from scottlaird and was hoping once this is tested, it would be distributed with the hal ethercat driver.
Please Log in or Create an account to join the conversation.
- rodw
- Away
- Platinum Member
- Posts: 10757
- Thank you received: 3542
Please Log in or Create an account to join the conversation.
- rodw
- Away
- Platinum Member
- Posts: 10757
- Thank you received: 3542
I've added an issue to remind me to fix this.
I am out of time now until this evening.
Happy to accept a PR to correct this in the meantime.
Please Log in or Create an account to join the conversation.