View Single Post
  #4   Spotlight this post!  
Unread 20-01-2012, 17:11
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: How does this program look?

Good start, but I do see an issue, and I have four additional suggestions.

The 50, which I assume you want to be 50%, is incorrect.

You can see that the Set Output module wants a floating point value, but you passed it an integer value.

The Set Output values range from -1 to +1, for -100% output to 100% output. Right click on the number, go to the Representation menu, and select Double.

The number should now turn orange, like the wire going to the Set Output block. Next step is to change the 50 to a 0.5, for a 50% value. Just as you would represent in math, 50% is 0.50/1.00, right?

Here's the suggestions:
1) Don't use a case structure for this. If you go into the comparison menu, you should find a 'Select' block, which will let you pass a value, based on a boolean T/F input. It's a more space efficient, and easier to read way to select values based on a T/F input.

2) Keep your data-flow going in one direction. Just as you read a sentence from left to right, your data-flow should also go from left to right.

3) Connect the error lines. They can prevent unwanted behavior if an error does occur.

4) Avoid coercion dots. See the red dot on the case structure box where your wires go from blue to orange? That means there's a coercion happening, which sucks away some CPU and memory to convert your values. Always try sticking with the same data type throughout your data-flow. If it's necessary, you can convert the data types using any of the Conversion blocks under:

Numeric->Conversion
or
Mathematics->Numeric->Conversion

Here's what your program should look like at the end.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364

Last edited by RyanN : 20-01-2012 at 17:17. Reason: Fixed a bug.
Reply With Quote