c++ grab in position signal

More
06 Sep 2014 16:50 - 06 Sep 2014 16:54 #50840 by bkt
Replied by bkt on topic c++ grab in position signal
ok ... all clear .... another question relative motion.in-position .... when put ad mdi command the signal commandfinished not change at all .... for debug I put on your code an ...
pin  out bit kontrol = 0;

and change it to 0 from 1 value in the case 0 and 1 statement ...... kontrol not change at all similar to your commandfinished .....

motion.in-position works only ngc file?
Last edit: 06 Sep 2014 16:54 by bkt.

Please Log in or Create an account to join the conversation.

More
06 Sep 2014 17:13 #50842 by bkt
Replied by bkt on topic c++ grab in position signal
ok ok .... I undestand ... the problem is world mode/joint mode ...... the signal motion.in-position works only in joint mode .... and axis.N.in-position too .... I don't know if this problem is real only for my deltakinematic .... now I try to simulate the signal direct from my deltakinematics .... There is an other way??

Please Log in or Create an account to join the conversation.

More
06 Sep 2014 17:58 #50843 by bkt
Replied by bkt on topic c++ grab in position signal

Still don't know why you need this, or how you will use it.

One command will not execute until the previous one completes, even directly using the MDI window of Axis.
If it does not complete, most likely there will be a following error and it will switch off anyway.
axis-remote hacks into Axis and does things without any user interaction, but does it the same way.

People doing this type of thing are usually either attempting a DNC type code injection or simply using LCNC to control something other than a standard machine
and doing all the calculations elsewhere. An example was someone using it to align an astronomical telescope.

regards


I honestly do not understand what you mean .... after this eexperience I realized that the telescopes are aligned in a joint mode or something like that .... so that the signal motion.in-position for me is not helpful.

Yesterday I read some post that tell about c++ api .... and now I think is possible to write somethings that help me to trace
emcStatus->motion.traj.position.tran.x
for example ..... when send axis-remote --mdi command is possible control if X quote to send is equal to tran.x I think ... all in QT program ..is correct this??

Please Log in or Create an account to join the conversation.

More
06 Sep 2014 20:28 #50848 by ArcEye
Replied by ArcEye on topic c++ grab in position signal
Hi

You have just dropped in that you are using a deltakins machine in world mode.

I think to be of any further use, I really do need to know exactly what you are trying to do and with what.

Otherwise any suggestions I make may be only partially successful or just plain wrong.

regards
The following user(s) said Thank You: bkt

Please Log in or Create an account to join the conversation.

More
07 Sep 2014 14:39 #50877 by bkt
Replied by bkt on topic c++ grab in position signal
really if i use motion.joint.pos-CMD and FD and compare it whit a little tollerance (+\- 0.003 mm forma e/sample} i can whit your code send sugusr1 signal.... but this solution ..... i know the mistake is mine ..... is not really good.
emcStatus->motion.traj.position.tran.x

is possibile to have in c++ program? in which mode?

Please Log in or Create an account to join the conversation.

More
07 Sep 2014 22:28 #50888 by ArcEye
Replied by ArcEye on topic c++ grab in position signal

really if i use motion.joint.pos-CMD and FD and compare it whit a little tollerance (+\- 0.003 mm forma e/sample} i can whit your code send sugusr1 signal...


I expect that is all motion.in-position does, compare axis.N.motor-pos-cmd to axis.N.motor-pos-fb or similar.

is possibile to have in c++ program? in which mode?


You need to tell me what you are doing, all I know is that you are killing threads when an axis reaches a commanded position.

I don't know what the program creating the threads does, what the machine is or why any of this is necessary.
It might not be necessary and there could be a far simpler way to achieve it all, if I had any idea what the end goal was.

regards
The following user(s) said Thank You: bkt

Please Log in or Create an account to join the conversation.

More
08 Sep 2014 00:02 - 08 Sep 2014 00:13 #50891 by bkt
Replied by bkt on topic c++ grab in position signal
you are right ......

expect that is all motion.in-position does, compare
axis.N.motor-pos-cmd to axis.N.motor-pos-fb or similar


I don't understand very well your world .... but in the code you suggested I add
pin in float sig1; -- > connect to axis...fd
pin in float sig2; -- > connect to axis...cmd

than in if statement I compare it with a little tolerance (sig1 <= sig2+0.003 || sig1>= sig2-0.003) ..... than send kill command..... in this way the time gap generated by physical motion is won and the signal is sent anyway.

