Problem with custom Mcode for pallet changer

More
4 years 5 months ago #244099 by Henk
HI
Im having problems with some custom Mcodes. 

I intend using a custom M code to switch on a signal that initiates the pallet change sequence (classicladder). The idea is that i want a signal "rem-pallet-A" switched on, then waits for a signal "pallet-A-Removed" to become true before exiting, or exits after a timeout.

I wrote the bash scripts and tested them in the Axis_mm sim by adding the correct path to DISPLAY and RS274NGC sections as below.

It works perfectly in the sim, but when i copied the script to my machine configs folder and added the paths to my machine .ini file, it doesnt work. There are no errors reported when i call M100 from MDI and the signals doesnt change state. Running LCNC from a terminal doesnt report anything usefull either....just something like " main loop took 0.xxx seconds"

Tested this with a simple M code that is just "echo running", but this doesnt work either. From previous experience, if the paths are wrong, LCNC will report that there is no such M code, in this case nothing

Not sure how to look for the issue in absence of error messages, any guidance would be appreceated

[DISPLAY]
PROGRAM_PREFIX = /home/linuxcnc/linuxcnc/nc_files:/home/linuxcnc/linuxcnc/configs/sim.axis

[RS274NGC]
SUBROUTINE_PATH = /home/linuxcnc/linuxcnc/configs/sim.axis
USER_M_PATH = /home/linuxcnc/linuxcnc/configs/sim.axis

And the Mcode script is:

#!/bin/bash
A=0
CNT=0
halcmd sets change-pallet true
until [ "$A" = TRUE ]; do
A=$(halcmd gets pallet-changed)
sleep 0.5
let CNT=CNT+1
if [ "$CNT" = 10 ]; then
halcmd sets pallet-change-timeout-alarm TRUE
halcmd setp change-pallet false
sleep 1
halcmd sets pallet-change-timeout-alarm FALSE
exit 0
elif [ "$A" = TRUE ]; then
sleep 1
halcmd sets change-pallet false
echo "changed"

fi
done
exit 0

 

Please Log in to join the conversation.

More
4 years 5 months ago #244247 by andypugh
Did you make the files executable after moving them between PCs?

Please Log in to join the conversation.

More
4 years 4 months ago #244522 by Henk
Hi Andy. 
yes I did by right click and selecting the option. 

When I run ./M100 from a terminal in that folder it executes the file. But nothing happens from mdi command. Not even an error message.

thanksHenk
 

Please Log in to join the conversation.

More
4 years 4 months ago #244705 by Henk
HiNo luck yet with this issue. I may have to abandon the m code script and use remap or just a subroutine call and digital in/out
but I would like to know how to look for the error
as I said, executing the mcode file from the terminal works

​​​​​​Henk

Please Log in to join the conversation.

More
4 years 4 months ago #244787 by andypugh
Have you tried starting LinuxCNC from the command line to see if there are any clues printed?

Please Log in to join the conversation.

More
4 years 4 months ago #244792 by Henk
Hi Andy. Thanks for replying.
Yes I did, mentioned in my first post.

No helpful indication at all

Please Log in to join the conversation.

More
4 years 4 months ago #245028 by andypugh
I am running out of ideas. At this point I would probably add some "echo" lines to the bash script to see if it is being called or not.

You definitely have a /bin/bash? It's not using dash, for example?

Please Log in to join the conversation.

Time to create page: 0.087 seconds
Powered by Kunena Forum