Exemplo n.º 1
0
int rtapi_app_main(void) {
    int res = 0;

    comp_id = hal_init(name);
    if(comp_id < 0) return comp_id;

    vtable_id = hal_export_vtable(name, VTVERSION, &vtk, comp_id);
    if (vtable_id < 0) {
	rtapi_print_msg(RTAPI_MSG_ERR,
			"%s: ERROR: hal_export_vtable(%s,%d,%p) failed: %d\n",
			name, name, VTVERSION, &vtk, vtable_id );
	return -ENOENT;
    }

    haldata = hal_malloc(sizeof(struct haldata));
    if(!haldata) goto error;

    if((res = hal_pin_float_new("tripodkins.Bx", HAL_IO, &(haldata->bx), comp_id)) < 0) goto error;
    if((res = hal_pin_float_new("tripodkins.Cx", HAL_IO, &(haldata->cx), comp_id)) < 0) goto error;
    if((res = hal_pin_float_new("tripodkins.Cy", HAL_IO, &(haldata->cy), comp_id)) < 0) goto error;

    Bx = Cx = Cy = 1.0;
    hal_ready(comp_id);
    return 0;

error:
    hal_exit(comp_id);
    return res;
}
Exemplo n.º 2
0
int rtapi_app_main(void) {
    int result;
    comp_id = hal_init(name);
    if(comp_id < 0) return comp_id;

    vtable_id = hal_export_vtable(name, VTVERSION, &vtk, comp_id);
    if (vtable_id < 0) {
	rtapi_print_msg(RTAPI_MSG_ERR,
			"%s: ERROR: hal_export_vtable(%s,%d,%p) failed: %d\n",
			name, name, VTVERSION, &vtk, vtable_id );
	return -ENOENT;
    }

    haldata = hal_malloc(sizeof(struct haldata));

    result = hal_pin_float_new("maxkins.pivot-length", HAL_IO, &(haldata->pivot_length), comp_id);
    if(result < 0) goto error;

    *(haldata->pivot_length) = 0.666;

    hal_ready(comp_id);
    return 0;

error:
    hal_exit(comp_id);
    return result;
}
Exemplo n.º 3
0
int rtapi_app_main(void)
{
    int res = 0;
    comp_id = hal_init(name);
    if (comp_id < 0) return comp_id;

    haldata = hal_malloc(sizeof(struct haldata));

    if (((res = hal_pin_newf(HAL_FLOAT, HAL_IN, (void **) &(haldata->Tool_offset),
			     comp_id, "%s.Tool-offset", name)) < 0) ||
	((res = hal_pin_newf(HAL_FLOAT, HAL_IN, (void **)  &(haldata->Y_offset),
			     comp_id, "%s.Y-offset", name)) < 0) ||
	((res = hal_pin_newf(HAL_FLOAT, HAL_IN, (void **)  &(haldata->Z_offset),
			     comp_id, "%s.Z-offset", name)) < 0))
	goto error;

    vtable_id = hal_export_vtable(name, VTVERSION, &vtk, comp_id);

    if (vtable_id < 0) {
	rtapi_print_msg(RTAPI_MSG_ERR,
			"%s: ERROR: hal_export_vtable(%s,%d,%p) failed: %d\n",
			name, name, VTVERSION, &vtk, vtable_id );
	return -ENOENT;
    }

    hal_ready(comp_id);
    return 0;
 error:
    hal_exit(comp_id);
    return res;
}