|
Re: How to make timed sequences in java?
Quote:
Originally Posted by notmattlythgoe
Be careful though, it is not multithreaded as NotInControl has stated. It uses a scheduler to run the commands one execution at a time.
|
I don't want to de-rail from the OP, and get off topic with this, but I'll offer this:
I believe you are limited your definition of "multi-threading" to spawning multiple threads for the operating system to schedule which is known as "kernel-level" threads but you are forgetting about "user-level" threads.
The CommandBased Robot Structure doesn't spwan multiple operating system threads for commands, instead it opts a "user-level" thread model where the scheduler adds each new command to a linked-list and executes each Command's "run" method sequentially in a round-robin fashion. (To be complete, other operating system threads are spawned for certain items like PID controllers, compressor, some sensors etc. and are managed by the operating system, not the WPI scheduler)
The WPI scheduler apart of the CommandBased construct will automatically remove commands which have finished execution and prevent commands from being added if the requirements for the command are not met or conflict with another commands.
All of these items are done at the application-level instead of the using the operating system to manage threads which can be classified as "user-level" threads.
In both models, time-division multiplexing is being done to share the resources of the single processor on board. Which is the basic definition of concurrency.
If there was only a single thread and the program only ran sequentially without time sharing then you would never need a scheduler.
So whether you want to call it multi-threading or not is your opinion, to the end user concurrency on a single processor is being done, I didn't state all of this before because I didn't want to muddy/confuse my original post.
Hope this helps,
Kevin
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner
|