Advanced Search

Search Results (Searched for: )

  • Moutomation
  • Moutomation
20 Aug 2024 07:44
Replied by Moutomation on topic gmoccapy pins

gmoccapy pins

Category: Gmoccapy

Great, just what I wanted, thank you very much for your support.
  • mighty_mick
  • mighty_mick's Avatar
20 Aug 2024 07:17
Replied by mighty_mick on topic How to make HAL pins from .c kinematics file?

How to make HAL pins from .c kinematics file?

Category: HAL

in the lines below, you are actually creating a variable to hold your data in program memory.

struct haldata {
hal_float_t *pivot_length;
hal_float_t *x_offset;
hal_float_t *y_offset;
} *haldata;

You need to expose that addresses named x_offset, y_offset, pivot_length to hal layer, this means exporting pin. As aciera said, you can use hal_pin_float_newf function to export it. You can also use other functions to export it, they are declared at src/hal/lib/hal.h file.

This exporting process works like this:
1- You have a struct in your program memory and it is only for your program, not for other programs.
2- With this exporting functions, you are sharing your program's memory with other programs. You can consider it like giving a permission to hal layer to access your program's memory. You are registering your program's memory to public area.
3- Afte exporting your pins, you are giving ability to use that pin names in hal layer appropriately. for example, if you use this code block,
result = hal_pin_float_newf(HAL_IN,&(haldata->pivot_length),comp_id,
"%s.pivot-length", "component-name");
it means you are exporting haldata->pivot_length memory area to hal layer with name component-name.pivot-length. After that, you can use it in your hal file with this name.

I recommend to read about Inter Process Communication mechanisms in Linux, especially shared memory. LinuxCNC uses shared memory to register hal pins.
  • Aciera
  • Aciera's Avatar
20 Aug 2024 06:30
Replied by Aciera on topic gmoccapy pins

gmoccapy pins

Category: Gmoccapy

I'm not sure I understand which file needs to go where but you can check for file existance using 'os.path.exists(file)':
if os.path.exists(source1):
   print("The file exists.")
else:
  print("The file does not exis so we copy it from the mnt to the taglio folder") 
  shutil.copyfile(source1, destination1)
  • Moutomation
  • Moutomation
20 Aug 2024 06:05 - 20 Aug 2024 06:06
Replied by Moutomation on topic gmoccapy pins

gmoccapy pins

Category: Gmoccapy

For example, if we can do this, there is always this file in the mnt folder. If there is no this file in the taglio folder, if we copy this file from the mnt folder to the taglio folder, my problem will be solved again.
for example:
#!/usr/bin/env python3
import os
import time
import hal
import linuxcnc
import shutil
source1 = "/mnt/CutDocument.txt"
destination1 = "/mnt/taglio/CutDocument.txt"
if there is no CutDocument
shutil.copyfile(source1, destination1)


source = "/mnt/taglio/CutDocument.txt"
destination = "/mnt/CutDocument.txt"

h = hal.component("file-check")
h.newpin("file-changed", hal.HAL_BIT, hal.HAL_OUT)
h.ready()
# create a connection to the status channel
s = linuxcnc.stat()
# this is the file being checked for updates (example looks for 'file.txt' in the config folder)
file_path = '/mnt/taglio/CutDocument.txt'
# wait time in milliseconds between file checks
check_interval = 1000
# length of output pulse in milliseconds
pulse_length = 1000
  • Aciera
  • Aciera's Avatar
20 Aug 2024 05:56

How to make HAL pins from .c kinematics file?

Category: HAL

you also need to call the 'hal_pin_float_newf()' to create the pins:

So after this:
result = hal_pin_float_newf(HAL_IN,&(haldata->pivot_length),comp_id,
                                "%s.pivot-length",kp->halprefix);

add this
    result = hal_pin_float_newf(HAL_IN,&(haldata->x_offset),comp_id,"%s.x-offset",kp->halprefix);
    if(result < 0) goto error;
    result = hal_pin_float_newf(HAL_IN,&(haldata->y_offset),comp_id,"%s.y-offset",kp->halprefix);
    if(result < 0) goto error;
  • Moutomation
  • Moutomation
20 Aug 2024 05:56
Replied by Moutomation on topic gmoccapy pins

