How can I now when it will be next periodic task release point?
I want to capture and process images each 300 ms. The processing routines take a (fixed, but unknown) time. I'd like to request a new image about 50 ms before next release point, like this:
for(;;)
{
rt_task_wait_period(NULL);
ProcessImage();
rt_task_sleep(XXX); // until 50 ms before next release point
RequestNewImage();
}I could use rt_task_inquire() if RT_TASK_INFO was documented. From source-code:
RTIME relpoint; /* !< Periodic release point. */
The question is which release point? Next or the last reached? Anyway, a new function like rt_task_getnextrelpoint() would be very welcome...
rt_task_sleep(rt_task_getnextrelpoint() - 50*1000*1000);
Thanks in advance,
Rodrigo.
_______________________________________________________
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora!
http://br.mobile.yahoo.com/mailalertas/
Ciao Rodrigo!
Quoted 10 lines · Rodrigo Rosenfeld Rosas
I want to capture and process images each 300 ms. The processing routines take a (fixed, but unknown) time. I'd like to request a new image about 50 ms before next release point, like this:
for(;;)
{ rt_task_wait_period(NULL); ProcessImage(); rt_task_sleep(XXX); // until 50 ms before next release point RequestNewImage(); }
Quoted 7 lines
I could use
rt_task_inquire()ifRT_TASK_INFOwas documented. From source-code:
RTIME relpoint; /* !< Periodic release point. */The question is which release point? Next or the last reached? Anyway, a new function like
rt_task_getnextrelpoint()would be very welcome...
rt_task_sleep(rt_task_getnextrelpoint() - 50*1000*1000);
Just trying to understand your problem:
If you wanna capture a image every 300ms, the processing must not take longer than 300ms, otherwise you have some kind over overrun (?) So you capture an image, process it within 300ms and then capture the next one, right ?
OK, wait a sec. I think I got it.
I guess your problem is having both capturing and processing in one loop ? Why not make 2 threads, one for capturing, and one for processing ?
I may be totally wrong - just trying to understand and maybe help :-)
Best regards,
Hannes.
PS.: Why do all replies go only to the sender ? This hasn't been that way in the (far) past, right ?
Hannes Mayer escreveu:
Quoted 8 lines
Ciao Rodrigo!
...Just trying to understand your problem:
If you wanna capture a image every 300ms, the processing must not take longer than 300ms, otherwise you have some kind over overrun (?) So you capture an image, process it within 300ms and then capture the next one, right ?
The processing takes something like 20 ms, but I don't need to process at a higher rate than 300 ms...
Quoted 4 lines
OK, wait a sec. I think I got it.
I guess your problem is having both capturing and processing in one loop ? Why not make 2 threads, one for capturing, and one for processing ?
Because I don't really need it... It is much simpler the way I'm doing... Let me explain better what happen... When I make a request to capture an image to the framegrabber, the process will start on the beggining of the next field. Each field takes about 17 ms to complete for a NTSC camera... I would not like to wait for the field end, so I want to request a frame 33 ms before next release point so that a new image will be already present for sure on next release point. I could do some better design for better precision but I really don't need it. The process is far too simple... I can do it right now. The question is that I would like a cleaner way to do it. I would like to make clear that I want to request a frame 33 ms before next release point...
Quoted 1 line
I may be totally wrong - just trying to understand and maybe help :-)
I think I've explained it better now, didn't I?
Quoted 5 lines
Best regards,
Hannes.PS.: Why do all replies go only to the sender ? This hasn't been that way in the (far) past, right ?
As far as I recall it was always like that, unfortunately. I also would like that the reply-to was to the list. Sometimes I forget to press the reply-to-all button on my e-mail client...
Thank you Hannes,
Best Regards
Rodrigo.
_______________________________________________________ Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora! http://br.mobile.yahoo.com/mailalertas/
Quoted 12 lines · Rodrigo Rosenfeld Rosas
I want to capture and process images each 300 ms. The processing routines take a (fixed, but unknown) time. I'd like to request a new image about 50 ms before next release point, like this:
for(;;)
{ rt_task_wait_period(NULL); ProcessImage(); rt_task_sleep(XXX); // until 50 ms before next release point RequestNewImage(); }
Quoted 5 lines
I could use
rt_task_inquire()ifRT_TASK_INFOwas documented. From source-code:
RTIME relpoint; /* !< Periodic release point. */The question is which release point? Next or the last reached?
Looks like you managed to dig out dead/broken code here: RT_TASK.timer, the timer returned in relpoint, is nowhere else used than in rt_task_inquire.
Quoted 3 lines
Anyway, a new function like
rt_task_getnextrelpoint()would be very welcome...
rt_task_sleep(rt_task_getnextrelpoint() - 50*1000*1000);
See my attached patch. It should fix rt_task_inquire in a way that meets your requirements. It also clarifies the doc. Only compile tested.
Philippe, is it correct?
Jan
native/task.h +1 -3
@@ -76,7 +76,7 @@ typedef struct rt_task_info {unsigned status;/* !< Status. */ -RTIME relpoint;/* !< Periodic release point. */ +RTIME relpoint;/* !< Next periodic release point. */ char name[XNOBJECT_NAME_LEN ];/* !< Symbolic name. */
@@ -109,8 +109,6 @@ typedef struct rt_task {#define link2rtask (laddr) \ ((RT_TASK *)(((char *)laddr) - (int)(&((RT_TASK *)0)->link))) -xntimer_t timer; -xnthread_t thread_base;char rname[XNOBJECT_NAME_LEN ];/* !< Name in registry. Not the same as
ChangeLog +5 -0
@@ -1,3 +1,8 @@ +2006-07-25 Jan Kiszka <[email protected]> + + * include/native/task.h, ksrc/native/task.c: Kill unused timer field + in RT_TASK. Return ptimer of the underlying thread on rt_task_inquire. + 2006-07-23 Jan Kiszka <[email protected]> * ksrc/skins/native/Makefile: Fixed typo that messed up modularised
skins/native/task.c +1 -1
@@ -1118,7 +1118,7 @@ int rt_task_inquire(RT_TASK *task, RT_TA info->bprio =xnthread_base_priority (&task->thread_base); info->cprio =xnthread_current_priority (&task->thread_base); info->status =xnthread_status_flags (&task->thread_base); - info->relpoint =xntimer_get_date (&task->timer); + info->relpoint =xntimer_get_date (&task->thread_base.ptimer); unlock_and_exit:
Quoted 23 lines · Jan Kiszka
Quoted 12 lines · Rodrigo Rosenfeld Rosas
I want to capture and process images each 300 ms. The processing routines take a (fixed, but unknown) time. I'd like to request a new image about 50 ms before next release point, like this:
for(;;)
{ rt_task_wait_period(NULL); ProcessImage(); rt_task_sleep(XXX); // until 50 ms before next release point RequestNewImage(); }Quoted 5 lines
I could use
rt_task_inquire()ifRT_TASK_INFOwas documented. From source-code:
RTIME relpoint; /* !< Periodic release point. */The question is which release point? Next or the last reached?
Looks like you managed to dig out dead/broken code here: RT_TASK.timer, the timer returned in relpoint, is nowhere else used than in
rt_task_inquire.
Quoted 9 lines
Quoted 3 lines
Anyway, a new function like
rt_task_getnextrelpoint()would be very welcome...
rt_task_sleep(rt_task_getnextrelpoint() - 50*1000*1000);See my attached patch. It should fix
rt_task_inquirein a way that meets your requirements. It also clarifies the doc. Only compile tested.Philippe, is it correct?
Indeed it is, applied; thanks.
Quoted 51 lines
Jan
plain text document attachment
(return-ptimer-in-rt_task_inquire.patch)
Index:include/native/task.h
===================================================================native/task.h +1
-3@@ -76,7 +76,7 @@ typedef struct rt_task_info {unsigned status;/* !< Status. */ -RTIME relpoint;/* !< Periodic release point. */ +RTIME relpoint;/* !< Next periodic release point. */ char name[XNOBJECT_NAME_LEN ];/* !< Symbolic name. */ @@ -109,8 +109,6 @@ typedef struct rt_task {#define link2rtask (laddr) \ ((RT_TASK *)(((char *)laddr) - (int)(&((RT_TASK *)0)->link))) -xntimer_t timer; -xnthread_t thread_base;char rname[XNOBJECT_NAME_LEN ];/* !< Name in registry. Not the same as Index: ChangeLog
===================================================================ChangeLog +5
-0@@ -1,3 +1,8 @@ +2006-07-25 Jan Kiszka <[email protected]> + + * include/native/task.h, ksrc/native/task.c: Kill unused timer field + in RT_TASK. Return ptimer of the underlying thread on rt_task_inquire. + 2006-07-23 Jan Kiszka <[email protected]> * ksrc/skins/native/Makefile: Fixed typo that messed up modularisedIndex:
ksrc/skins/native/task.c
===================================================================skins/native/task.c +1
-1@@ -1118,7 +1118,7 @@ int rt_task_inquire(RT_TASK *task, RT_TA info->bprio =xnthread_base_priority (&task->thread_base); info->cprio =xnthread_current_priority (&task->thread_base); info->status =xnthread_status_flags (&task->thread_base); - info->relpoint =xntimer_get_date (&task->timer); + info->relpoint =xntimer_get_date (&task->thread_base.ptimer); unlock_and_exit:
Signature · 1 line
Philippe.
Jan Kiszka escreveu:
Quoted 3 lines
See my attached patch. It should fix
rt_task_inquirein a way that meets your requirements. It also clarifies the doc. Only compile tested.
Thank you Jan.
Anyway, I couldn't find the modifications to clarify the doc. It clarified the comment inside the header but RT_TASK_INFO is not documented yet from the html documentation generated by Doxygen (at least I couldn't find it).
Best Regards,
Rodrigo.
_______________________________________________________ Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com
Quoted 9 lines · Rodrigo Rosenfeld Rosas
Jan Kiszka escreveu:
Quoted 3 lines
See my attached patch. It should fix
rt_task_inquirein a way that meets your requirements. It also clarifies the doc. Only compile tested.Thank you Jan.
Anyway, I couldn't find the modifications to clarify the doc. It clarified the comment inside the header butRT_TASK_INFOis not documented yet from the html documentation generated by Doxygen (at least I couldn't find it).
Well, true. Don't know ATM what prevents such structures being included in the Doxygen run, but this should be fixed in my eyes. Probably it's "just" about adding the related header parts to the right Doxygen group. Any volunteers around?
Jan