Advanced Search

Search Results (Searched for: )

  • RushA
  • RushA
24 Feb 2025 03:25

How to access rt pins in user space

Category: General LinuxCNC Questions

Hi,
    I create some pins in the RT module, now I want to read and write pins' value in user space.I use the following code,but it failed.Is there any way to access RT module pins in the user space? The environment is Ubuntu20.04+xenomai3.1+linuxcnc2.9.Thanks!
    int compId;
    int ret;
    hal_float_t *pin_value;
    // init HAL
    compId = hal_init("user_program");
    if (compId < 0) {
        rtapi_print("HAL init failed\n");
        return -1;
    }
    pin_value = (hal_float_t*)hal_malloc(sizeof(hal_float_t));
    ret = hal_pin_float_new("kernel_pin", HAL_IN, &pin_value, compId);
    if (ret < 0) {
        rtapi_print("getting or creating pin failed!\n");
        hal_exit(compId);
        return -1;
    }

    ret = hal_link("user_program.kernel_pin", "ALT.I2600");
    if (ret < 0) {
        fprintf(stderr, "cann't bind signal!\n");
        hal_exit(compId);
        return -1;
    }
    hal_ready(compId);
    
    //*pin_value = 123.45;
    //rtapi_print("value is: %f\n", *pin_value);
    hal_exit(compId);

It prints some messages:
HAL: initializing hal_lib
HAL: initializing component 'user_program'
HAL: component 'user_program' initialized, ID = 28
smalloc_up: shmem available 1386552
HAL: ERROR: pin_new(kernel_pin) called with already-initialized memory
HAL: creating pin 'kernel_pin'
HAL: ERROR: data_ptr_addr not in shared memory
  • Tinker
  • Tinker
24 Feb 2025 03:19
Replied by Tinker on topic 7I97T joint following error

7I97T joint following error

Category: General LinuxCNC Questions

This card is not putting out any voltage to correct the position commanded vs position actual.. i think i might have a bad one
Displaying 18736 - 18737 out of 18737 results.
Time to create page: 1.770 seconds
Powered by Kunena Forum