gmoccapy pins

Category: Gmoccapy

#!/usr/bin/env python3
import os
import time
import hal
import linuxcnc
import shutil

source = "/mnt/taglio/CutDocument.txt"
destination = "/mnt/CutDocument.txt"

h = hal.component("file-check")
h.newpin("file-changed", hal.HAL_BIT, hal.HAL_OUT)
h.ready()
# create a connection to the status channel
s = linuxcnc.stat()
# this is the file being checked for updates (example looks for 'file.txt' in the config folder)
file_path = '/mnt/taglio/CutDocument.txt'
# wait time in milliseconds between file checks
check_interval = 1000
# length of output pulse in milliseconds
pulse_length = 1000

last_modified = os.path.getmtime(file_path)
check_timer_start = round(time.time()*1000)
h = False





try:
    while 1:
        s.poll()
        # see if it is time to check the file
        if round(time.time()*1000) >= check_timer_start + check_interval:
            # we don't want to reload when program is running
            if s.task_mode == 2 and s.state == 1: # ie AUTO-mode and 'RCS_DONE'
                current_modified = os.path.getmtime(file_path)
                if current_modified != last_modified:
                    print("File has changed!")
                    shutil.copyfile(source, destination)
                    h = True
                    pulse_timer_start = round(time.time()*1000)
                    last_modified = current_modified
                    shutil.copyfile(source, destination)
                if h and pulse_timer_start + pulse_length <= round(time.time()*1000):
                    h = False
            # restart the timer for file checking
            check_timer_start = round(time.time()*1000)
except KeyboardInterrupt:
    raise SystemExit

 
  • Moutomation
  • Moutomation
20 Aug 2024 05:54
Replied by Moutomation on topic gmoccapy pins

gmoccapy pins

Category: Gmoccapy

Currently, the Windows folder is shared and we can see this folder in Linux. However, sometimes when Linux starts faster than Windows, Windows does not open and the Python code gives an error because it cannot find this file and Linuxcnc does not open. How can we do something here? For example, if it cannot find the file, it does not give an error and Linux starts. Can we do this? Having Linuxcnc open without errors is enough for me. It should be enough that it does not prevent Linuxcnc from starting.
If there is a file, it should read it. If there is no file, it should not prevent Linuxcnc from starting without giving an error.
  • uugp
  • uugp
20 Aug 2024 05:07

Results of latency test, list of computers tested for use with LinuxCNC

Category: Computers and Hardware

I bought a few very old motherboards for $5-$10 to run CNC, which is much cheaper than the Raspberry Pi.
Post a test record, which I think this is a configuration that can work stably, for reference.

Configuration 1: ASUS-M4A88T-M with built in paralletport+AMD640iiX4+ATI graphics old card + RTAI.  

 

Latency test 3 hours, seems to be good, but it is fake.
In order for the parallel port-stepping configuration to work stably, this value needs to be set to more than 9000 in setpconf, otherwise there will still be rare random errors, such as following errors or latency spikes.
The built-in graphics card can be used and without spike, and adding a graphics card can reduce the Latency slightly and obtain a good color, But once add a graphics card, it will have spikes issue. - no matter how much Latency value is set, so it must be add a option to GRUB:    radeon.dpm=0 

Several key points:
in GRUB:
radeon.dpm=0 Causes GPU to overheat
idle=poll   Causes CPU to overheat

in BIOS:
CPU Over Voltage <= 1.25V   Otherwise, it will overheat and crashes
ACPI APIC surpport = Enable   Otherwise, Linuxcnc crashes with the RTAI kernel 
others, as far as possible set Manuall or Fixed value

A confusion
on AXIS GUI graphical display area, LEFT click will causes the rolling coordinate numbers to be halt/pause update.
no interference with machine moving.
 
  • Aleksi
  • Aleksi
20 Aug 2024 04:29
Replied by Aleksi on topic Сreating a component

Сreating a component

Category: General LinuxCNC Questions

I found the reason, it was necessary to add my function to the thread.
  • snowgoer540
  • snowgoer540's Avatar
20 Aug 2024 03:23
Replied by snowgoer540 on topic Straight cut error

Straight cut error

