Hi group!
I would like to add a new hal-pin to motion controller and show the
parameter on tkemc. For that I did the following steps:
1) Init and connect the halpin in mot_priv.h
hal_float_t *control_shaft_pos;
hal_float_t *control_shaft_vel;
2) export new pin
/* export Tornos CNC input pins */
rtapi_snprintf(buf, HAL_NAME_LEN,motion.control_shaft_pos");
retval = hal_pin_float_new(buf, HAL_IN,
&(emcmot_hal_data->control_shaft_pos),mot_comp_id);
3) connect the pin to the struct emcmotStatus
/* read Tornos CNC spezific Data */
emcmotStatus->controlshaftPos = *emcmot_hal_data->control_shaft_pos;
4) add the variable to emcmot_status_t and initialize it
double control_shaft_pos ;
For the GUI I did the following
5) add the tcl routine in emcsh.cc
static int emc_controlshaft_pos(ClientData clientdata,Tcl_Interp *
interp, int objc, Tcl_Obj * CONST objv[]) {
Tcl_Obj *shaftposobj;
if (objc != 1) { Tcl_SetResult(interp,
"emc_motion_controlshaft_pos: need no args",
TCL_VOLATILE); return TCL_ERROR; }
if (emcUpdateType == EMC_UPDATE_AUTO) { updateStatus(); }
commandstatus = Tcl_NewDoubleObj(emcStatus->controlshaftPos);
Tcl_SetObjResult(interp, shaftposobj); return TCL_OK; }
6) the last step I add the frame in tkemc.tcl
## Tornos specific data
set sonshaftlabel Control-Shaft
set conshaft [frame $top.conshaft -borderwidth 4]
set conshaftl [label $conshaft.l -textvariable sonshaftlabel -width 1
-anchor w]
set conshaftd [label $conshaft.d -textvariable shaftdigit -width 10
-anchor w]
set shaftdigit [format "%9.2f" [emc_controlshaft_pos]]
pack $conshaft -side left
pack $conshaftl -side top
pack $conshaftd -side left
Now I get the following error message :
make: Entering directory `/home/tornos/src/emc2/emc2-trunk/src'
Compiling emc/usr_intf/emcsh.cc
emc/usr_intf/emcsh.cc: In function »int emc_controlshaft_pos(void*,
Tcl_Interp*, int, Tcl_Obj* const*)«:
emc/usr_intf/emcsh.cc:3318: Fehler: »class EMC_STAT« hat kein Element
namens »controlshaftPos«
emc/usr_intf/emcsh.cc: In function »int Emc_Init(Tcl_Interp*)«:
emc/usr_intf/emcsh.cc:3622: Fehler: »emc_conshaft_pos« wurde in diesem
Gültigkeitsbereich nicht definiert
emc/usr_intf/emcsh.cc: At global scope:
emc/usr_intf/emcsh.cc:3304: Warnung: »int emc_controlshaft_pos(void*,
Tcl_Interp*, int, Tcl_Obj* const*)« definiert, aber nicht verwendet
make: *** [objects/emc/usr_intf/emcsh.o] Fehler 1
I have no idea handle this error. Any idea?
Thanks
Bernd
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users