I have built a delta robot than in world mode go to 150000mm/min, in joint mode up to 30000 grad/min (I don't know the max vel in this case).... when it stop, send kill command ----> new mdi command. and go again ..... I have only very few time to do this.

the MDI command is sent by qthread ..... my first idea it is use kernel signal to sincronise qthread MDI command sender with linuxcnc...... now finnaly I test this and the result is quite good but not really good.

I read in some Google old post about
emcStatus->motion.traj.position.tran.x
....... possibility of read this status by c++ (for my qtc++) .... I think is an good idea for sincronize my system..... if you have a better suggest I appreciate it ....

I need to sent a MDI command by my Qthread and I need by linuxcnc a response at the end of execution ...... at the end of physical execution my Thread sends an other MDI command. the velocity of my delta robot is very fast ..... the commands have to follow them selves without pause...

that all folks .....

note: sorry but sometime I can not understand the post because I can not english very well.....
Last edit: 08 Sep 2014 00:13 by bkt.

Please Log in or Create an account to join the conversation.

More
08 Sep 2014 00:04 #50892 by bkt
Replied by bkt on topic c++ grab in position signal
I use an QThread to send MDI command because I have an opencv program that grab the position of some object.

Please Log in or Create an account to join the conversation.

More
08 Sep 2014 15:45 #50908 by ArcEye
Replied by ArcEye on topic c++ grab in position signal
OK, getting somewhere.

So you have a delta robot, which may or may not look like this, kvarc.extra.hu/step/motor/emc/emckinematics.html, but works on the same principle.

You get a position from opencv and want to move the robot to that position.

You send a mdi command using axis-remote from a QThread. Then you terminate that thread when the command has finished, using a system call.
The only reason I can think of for this, is that the threads waiting for it to be finished will be woken if it is deleted, so you must be using it as a signal to send the next position data?

The first question I have, is how many moves in advance does your program know?
Does it have several stacked or only get the next one when the previous one has completed?

What I am thinking of is whether the commands could all be done inside a linuxcnc component and your program just puts the data where it can be read.
I think reading from a file is where you started, but it was too slow?
That could be via a serial connection, socket server, shared memory address etc

regards
The following user(s) said Thank You: bkt

Please Log in or Create an account to join the conversation.

More
08 Sep 2014 22:17 - 08 Sep 2014 22:25 #50952 by bkt
Replied by bkt on topic c++ grab in position signal
mm... No I not kill my Qthread ..... i'd use kill(pid, SIGUSR1) only for send feedback signal by linuxcnc ....

write and read a file is too slow .. i try wit use M1xx custom command ... the end-hand move to max 150000mm/min a pause of 0.1sec or less, seems a long time .....

is possible both the way I think ... the solution than it consumes fewer resources and less time is the best....

Yes is possible write some partial G-code or similar too in a component and than sent it some couple of quote ....

Now I need from linuxcnc a signal of feedback when trjectory planner end the mdi code previously send by Qthread.
The situation in similir to this:

Qthread send --->mdi xyz command---->wayting for reply
linuxcnc--->when end the previous mdi xyz command ---> send a reply to Qthread
Qthread send --->mdi xyz command---->wayting for reply
linuxcnc--->when end the previous mdi xyz command ---> send a reply to Qthread
Qthread send --->mdi xyz command---->wayting for reply
linuxcnc--->when end the previous mdi xyz command ---> send a reply to Qthread..... until stop command.

note: my kinematics it's similar to kvark .... but the math it's quite different .... at least same result .... and I have some added function ... nothing of special.
emcStatus-motion.traj.position.tran.x

For use of emcStatus in Qt c++ I have not find nothing about how to declare emcStatus in my Qhtread.h file ... of course I insert
#include <linuxcnc/emc.hh>
#include <linuxcnc/emcpos.h>
#include <linuxcnc/nml.hh>
#include <linuxcnc/emc_nml.hh>

I have some doubts on the time to acquire (on my QThread) the signal "motion.traj.position.tran.x" and compare it with the quote computed and than commanded axis remote --mdi
I'm very curious of the results obtained using emcStatus on Qt ... if you want to suggest how to declare emcStatus in my .h file ... I would try.

I know it might not be the best solution .... so all the others that want to suggest will be tested physically.

Thank you very much.
Last edit: 08 Sep 2014 22:25 by bkt.

Please Log in or Create an account to join the conversation.

Time to create page: 0.101 seconds
Powered by Kunena Forum