Category: Plasmac

I will try to make some time to take a look in the next few days.
  • PCW
  • PCW's Avatar
20 Aug 2024 02:48

Converting a 7i76e config to 7c81/7i76 pair

Category: General LinuxCNC Questions

That should about do it as long as you have 7C81+7I76 firmware installed on the 7C81
  • Aleksi
  • Aleksi
20 Aug 2024 02:07 - 20 Aug 2024 02:39
Сreating a component was created by Aleksi

Сreating a component

Category: General LinuxCNC Questions

   

File Attachment:

File Name: test.comp
File Size:0 KB
Hi all! I need to write a component that could control the spindle gearbox shifting depending on the revolutions, but since I am a beginner, I first want to create a simpler component. The job of this simple component is to set the output to TRUE if both inputs are TRUE. To check, I use HALSHAW, I change the signals at the input of the component, but the output does not change, what am I doing wrong?
  • Benb
  • Benb's Avatar
20 Aug 2024 01:54
Replied by Benb on topic Scaling 0-1024 to 0-102

Scaling 0-1024 to 0-102

Category: HAL

 
  • winyk
  • winyk
20 Aug 2024 01:52

How to make HAL pins from .c kinematics file?

Category: HAL

Hello. I am a newbie. Please note that not only I am new to LinuxCNC, but I am also new to CNC as well. However, the reason I am learning LinuxCNC is because my boss want someone to help with one of the mills that we have in our office. The mill is very similar to that of 5axiskins config (located at configs/sim/axis/vismach/5axis/bridgemill) that provided with LinuxCNC by default. Since it is too dangerous to experiment on the actual machine, I am testing things out on a virtual machine (LinuxCNC on Debian inside VirtualBox). I have installed LinuxCNC using run-in-place method.

What I am trying to achieve for now is to make some extra HAL pins from 5axiskins.c . My boss suggest that I can create additional HAL pins by simply adding additional members to the haldata structure in 5axiskins.c .  Actually, he had done this before. He managed to create two HAL pins named x-offset and y-offset by modifying the haldata struct to be as followed:
struct haldata {
    hal_float_t *pivot_length;
    hal_float_t *x_offset;
    hal_float_t *y_offset;
} *haldata;

Then he added these lines to the [HAL] part in the 5axis.ini to create two signals
HALCMD = net :x-offset 5axiskins.x-offset
HALCMD = net :y-offset 5axiskins.y-offset
HALCMD = net: sets x-offset -0.25
HALCMD = net: sets y-offset -37.975

However, after I tried to follow his steps, I cannot reproduce his result. AXIS is no longer able to start the config, and it gives me an error saying that pin 5axiskins.x-offset does not exist. 

 

This error was generated from the lines I added in 5axis.ini. Commenting out the four lines I just added in 5axis.ini allowed me to get into AXIS, but I couldn't find the pins I just added inside Halshow (note that pivot-length pin comes with 5axiskins.c by default). So the cause of the error is clear: the pins didn't get created at all.

  

After consulting with my boss, he is not sure why it doesn't work this time either. So, I am asking for help on this post. Is it possible to create HAL pins by simply modifying haldata struct in .c kinematics file? If so, what did I do wrong?
  • acondit
  • acondit
20 Aug 2024 01:44 - 20 Aug 2024 01:47
Replied by acondit on topic Converting a 7i76e config to 7c81/7i76 pair

Converting a 7i76e config to 7c81/7i76 pair

Category: General LinuxCNC Questions

After about a year, I am back to trying to get this to work. I have updated to Bookworm.
I enable spi in config.
I have been able to talk to the 7c81/7i76 with mesaflash.
I edited my 7i76e hal file replacing 7i76e with 7c81.
When I tried to start linuxcnc I got an error associated with this line:
loadrt hm2_eth board_ip="10.10.10.10" config="num_encoders=0 num_pwmgens=0 num_stepgens=3 sserial_port_0=0xxxxx"
I assume I need to replace hm2_eth with hm2_rspi and take out the board_ip="10.10.10.10"
Anything else I need to do?
Thanks in advance,
Alan
Displaying 23641 - 23655 out of 24349 results.
Time to create page: 0.626 seconds
Powered by Kunena Forum