BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

So we could just put a state enum in a shift register as every reasonable person would do

 

OR... (wait for it) ...

 

We could also constantly push it in an out of a queue ( ... and I am not making this up!). I think Rube Goldberg would have been very proud!

 

altenbach_1-1684087932630.png

 

 

 

0 Kudos
Message 2511 of 2,635
(1,904 Views)

The only advantage I find here would be to be able to add various states at the back and front. while with a simple shift register it requires a bit more manipulation.

 

0 Kudos
Message 2512 of 2,635
(1,879 Views)

At least the queue isn't named.

0 Kudos
Message 2513 of 2,635
(1,875 Views)

@VinnyAstro wrote:

The only advantage I find here would be to be able to add various states at the back and front. while with a simple shift register it requires a bit more manipulation.


The advantage of using the queue is being able to enqueue multiple states at once.  But this is geared more towards a sequencer than a state machine.  This is also a variation of the JKI State Machine.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2514 of 2,635
(1,859 Views)

@crossrulz wrote:

@VinnyAstro wrote:

The only advantage I find here would be to be able to add various states at the back and front. while with a simple shift register it requires a bit more manipulation.


The advantage of using the queue is being able to enqueue multiple states at once.  But this is geared more towards a sequencer than a state machine.  This is also a variation of the JKI State Machine.


Yes, if we want to enqueue a sequence of multiple states we also need to adjust the rest of the code to handle that. Nothing wrong with that. Here we would typically have the enqueue and dequeue in parallel loops. 

Here we have a 1:1 relationship of each state dequeuing and enqueueing exactly one "next state" ( all in the same loop!) and if we would forget to enqueue (e.g. not enqueue the initial state, the program would lock up forever and if we would enqueue more than one the queue would grow forever.).

0 Kudos
Message 2515 of 2,635
(1,841 Views)

@altenbach wrote:

@crossrulz wrote:

@VinnyAstro wrote:

The only advantage I find here would be to be able to add various states at the back and front. while with a simple shift register it requires a bit more manipulation.


The advantage of using the queue is being able to enqueue multiple states at once.  But this is geared more towards a sequencer than a state machine.  This is also a variation of the JKI State Machine.


Yes, if we want to enqueue a sequence of multiple states we also need to adjust the rest of the code to handle that. Nothing wrong with that. Here we would typically have the enqueue and dequeue in parallel loops. 

Here we have a 1:1 relationship of each state dequeuing and enqueueing exactly one "next state" ( all in the same loop!) and if we would forget to enqueue (e.g. not enqueue the initial state, the program would lock up forever and if we would enqueue more than one the queue would grow forever.).


I'm not arguing your points.  I was only pointing out that there is a good use of using a queue to maintain your states.  But I will reiterate: I would not do this for a state machine; it is useful for a sequencer.

 

As far as forgetting to enqueue and then your queue is empty, I have code in my library to handle that (go to an error state if the queue is empty).  The queue growing forever is another issue.  There is not much you can do about that from a library perspective.  That would be on the programmer of the sequencer.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2516 of 2,635
(1,817 Views)

Sometimes Rube Goldberg code can be deduced from words alone (seen here)

 

QUOTE: "When I dragged over several indicator/controls and try to create local variables or references,...., but if I just drag over say 100 controls, what is the logic behind the order of created local variable and reference label/icons?"

 

(On a side note, I recommend to not comment in that thread. Seriously)

Message 2517 of 2,635
(1,726 Views)

@altenbach wrote:

 

(On a side note, I recommend to not comment in that thread. Seriously)


Jenny luckily took care of that. It’s a typical case of wanting to show they know better and challenging everybody having any critique. I pity his students if he really is teaching. 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2518 of 2,635
(1,662 Views)

@rolfk wrote:

@altenbach wrote:

 

(On a side note, I recommend to not comment in that thread. Seriously)


Jenny luckily took care of that. It’s a typical case of wanting to show they know better and challenging everybody having any critique. I pity his students if he really is teaching. 


Wow, that thread got really out of hand. And the guy actually believes that his approach is better. 

0 Kudos
Message 2519 of 2,635
(1,652 Views)

@johntrich1971 wrote:

@rolfk wrote:

@altenbach wrote:

 

(On a side note, I recommend to not comment in that thread. Seriously)


Jenny luckily took care of that. It’s a typical case of wanting to show they know better and challenging everybody having any critique. I pity his students if he really is teaching. 


Wow, that thread got really out of hand. And the guy actually believes that his approach is better. 


When all you know is a hammer, every problem tends to look like a nail. And some are so fixed in their believes that they will refuse any advice that there are a zillion other tools out there than just a hammer.

 

One of his future threads, he will likely start, will be about how totally useless and crappy LabVIEW is, because his beautifully and painstakingly designed application is so badly maintainable.Python, C#, even Basic is so much more superior, because you can use Ctrl-C, Ctrl-V a zillion times and the order is always consistent! 😀

 

The problem is never with us, always with the others. 😁

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2520 of 2,635
(1,649 Views)