Three New NXT-G Blocks Available for Beta Testing

HiTechnic has just made three NXT-G blocks available for beta testing. Two of these are specific to the IRSeeker sensors and the other is a general purpose math block. There is a new IRSeeker Block will replace the current V1 and V2 IRSeeker blocks and adds support for selecting 600Hz AC mode (you can still use the default 1200Hz AC). The other sensor block is the Enhanced IRSeekerV2 block which is designed to give you improved short range performance versus the standard IRSeeker block. This block allows you to easily limit the range of a number by either clamping or wrapping around to a certain range.

Essentials:
HiTechnic IRSeeker Sensor Block (beta)
HiTechnic Enhanced IRSeekerV2 Block (beta)
HiTechnic Limit Number (beta)

These three new blocks are being made available as a beta test versions. Two of these are brand new blocks, the Enhanced IRSeekerV2 block and the Limit Number block, and the other is a combination of two earlier blocks. Please give these blocks a try and let us know if you find bugs or usability problems. Also give us feedback on how useful or effective you find these new blocks.

These blocks can all be found on the new Beta Testing downloads page.

All these blocks have online help. After the block has been installed into the LEGO Mindstorms software, add the block to your program and then hover the mouse over the block. You will now see a short piece of Context Help text in the lower right corner of the LEGO software screen and you can then click on More Help.

IRSeeker Block 2.0

This block replaces the older V1 and the V2 sensor blocks. Basically when we were adding support for 600Hz AC mode to the IRSeekerV2 block we discovered that it was very easy to make the same block work with the V1 IR Seeker sensor as well. The block simply treats the V1 sensor as just another mode.

If you are using the block with the V1 sensor, you must select the mode IRSeeker V1 – DC as this is the only mode supported by this sensor. For the V2 sensor you can now choose between 600 or 1200Hz AC modes or DC mode. For maximum range AC mode is far superior to DC mode in direction determination but sometimes DC mode works between when you just want the direction to the strongest IR source.

Enhanced IRSeekerV2 Block

The IRSeekerV2 sensor was designed for maximum range in determining the direction to the IRBall, almost 8 feet (over 2 meters), which is ideal for robot soccer. Unfortunately, because the sensor is tuned to detect this rather weak IR signal, it’s sensor elements tend to get saturated when the ball is very close. This is because the IR light can be over a 1000 times stronger when the ball is near compared to 8 feet away. This can be a problem when building a robot soccer robot because the robot can drive up to the ball and then turn away just as it gets close because the sensor is now either giving the wrong direction or no direction. This enhanced sensor block is designed to overcome this problem by internally using a combination of AC and DC modes. This works because while DC mode is very unreliable for long distances, it works better than AC at short range. This sensor block is also designed to be easier to use in NXT-G programs by providing a single signal strength value and also an additional direction output that is in degrees. The DegDirection output is designed to make it easier to use the block with Compass Sensor.

This new Enhanced IRSeekerV2 block should be especially useful to the WRO Soccer robot programmers.

HiTechnic Limit Number Block

Like the HiTechnic Sin/Cos, ATan2, and Motor PID Blocks, this is a general purpose block that is not specific to any HiTechnic sensor; it is simply a useful sensor designed to make programming robots easier and more straight forward.

This block is designed to limit the range of a number. It takes as input a number as well as Min and a Max value. If the value is within the range of Min to Max then the output value will simply be the same as the input number. If the number is outside the range then one of two limit operations will be applied to the number:

  • Clamping – This will ‘clamp’ the value to the desired range. If the value is less than the Min value then the output will be equal to Min and if it is greater than Max then the output will be equal to Max, otherwise the output value will be the same as the input value.
  • Wrap Around – This operation will make the number wrap around to the other side of the range if it is beyond one of the limits. The range of the output is actually Min <= Result < Max. Note that if the input value is equal to Max, it will wrap around to Min.

For example, lets say you have some calculation that you make, perhaps you are line tracking or navigating with the Compass, and you have a power value that you want to send to the motors. The problem is that value range from your math blocks goes beyond what you want to send to the motors. This block makes it easy to clamp the power value to something like 0 to 75 by simply setting the Min to 0 and Max to 75. The configuration panel of the Limit Number block would look like this:

Notice that the configuration panel has a Feedback indicator on the left side in the orange field. This is there to make it easy to test the functionality of the block. You can enter values into the Number field and see what the output Result will be.

Also notice that line graphic in the bottom of the block. The line represents a graph of input Number to Result showing the value getting clamped at the Min and Max limits.

If you are working with angles, such as from the Angle sensor, Compass sensor, or motor encoder, they you may have a need to normalize an angle into a particular degree range such as 0 to 360 or -180 to 180. For example, let’s say you are working on a program that needs to find the opposite direction relative to the compass sensor heading. One way to find the opposite direction of an angle is to add 180. For example, if the angle is 30 and you add 180 you get 210. But what if the input is 270, if you add 180 you get 450. In this case you can use the block set to Wrap Around to get the number into the 0 to 360 range. Your program might look like this:

When used in this way, the output result will automatically be normalized to the 0 to 360 range so that 450 will wrap around to 90. Note that the value could potentially wrap many times, for example, with the 0 to 360 setting an input value of 3605 would give a result value of 5 since 3600 is 10 full 360 degree rotations plus 5. Similarly, an input of -3605 would give a result of 355 since it will now wrap around an extra 5 degrees below 0.

Note that the line graphic on the block now shows three diagonal lines, this represents how the value wraps around when it goes beyond the limits.

Also note the Preset dropdown, this is dropdown lets you select among four common settings:

  • Power – Clamp 0 to 100
  • Power – Clamp -100 to 100
  • Angle – Wrap Around 0 to 360
  • Angle – Wrap Around -180 to 180

Using one of the presets is optional and you can also enter any Min, Max setting that you need and manually select between Clamp or Wrap Around.

Please give these blocks a try, take a look at the help files, and let us know if you find these blocks useful or if you find any issues with the blocks.

2 Responses to “Three New NXT-G Blocks Available for Beta Testing”

  1. Anton says:

    Just as an idea on the Limit Number Block you might want to add a scaling operation also.
    For example input min – max values scales to output min max values.

    Input min max is 0 to 200
    Output min max is 0 to 100
    Input number of 20 gives output number of 10

    reverse is also then possible

    Input min max is 0 to 100
    Output min max is 0 to 200
    Input number of 20 gives output number of 40

    Just as a note I know you can do this with multiplication blocks but it would be a nice addition to the limiting block.

  2. Gus says:

    Yes, that is a good idea. The way I could do this is to take the current number limiting code and use it for the input range so that it would work for both clamping and wrap-around. Then apply the output range to scale and translate the value.
    I will note this as a future upgrade. Thanks for the suggestion.

Leave a Reply