Add more threads to EMCMOT

More
07 May 2013 01:37 #33685 by casetero
Add more threads to EMCMOT was created by casetero
Hello,

I need to add another thread, one more apart of servo-thread and base-thread. I´ve tried to put in the hal file

loadrt threads name1=test period1=50000

But if i put it before

loadrt [EMCMOT] EMCMOT base-period1=......

then linuxcnc doesnt start and in the debug file it says that cant load EMCMOT, if i put it after it says cant load threads.ko...

Dont know if i can put another thread in EMCMOT or how to load EMCMOT and threads.ko at the same hal session.

Do you know how can i add a new thread to the session??

Thank you very much and sorry for my english.

Regards.

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

More
07 May 2013 15:41 #33705 by ArcEye
Replied by ArcEye on topic Add more threads to EMCMOT
Hi

I could not see why it would not work, so I amended a sim config (axis_mm.ini and core_sim.hal) as below.
[EMCMOT]
EMCMOT =              motmod
COMM_TIMEOUT =          1.0
COMM_WAIT =             0.010
# BASE_PERIOD is unused in this configuration but specified in core_sim.hal
BASE_PERIOD  =               50000
SERVO_PERIOD =               1000000
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
# load 6 differentiators (for velocity and accel signals
loadrt ddt count=6
# load additional blocks
loadrt hypot count=2
loadrt comp count=3
loadrt or2 count=1

loadrt threads name1=extrathread period1=1000000

addf motion-command-handler extrathread
addf motion-controller extrathread

and the result, thread created and motion.command and motion.controller running on that thread




So not sure what to suggest, perhaps space loading away from EMCMOT or maybe you have a typo?

regards
Attachments:

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

More
07 May 2013 19:04 #33709 by casetero
Replied by casetero on topic Add more threads to EMCMOT
Hello, thanks for answer,

I have localized the problem, it is that the first thread you loadrt must be the lower period, because linuxcnc establish that period to the clock period, so you can loadrt another thread after with less period. It´s a little bit annoying because if you loadrt first EMCMOT it establish your servo_period as clock period and you cant loadrt after a thread with lower period than servo-thread. And if you load first your thread, you cant load after EMCMOT because your base-thread would have a significative lower period....

So i dont know how to have:

Servo-thread 1.000.000 ns

base-thread 40.000 ns

own-thread 250.000 ns

Thank you and regards.

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

More
07 May 2013 19:17 #33711 by casetero
Replied by casetero on topic Add more threads to EMCMOT
Only solution i see is to make:

Own-thread 1.000.000

Servo-thread 250.000

base-thread 40.000

And net all parameters now i have linked yo servo-thread to own-thread, but i dont know if this will cause some kind of toruble in the deep work of linuxcnc.

Anyone knows?

Thank you!

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

More
07 May 2013 19:22 #33712 by BigJohnT
Replied by BigJohnT on topic Add more threads to EMCMOT
Why do you need another thread?

John

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

More
07 May 2013 19:52 #33717 by ArcEye
Replied by ArcEye on topic Add more threads to EMCMOT

Hello, thanks for answer,
I have localized the problem, it is that the first thread you loadrt must be the lower period, because linuxcnc establish that period to the clock period, so you can loadrt another thread after with less period.


That does indeed seem to be the case.
The documentation seems to be saying that you only need to specify the threads in ascending order within a single invocation of loadrt threads.
It says nothing about it being affected by previous thread loads when talking about creating more than 3 threads by reloading the component.
"...If more than three threads are needed, unload threads, then reload it to create more threads...."

I reduced the extrathread period by half and got this error in the kernel log
HAL_LIB: ERROR: new thread period 500000 is less than existing thread period 999480
THREADS: ERROR: could not create thread 'extrathread'


I did check in case EMC_MOT leaves threads.ko loaded, but that is not the case. (I suspect it does not use it)

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

More
07 May 2013 20:00 #33719 by ArcEye
Replied by ArcEye on topic Add more threads to EMCMOT

Only solution i see is to make:
Own-thread 1.000.000
Servo-thread 250.000
base-thread 40.000
And net all parameters now i have linked yo servo-thread to own-thread, but i dont know if this will cause some kind of toruble in the deep work of linuxcnc.
Anyone knows?


You can make the servo thread 995000, which is near as damn it what it was before, so long as the number is lower than the next one created it will work.
250000 is too fast, you don't really want it polling that often, it will slow things down

regards

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

More
08 May 2013 00:37 #33741 by casetero
Replied by casetero on topic Add more threads to EMCMOT
Thanks to answer,

I need another thread because i have a component that must be readed more often than the servo period and cant net it to base period. This component is to read counts from a jogwheel, and if i net it to servo thread when moving the jogwheel slowly linuxcnc doesn´t read a lot of pulses to the axis.0.jog-counts.

Finally i have solve it adding a thread before EMCMOT, but the period i have to put is 40.000 ns (like base-period).

So the question now is, having two fast threads, one the base-thread and the other one own-thread, will make linuxcnc works badly?

My own thread has only one function added, the one for the jogwheel, and it seems to works nice. But i dont know if it will generate problems in the future.

Thank you and regards.

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

More
08 May 2013 00:46 - 08 May 2013 01:32 #33742 by casetero
Replied by casetero on topic Add more threads to EMCMOT
Ok,

So then having two different fast threads ( 40.000 ns) , one of them just used to read one silly function, will be too much pulses to linuxcnc?

Thank you and regards.
Last edit: 08 May 2013 01:32 by casetero.

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

More
08 May 2013 01:02 #33743 by BigJohnT
Replied by BigJohnT on topic Add more threads to EMCMOT
If you want a component to work in the base thread you can not have floating point math operations in that component.

John

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

Time to create page: 0.083 seconds
Powered by Kunena Forum