Help needed to get my 7i76E + 7i85S + 7i73 on my mill going.

More
14 Aug 2018 20:17 #116064 by tecno
Have together with *hakan* following changes in hal
net spindle-enable   => gearblocker.0.spindle-enable-in 
net spindle-enable-2 <= gearblocker.0.spindle-enable-out => hm2_7i76e.0.7i76.0.0.spinena

net spindle-vel-cmd-rpm-abs    => gearblocker.0.spindle-speed-in
net spindle-vel-cmd-rpm-abs-2  <= gearblocker.0.spindle-speed-out  => hm2_7i76e.0.7i76.0.0.spinout

But how to get this that Andy describes is unclear.
And you might want "change up" and "change down" outputs too. Or an output to display the suggested gear.

Please Log in or Create an account to join the conversation.

More
15 Aug 2018 10:12 #116074 by Hakan
Hello Bengt,

I can show may thoughts here for anyone to see.

When the gearblocker finds the wrong gear is engaged: How to pop-up a warning? Or any other notification to tecno? It can of course be a silent, passive warning by just not starting the spindle. But a clear notification is better. Can that be made from hal? Or from the component?

I have made some tentative changes that could improve the component.

I don't use the code tag instead the red color to hilite.

component gearblocker;
pin in bit spindle-enable-in;
pin out bit spindle-enable-out;
pin in float spindle-speed-in;
pin out float motor-speed-out;
pin out int wanted-gear;
pin in float gear.#.min-speed[10];
pin in float gear.#.max-speed[10];
pin in float gear.#.ratio[10];

pin in bit high-gear;
pin in bit gear-A;
pin in bit gear-B;
pin in bit gear-C;
pin in bit gear-D;
pin in bit gear-E;

license "gpl";
function _;

;;

FUNCTION(_){
int i;
int gear;
if (spindle_speed_in == 0) return;
switch (gear_A + gear_B * 2 + gear_C * 4 + gear_D * 8 + gear_E * 16 ) {
case 1: // Gear A
gear = (high_gear != 0) ? 1 : 6;
break;
case 2: // Gear B
gear = (high_gear != 0) ? 2 : 7;
break;
case 4: // Gear C
gear = (high_gear != 0) ? 3 : 8;
break;
case 1: // Gear D
gear = (high_gear != 0) ? 4 : 9;
break;
case 1: // Gear E
gear = (high_gear != 0) ? 5 : 10;
break;
case else: // gear selection is bitmasked to be able to spot double-engagement
gear = 0;
}

if (spindle_speed_in >= min_speed(gear) && spindle_speed_in <= max_speed(gear)) {
//RIGHT GEAR ENGAGED
motor_speed_out = spindle_speed_ * gear_ratio(gear);
spindle_enable_out = spindle_enable_in;
} else {
// WRONG GEAR ENGAGED, find a suitable gear
// Brute force search
wanted_gear = -1; // No suitable gear found
for (int i=0; i< 10; i++) {
if ( speed > min_speed(i) && speed <= max_speed(i) {
// First found suitable gear
wanted_gear = i;
break;
}
}

motor_speed_out = 0;
spindle_enable_out = 0;
}
}

If you integrate this into what you already have, you should be rather close.

Had to use () instead of brackets. Code tags with colors would be great :)

Please Log in or Create an account to join the conversation.

More
15 Aug 2018 10:20 #116075 by rodw
I'm not a fan of ever using for() loop in an interrupt service routine (which is what the servo-thread is).

It would be better to allow the servo-thread to do the looping in some way. It is far better off to use 10 cycles of the thread (which is only 0.01 second) than to hold up processing of all of the other components in the queue.

Please Log in or Create an account to join the conversation.

More
15 Aug 2018 10:27 #116076 by tecno
Hmmm does it really matter in this case as I can get nowhere until the right gear is in? Just asking as I am novice on programming.

Please Log in or Create an account to join the conversation.

More
15 Aug 2018 11:59 #116079 by Hakan
I thought so too, there is no real hurry when the wrong gear is detected.
Rod, I think that will be your challenge to do right-gear-detection in hal.
I have no clue on how to do it. Except to replicate the C code in hal, kind of.

I think the loop doesn't even take 1 microsecond to execute. After all, the processor
runs at the GHz level and even with some overhead 1 microsecond is a long time.

But any right-gear-detection routine would work I guess.

Please Log in or Create an account to join the conversation.

More
15 Aug 2018 13:50 #116080 by Hakan
Regarding the notification to change gear, maybe
halui.mdi-command-00 can be used?

Not sure if the command can be as simple as
(MSG, Change gear, tecno!)

Please Log in or Create an account to join the conversation.

More
15 Aug 2018 14:29 - 15 Aug 2018 14:30 #116081 by tecno
Could it be possible to have a 'tab' in gmoccapy with leds for each gear?
This 'tab' to be called up each time Sxxxx command is issued.

Wanted gear combination flashing and actual if wrong in red and green if correct?

Just an idea but how to make this future proof for new version of gmoccapy?
Last edit: 15 Aug 2018 14:30 by tecno.

Please Log in or Create an account to join the conversation.

More
15 Aug 2018 18:31 #116091 by Hakan
Have a look at the tutorial linuxcnc.org/docs/html/gui/gladevcp.html...th_the_example_panel

I think this is not far from what you want to do.
You can start from one of the examples and add LEDs for your gear indicator.

Please Log in or Create an account to join the conversation.

More
15 Aug 2018 18:35 #116092 by tecno
Well to have gears and leds seems pretty straight forward but how to read Sxxxx and translate that to gears needed?

Please Log in or Create an account to join the conversation.

More
15 Aug 2018 18:41 #116093 by Hakan
I actually don't know but I can guess :)

The gearblocker component finds out the gear you should use (the for loop we don't talk too much about :) )
The gear you need is an "int pin". It must be possible to get the int from that pin into the glade view. "Must" as in "I guess".

Please Log in or Create an account to join the conversation.

Moderators: cmorley
Time to create page: 0.138 seconds
Powered by Kunena Forum