Tuesday, May 27, 2025

Gcode Subroutines

I knew gCode supported subroutines.   Because I am often performing the same cut repeatedly but .001" or .01" deeper each time, a subroutine seems a useful way to do this.  But short of passing in the Z parameter as it advances downward,  how would work?

Then I remembered that the positioning command G1 is absolute position.   This implies there is a relative position command.  No, but there is a modal control for relative positioning.   G91 changes to relative mode; G90 goes back to absolute mode. Hence, this code that calls the O100 subroutine which moves Z down .01" on each call.  Actually. 02" because the first cut is the TO cut and the second cut is the return to start position.
 
I was able to find a WiFI USB that lets my shop Linux PC engage in useful metworking.  From 24 Kbps to 15 Mbps. Without installing new drivers, which is always the bugaboo of Linux.
%
g17 g20 g54
O100 sub
(cut Y line subroutine)
G91 (relative movement)
G1 z-0.0100 F2.0000
G90 (absolute movement)
(start point)
G1 X-0.0610 Y-0.0610 F5.0000
(cut across Y)
G1 Y3.2710 F5.0000
G91
G1 Z-0.0100  F2.0000
G90
(cut back across Y)
G1 X-0.0610 Y-0.0610 F5.0000
O100 endsub
G1 Z1 F25
G1 X-0.0610 Y-0.0610 F5.0000
G1 Z0.05 F25
G1 Z-0.3200 F2.0000
O100 call
O100 call
O100 call
O100 call
O100 call
O100 call
O100 call
O100 call
O100 call
O100 call
O100 call
O100 call
O100 call
O100 call
O100 call
O100 call
G1 Z2 F25
G1 x0 Y0 F5.0000
m2
%
Some dialects of gCode let you call a subroutine with a count of calls to make; linuxCNC is not among them.

It does not make it run any faster, nor does the C program get any faster or simpler,  but it is the right way to do it!  The invention of the subroutine deserves more honor and praise than it usually gets.

Obscure fact: my first full time job involved programming a Univac 1219, the commercial version of, I believe the AN/UYK-7 (radar fire control).  It had a sad little attempt at a subroutine call: B7IJ.  You called a subroutine at X.   The processor had no concept of a stack (1965), so the return address would be stored at X and execution would start at X+1.  (Just to add to the weirdness, this processor used 18-bit words, usually represented as 3 bit nibbles.)  

When you were ready to return to the caller, you did an indirect jump through the address stored at X.  Pretty obviously,  recursion was not possible.  I am sure some clever engineer came up with some Rube Goldberg method of creating a stack to allow recursion.


Monday, May 26, 2025

Colossus: The Forbin Project 2025

I am not sure how reputable this site is:
"OpenAI's latest ChatGPT model, known as o3, has sparked concern after reportedly disobeying human instructions to shut down. According to The Telegraph, researchers claim the AI model actively sabotaged an automatic shutdown mechanism designed to turn it off. The incident has raised alarms among experts, with Elon Musk, founder of rival AI firm xAI, labeling the development as "concerning."

Other sources are reporting it.

Finally! No One Needs Jungle Weapons in a Civilized Society

5/26/25 AP:
"MELBOURNE, Australia (AP) — An Australian state government is banning the sale of machetes after a violent gang fight in a suburban shopping mall injured a young man.

"Victoria Premier Jacinta Allan announced Monday the ban on the sale of large knives would take effect Wednesday after machete-wielding gang members clashed at a Melbourne mall on Sunday afternoon.'

Important Point

 I am reading

In the introduction:




Saturday, May 24, 2025

On NPR!

5/23/25 NPR:
"People blame gun violence on different things depending on their political leanings. But Jens Ludwig, an economist at the University of Chicago, has found a different reason behind it. Today, we bring you a story on solutions to gun violence."

Actually,  Dr. Ludwig discusses how teaching young men to rein in their tempers reduces violence because the gun control solution will not work:
"MA: If a huge cause of gun violence is just our common human frailty, what can we do about that? I know some of you are saying, what about gun control? If you reduce the number of guns, you reduce gun violence. Well, Jens says, hypothetically, sure.

"LUDWIG: But nobody has that button to push to make the 400 million guns in America disappear any time soon. There's a different thing that we can do, which is try and address the violence part of this."

He describes programs that actually work to reduce violence:

"MA: One strategy is simply to teach people. So, for example, there's this program for middle and high school boys called Becoming a Man. And basically, what they do is help boys learn what are called social cognitive skills - how to, you know, regulate their emotions and de-escalate conflicts. And Jens and his colleagues have studied the Chicago branch of this program. And what they found was boys who went through it were less likely to be arrested for carrying guns and about 50% less likely to be arrested for a violent offense.

"LUDWIG: Which is a huge reduction.

"MA: Strategy two - help change people's environments. And this can be illustrated by a study Jens points to that included researchers from the University of Pennsylvania. Philadelphia, like many Rust Belt cities, has a lot of vacant abandoned lots, and they worked with the city to raise money and hold a lottery to choose which of these lots would be cleaned up and converted into pocket parks.

"LUDWIG: And the first thing that they could see is that people were way more likely to be out in public when scary vacant lot is turned into a charming little pocket park. So that's getting more people out and about so that they can basically serve as eyes on the street to help de-escalate things, right? And the second thing they can see in the police data is that there's a really big reduction in shootings around those areas. You know, depending on the neighborhood that you're looking at, these are, like, 10- to 30% reductions in shootings. And so the solutions are not what we thought. We can see that it's much more fixable. Let's see the problem for what it is, and, like, let's get going starting yesterday."

Friday, May 23, 2025

Saskatchewan Next?

YouTube videos are beginning to show up discussing Saskatchewan having a secession referendum.  Premier Moe is taking the same cagey approach as Premier Steel of Alberta: he is not supporting secession but he is supporting a vote on it.  

I suspect two provinces leaving would encourage Quebec separatists voting on again on this.

Alberta and Saskatchewan as independent nations makes little sense except if they had a free trade arrangement with the U.S. and participation in NORAD.  I am not sure how much they could contribute.   They could buy a small number of fighters (perhaps given by us) and participate in North American Air Defense.   Central Canada would be pissed,  but loss of Quebec might make the whole discussion moot.

I Tried Finding Teflon Set Screws

There are Teflon screws on Amazon, but not Teflon setscrews.   If you think about for a while, this is unsurprising.   Setscrews are intended to secure a part to a shaft.  Teflon is so slippery that making a,Teflon setscrew is nearly oxymoron.

Why do I want this?  I need to find a way to allow a motor to turn a shaft,  yet allow hand motion of the assembly on the shaft without fighting the worm gear.  My plan is for a two part assembly.   The worm gear locks to the shaft.   A Delrin part locks very loosely to the worm gear.  Using a low friction part allows the Delrin to move.  This will require some careful tuning of setscrew tightness.  

There are nylon setscrews.  These are not as frictionless as Teflon, but lightly tightened should do the job.  I wish I could buy a smaller pack than 500.  I can but only in 2-56 thread.  That means buying a 2-56 tap.   I cannot imagine how fragile that would be.

Better.  I was worried about length without reason.   These are thumbscrews not set screws but in this application having an easier time adjusting yianyway. might be better anyway.