To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 3602
  The BrickOS Task Manager
 
Hi everyone, I was wondering if there's any documentation or example programs detailing how to use the task manager in BrickOS. The only example I have is the line-follow program that somehow uses tasks to 'wake up' when it detects a colour change. (...) (21 years ago, 4-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
(...) To make a thread with BrickOS (I use the 0.2.4, but I think that the method is the same !) You need to use the execi function : pid_t my_thread; ... (function other declaration int funct(int argc, char *argv[]) { // Function that the robot (...) (21 years ago, 4-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
(...) Hmm... it doesn't seem to recognize pid_t as a valid type. I have a document of the functions in brickOS that indicates execi returning an int. Which is it? (...) Still confused... I'll post the poignant code: pid_t rowthread; pid_t colthread; (...) (21 years ago, 5-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
(...) [snip] (...) Hi Mike, What version of BrickOS are you using? IIRC the correct type for thread IDs in the current version is tid_t, not pid_t. Also, I dunno if it was a typo, but you should include tm.h, not tm.c. HTH ROSCO (21 years ago, 5-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
in version 2.6.1 (I've just download it) extern tid_t execi(int (*code_start) (int, char **), int argc, char **argv, priority_t priority, size_t stack_size); declare in unistd.h ! So use the tid_t and not the pid_t ! (like say ROSCO) Does anyone (...) (20 years ago, 5-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
(...) only as a side note: you shouldn't really do this. you are burning precious cpu-cycles here. it should look something like while(!(rowdone && coldone)) msleep(5); if you're in a hurry you can make smaller msleep's... (20 years ago, 5-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
tid_t -> thread ID pid_t -> process ID ? "nanobapt" <nanobapt@wanadoo.fr> wrote in message news:3FF95FD4.608020...adoo.fr... (...) (20 years ago, 5-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
IIRC the issue was that Task, Process and Thread were all used to represent the same item/concept in the Kernel code. After some discussion, it was decided that the word Task would be used in all cases. This improves readability, etc... (ie. Task (...) (20 years ago, 6-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
(...) Sorry, I'm still just not getting it at all. I have type errors all over the place trying to pass arguments to my task. Could someone please simply email me or post an example of a program that starts, runs two or more threads, and will (...) (20 years ago, 10-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
(...) This works. Steve ---- #include <unistd.h> #include <dbutton.h> #include <dmotor.h> int MotorSpeed = 0; int RunMotor() { while (!shutdown_requested()) { motor_a_dir(MotorSpeed); } return 0; } int CheckButton() { while (!shutdown_requested()) { (...) (20 years ago, 10-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
(...) Thank you very much. That was exactly what I needed. Very much appreciated. Mike (20 years ago, 10-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
(...) Thank you again for the help, but unfortunately it only compiles when saved as a '.c' file. Some of my code depends pretty heavily on classes... is there any easy change to make this work as object oriented code? *just spent two hours trying (...) (20 years ago, 12-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
(...) Were you able to compile it as is? What are you trying to do? What errors are you getting? I tested that with version xx.09, not the latest one. Steve (20 years ago, 13-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
(...) When saved as multi.c, but not when saved as multi.cpp (...) Start multiple tasks within a program that uses objects. I could rewrite a number of parts to use structs instead, but I just wanted to check that there wasn't some easy solution. (...) (20 years ago, 13-Jan-04, to lugnet.robotics.rcx.legos)
 
  Re: The BrickOS Task Manager
 
(...) C++ is more particular with types than regular ol' C. However, I think BrickOS's definition of NULL in mem.h is incorrect (as this was causing one of the problems in the execi call). IMO, it should be defined like so: #ifdef __cplusplus (...) (20 years ago, 13-Jan-04, to lugnet.robotics.rcx.legos)

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR