how to get the data from control.c
09 Jul 2014 21:36 #48583
by tiffany
Replied by tiffany on topic how to get the data from control.c
really really thank for your help!
I have get the data by build some new pins in halui.cc;
I will paste the codes, hope helpful for others.
usr_intr/halui.cc
halgui:
I have get the data by build some new pins in halui.cc;
I will paste the codes, hope helpful for others.
usr_intr/halui.cc
ARRAY(hal_float_t,joint_pos_commanded,EMCMOT_MAX_JOINTS+1) /* status pin for commanded joint position */ \
ARRAY(hal_float_t,joint_vel_commanded,EMCMOT_MAX_JOINTS+1) /* status pin for commanded joint vel*/ \
...........
for (joint=0; joint < EMCMOT_MAX_JOINTS ; joint++) {
retval = hal_pin_float_newf(HAL_IN, &(halui_data->joint_pos_commanded[joint]), comp_id, "halui.joint.%d.pos-commanded", joint);
if (retval < 0) return retval;
retval = hal_pin_float_newf(HAL_IN, &(halui_data->joint_vel_commanded[joint]), comp_id, "halui.joint.%d.vel-commanded", joint);
if (retval < 0) return retval;
}
............
joint_pos_cmd=*(halui_data->joint_pos_commanded[joint_num]);
joint_vel_cmd=*(halui_data->joint_vel_commanded[joint_num]);
generate_formatted_data_float(szdata, joint_num, joint_pos_cmd, joint_vel_cmd);
send_data(szdata);
halgui:
loadusr -W 6husgui
#must run this from the same directory for now
loadusr -W halui -ini 6hus.ini
net Xpos halui.joint.0.pos-commanded
net Ypos halui.joint.1.pos-commanded
net Zpos halui.joint.2.pos-commanded
net Apos halui.joint.3.pos-commanded
net Bpos halui.joint.4.pos-commanded
net Cpos halui.joint.5.pos-commanded
net Xvel halui.joint.0.vel-commanded
net Yvel halui.joint.1.vel-commanded
net Zvel halui.joint.2.vel-commanded
net Avel halui.joint.3.vel-commanded
net Bvel halui.joint.4.vel-commanded
net Cvel halui.joint.5.vel-commanded
Please Log in or Create an account to join the conversation.
09 Jul 2014 22:23 #48585
by ArcEye
Replied by ArcEye on topic how to get the data from control.c
Hi
Yes that will do it, you seem to have what you wanted.
The only caution about your approach is that it commits you to support a patched version of linuxcnc 'ad infinitum', because these changes are unlikely to be adopted.
If you can develop a modular approach once you have everything working as you want, you will save yourself a lot of future work, in that you will just need to support your own component
regards
Yes that will do it, you seem to have what you wanted.
The only caution about your approach is that it commits you to support a patched version of linuxcnc 'ad infinitum', because these changes are unlikely to be adopted.
If you can develop a modular approach once you have everything working as you want, you will save yourself a lot of future work, in that you will just need to support your own component
regards
Please Log in or Create an account to join the conversation.
Time to create page: 0.077 seconds