NXT-G

Matrix Motor Block

Use this block to control a Matrix Motor that is connected to a Matrix Controller.

 

Display Settings

  1. The number shows which NXT sensor port used for the Matrix Controller.
  2. The number shows the Matrix Motor port that has been selected. If there is an ‘i’ next to the number then the motor direction is being inverted.

 

Configuring the Matrix Motor Block

  1. Choose the NXT sensor port that is used to connect to the Matrix Controller.
  2. Choose the motor port on the controller.
  3. Check the Invert Direction box if the selected motor should be inverted. Most driving robots will need to have one driving motor inverted in order to drive straight when both motors are given the same speed. Note that if you invert the motor then you will need to invert the motor on all blocks that reference this motor to get consistent behaviour.
  4. Check the Start Pending box if you want to synchronize the action of multiple motors. If Start Pending is checked then the motor action will not take affect until another Matrix Motor block is used with Start Pending not checked.
  5. Use the Slider or the number box to set the speed or power of the motor. This value represents Speed when used with the Constant Speed mode or one of the Slew to Postion actions. The value range is from -100 to 100 where a negative value indicates reverse direction. Click on the stop sign to quickly adjust the speed setting to 0.
  6. There are three possible Motor Mode settings: Power with 0 Float, Power with 0 Brake, and Constant Speed. The Power with 0 Float and Power with 0 Brake are unregulated and actual motor speed will depend on the battery level and the load placed on the motor. The two Power modes let you specify the behaviour when the Speed value is 0. Float means the motor can turn freely while Brake prevents the motor from turning. Constant Speed is regulated and the controller will attempt to keep the motor at a constant speed based on the speed setting.
  7. There are four possible Action settings: Unlimited, Slew to Position, Slew to Relative Position, and Time (seconds). Unlimited initiates the action and then the program goes on to the next block. Slew to Position will turn the motor toward the specified target position. Slew to Relative Position turns the motor toward a target position relative to the current position. Time lets you select the number of seconds that the motor should be on. For both Slew to Position and Slew to Relative Position, you can specify the amount in either encoder ticks, degrees, or rotations.
  8. Wait for Completion is an option for Slew to Position and Slew to Relative Position. If checked, the program will only continue once the motor reaches the target position.

Using Unlimited Action

The Unlimited Action activates the motor using the specified Speed and Motor Mode and then execution continues with the next block in the program. This action is useful when you want a motor run until some external condition is met and then you use another Matrix Motor block to stop or change the speed. For example, to run a motor until the Touch Sensor is pressed you can do this:

In this program the first Matrix Motor block has been configured to use the Unlimited action to start the motor. The second block is a Wait block that ‘Waits’ for the Touch sensor to be pressed. The last block is another Matrix Motor block configured to stop the motor by using a speed of 0.

Using the Slew to Position Actions

There are two slew to position actions: Slew to Position and Slew to Relative Position. Slew to Position lets you specify an absolute target postion while Slew to Relative Postion lets you specify a target position relative to the current postion. For both of these action you can specify the target postion in either motor encoder ticks, degrees, or rotations. If the Wait For Completion option is set, then the program will not go on to the next block until the motor reaches the target position.

Note that when a program is first started, all the motors encoder positions are set to 0. To reset the motor encoder positon in your program use the Matrix Motor Status block with the Reset Encoder option set.

Using Time (seconds) Action

Use this action to run a motor for a certain amount of time and then stop the motor.

Synchronizing Multiple Motors

If you have two motors that you want started together and then use the Start Pending option on the first Matrix Motor block. For example, to start Motor 1 and 2 together, use two Matrix Motor blocks lke this:

In this program the first block of each pair has the Start Pending option checked. In this case Motor 1 and Motor 2 will start exactly at the same time. Similarly, after the Wait the two motors will stop together since the first of the two blocks has Start Pending checked.

Matrix Motor block Data Hub plugs

Clicking on the bottom edge of the block will fully open the Data Hub as shown.

 

 

 

  1. This plug wires the port number for the NXT Port used for the Matrix Controller.
  2. This plug wires the motor port on the Matrix Controller. This value is normally from 1 to 4 but if the motor direction is inverted then the value should be plus 4 (motor value from 5 to 8).
  3. This plug specifies the Speed/Power for the motor.
  4. This plug specifies the Motor Mode:
    1. Power with 0 Float
    2. Power with 0 Brake
    3. Constant Speed
  5. This plug can specify the Action used by the block:
    1. Unlimited
    2. Slew to Position
    3. Slew to Relative Position
    4. Time
  6. This plug wires the Input Value used for the actions Slew to Position, Slew to Relative Position and Seconds. Note that for both Slew actions this value uses the units Encoder Ticks. For Seconds then the units are milliseconds.
  7. This plug specifies the Set Pending option. If set to True, then the action will be delayed until the next Matrix Motor where Set Pending is not set.
  8. This plug specifies the Wait for Completion option. This is option is only available for the two Slew to Position action. Wait for Completion is also automatic with the Time action.

Matrix Move Block

Use this block to control the motors of a differentially steered robot, a robot that turns by using different speeds for the left and right motors. This block lets you specify the overall speed setting as well as the steering angle to use for turns. You can use this block with a duration setting to drive a certain distance or time or use a duration of Unlimited to just set the motors speeds and then go on to the next block in the program.

Display Settings

  1. The number shows which NXT sensor port used for the Matrix Controller.
  2. The number shows the Matrix Motor port for the left motor. Note that the ‘i’ indicates the motor direction is being inverted.
  3. The number shows the Matrix Motor port for the right motor.

 

Configuring the Matrix Move Block

  1. hoose the NXT sensor port that is used for the Matrix Controller.
  2. Choose the Motor port for the left driving motor of the robot.
  3. Choose the Motor port for the right driving motor of the robot.
  4. If the motor direction needs to be inverted in order for the motor to drive forward, then check the Inverted check-box.
  5. Use the Steering slider to adjust the Steer angle that is shown here. Note that 0 corresponds to going straight and the positive steer angle will make the robot turn right and a negative steer angle makes the robot steer left. The configuration panel allows you to set the steering angle in 10 degree increments.
  6. These two number boxes indicate the result motor speeds based on the Steer Angle and the Speed settings of the configuration panel.
  7. Use the Slider or the number box to set the speed of the motors. The value range is from -100 to 100 where a negative value indicates reverse direction. Click on the stop sign to quickly adjust the speed setting to 0.
  8. Set the Duration action for the block:
    1. Unlimited – Set the speed of the motors and then go on to the next block in the program.
    2. Use Slew to Position – Use the Slew to Position feature of the Matrix Controller to drive the motors the amount specified by the numeric input. Note that the actual amount driven corresponds to the outside motor if the robot is steering.
    3. Until Change – Drive the motors until the outside motors has driving the amount specified by the numeric input.
    4. Time (seconds) – Drive the motors the specified number of seconds.
  9. For Use Slew to Position and Until Change, the numeric input can be in either encoder ticks, degrees or rotations.
  10. Specify the Next Action that should take place after Until Change and Time (seconds).
    1. Stop(Speed = 0) – This will stop the robot before going on to the next block in the program once the robot has driving the specified amount or time has passed.
    2. Keep Motors Running – This will leave the motors running after the motors have driven the specified amount or time has passed. This is useful when you know that there will be another Matrix Move block in the program and you want a smooth transition from one block to another.

Using the block for Dead Reckoning

The block can be used with the Duration settings of either Use Slew to Position or with Until Change to drive a certain distance. Use Slew to Position uses the controllers ability to drive the motors to an exact target position. This will be the most accurate but will make the robot stop in between Move blocks. If you want smooth transitions from one Matrix Move block to another, then set the Next Action to “Keep Motors Running” and use either Until Change or Time (seconds) to determine how long the motors should run before going to the next block in the program.

Feeding the Watchdog

The Matrix Controller has a safety feature built-in called a watchdog that automatically deactivates the motors and servos if no command is received from the NXT for more than two seconds. This is designed to prevent run-away-robots after a program stops running. If your program needs the Matrix controller to remain active even when there are no motor or servo commands, then you will need a watchdog feeder. A simple way to do this is with a separate sequence beam going to a Wait block with the sensor set to Matrix Controller Status.

In this sample, the selected Wait block acts like a watchdog feeder keeping the Matrix Controller active while the program “waits” for the Touch Sensor to be pressed. Without the watchdog feeder, the motors will stop after two seconds even if the touch sensor bas not been pressed.

The Steering Angle

The Steering Angle determines how the robot steers while driving. The steering angle value is in degrees and in the range -90 to 90. A steering angle of 0 will make the robot drive straight while a positive value will make it steer right and negative steer to the left. To understand the steering value, imagine that the robot has a virtual front wheel that ‘steers’ the robot like a tricycle. The three wheels, the two actual driving wheels and the imaginary front wheel, are laid out like an equilateral triangle each wheel the same distance from each other.

This table shows some examples steering angles and the effect of the speed on the driving wheels given an overall speed setting of 100

Steering Angle Left Speed Right Speed Description
-30 50 100 Robot will turn to the left with the left wheel turning at half the speed of the right wheel.
0 100 100 Robot will drive straight with both left and right wheel going the speed setting forward.
30 100 50 Robot will turn to the right with the right wheel turning at half the speed of the left wheel.
60 100 0 Robot will pivot around the stopped right wheel with the left wheel turning at the speed setting.
90 100 -100 Robot will spin in place with the right wheel turning in the opposite direction to the left wheel at the speed setting.

Matrix Move block Data Hub plugs

Clicking on the bottom edge of the block will fully open the Data Hub as shown.

 

  1. This plug wires the port number for the NXT Port used for the Matrix Controller.
  2. The Left Motor number from 1 to 4 if normal direction and 5 to 8 (motor number plus 4) if the motor direction is inverted.
  3. The Right Motor number from 1 to 4 if normal direction and 5 to 8 (motor number plus 4) if the motor direction is inverted.
  4. The Steering angle from -90 to 90.
  5. This plug specifies the Speed from -100 to 100. Use a positive number to go forward and a negative number to go backward. Use 0 to stop.
  6. This plug specifies the Duration setting of the block: This plug is the Input value for use with the duration. Note that for Use Slew to Position and Until Change this value is in motor encoder ticks (approximately 752 per rotation) and if the duration is Time then the value is in milliseconds.
    1. Unlimited
    2. Use Slew to Position
    3. Until Change
    4. Time (seconds)
  7. This plug is the Input value for use with the duration. Note that for Use Slew to Position and Until Change this value is in motor encoder ticks (approximately 752 per rotation) and if the duration is Time then the value is in milliseconds.
  8. This plug can specify the Next Action used by the block:
    1. Stop (Speed = 0)
    2. Keep Motors Running

Basic Line Tracking

Here is a basic, low speed, line tracking program. The program uses a LEGO Light sensor but you can also use a LEGO Color Sensor or a HiTechnic EOPD sensor. The program uses the sensor to determine the position over the edge of the line and then adjusts the steering on the Matrix Move block to steer toward the edge.

Note that the program will need to be adjusted based on the sensor used and the position of the sensor on the robot. The sensor should be 3 to 4cm from the surface in order to get gradual proportional reading to determine the postion. The subtraction block should subtract a value that is halfway between the max and min of the sensor range. The multiply block should scale this result to make it suitable for steering. If the line does not have sharp turns, then a smaller scaling factor may be possible allowing the robot to go faster. If the line has sharp turns then a lower speed will ne needed as well as a higher scaling factor to make the robot turn sharper when off the edge of the line.

Matrix Move Servo Block

Use this block to control the servos that are connected to a Matrix Controller. The block lets you control a single servo or any combination of servos with a single block. With one block you can either enable or diable any servo and, if the servo is enabled, specify the target postion and the speed setting for the servo.

Display Settings

  1. The number shows which NXT sensor port is used for the Matrix Controller.
  2. The numbers on the bottom of the block show which servos are being enabled or diabled by this block. If a servo number is not shown, then that servo is not being changed by this block. If servo number is in red, then the servo is being disabled by this block.
  3. The four data plugs shown are for setting the servo positions. Note that to control a servo you must also enable the servo in the configuration panel or by setting the proper bits in the Enbable input.

 

 

Configuring the Matrix Move Servo Block

  1. Choose the NXT sensor port that is used to connect to the Matrix Controller.
  2. For each servo, specify if you want to enable or diable the servo. If neither enable or disable is selected, then the servo status, postion, and speed are unchanged.
  3. For each servo, specify the target postion in the range of 0 to 255. The default value is 128 and is approximatly in the middle of the mechanical range of the servo.
  4. For each servo, specify the speed, a value from 0 to 10, the servo should use to reach the target postion. With a speed setting of 10 the controller will immediatly move the target to the specified position. At other speeds, the controller the gradually move the servo toward the target position at a rate proportional to this setting.

When building a servo into a model, make sure that the middle position of the servo range is an acceptable position for your servo mechanism to avoid damage to both the servo and your model. When servos are first powered, they will momentairily travel to the default middle position. To adjust the servo position you will need to use a screw driver to loosen the servo horn and then manually position the horn on the servo. Once the servo horn is positioned so that the middle of the servo matches the middle position of your mechanism, secure the horm with the screw and lock washer.

Working with a single servo

In the configuration panel, check the Enable for the servo you wish to control. If setting the servo to a fixed position, set the servo position using either the slider or the number box. If you wish to make the servo move slowly toward the target position, set a speed value less than 10. For example, this configuration will enable servo 3, set the target position to 100, and use the maximum speed of 10:

Working with multiple servos

To control multiple servos, you can either use one block per servo or control multiple servos with a single block. To control multiple servos, check Enable for all servos you wish to control and specify a target position for each servo either with the configuration panel or with a data wire.

Disabling servos

Sometimes it is desirable to disable a servo that you no longer want to control. Once disabled, the servo no longer attempts to stay at the target position and can be moved by external forces.

Matrix Move Servo Data Hub plugs

Clicking on the bottom edge of the block will fully open the Data Hub as shown.

  1. This plug wires the port number for the NXT Port used for the Matrix Controller.
  2. This plug specifies which servos to enable. This value is a 4 bit value in the rage of 0 to 15 where each binary bit represents one servo. For example, to enable servos 1 and 2 then the value should be 3 (binary 0011).
  3. This plug specifies which servos to disable. This value is also a 4 bit value from 0 to 15 similar to the enable value.
  4. This plus specifies the target postion of servo 1 (if enabled). This value is in the range of 0 to 255.
  5. This plug specifies the speed setting of servo 1 in the range of 0 to 10. A speed if 10 is the maximum speed and the controller will move the servo target immediately to the specified target.
  6. This plus specifies the target postion of servo 2 (if enabled).
  7. This plug specifies the speed setting of servo 2 in the range of 0 to 10.
  8. This plus specifies the target postion of servo 3 (if enabled).
  9. This plug specifies the speed setting of servo 3 in the range of 0 to 10.
  10. This plus specifies the target postion of servo 4 (if enabled).
  11. This plug specifies the speed setting of servo 4 in the range of 0 to 10.

Sample Program

This program uses an NXT motor connected to motor port A to control the position of servo 1 on the Matrix controller.

The first block is a LEGO Rotation Sensor block to read the NXT motor encoder. The second blocks takes the value and adds 128 so that the initial target position will be in the middle of the servo range. The third block enables servo 1 and sets the target position based on the motor encoder position. When you run this program you can control the servo postion by manually turning a wheel attached to the motor.

Matrix Motor Status Block

This block reads the encoder value of a Matrix Motor. Specify the sensor port used for the Matrix controller, the motor port, and the invert direction status. Use a data wire to read the encoder value in encoder ticks or compare the encoder value with a trigger point in either encoder ticks, degrees, or rotations and get a logic (true/false) result.

Display Settings

  1. The number shows which NXT sensor port used for the Matrix Controller.
  2. The number shows the selected Matrix Motor port. Note that an ‘i’ would indicate the motor direction is being inverted.
  3. This output is the Logic (True/False) result of the comparison.
  4. This output is the motor encoder position in encoder ticks.

 

 

Configuring the Matrix Motor Status Block

  1. Choose the NXT sensor port that is used for the Matrix Controller.
  2. Choose the Motor port.
  3. If the motor direction is being inverted, then check the Inverted check-box.
  4. To Reset the motor encoder to 0, check Reset Encoder.
  5. Select the comparison operation:
    1. <    Output will be True if current encoder position is less than the input value.
    2. >    Output will be True if current encoder position is greater than the input value.
    3. Not Busy    Output is True if motor is NOT in the middle of a Slew to Position operation. Use this to see if a Slew to Position operation has completed.
  6. This is the trigger point input value for use with the comparison. This value can be in three possible units:
    1. Enc. Ticks    Raw motor encoder ticks are approximately 752 per rotation.
    2. Deg.    Degrees are 360 per rotation.
    3. Rot.    Rotations.

Embedding in Wait, Switch, or Loop

The Matrix Motor Status block can be used within a Wait, Switch, or Loop. To embed the block add a Wait, Loop or Switch to your program and then select Matrix Motor Status as the sensor.
When used in a Wait or a Loop, the block has two additional comparison options:

  1. Change >    Wait or Loop until the encoder value has changed by an amount greater than the input value.
  2. Stalled    Wait or Loop until the motor position is stalled, in other words not moving.

For example, if you want to use a Wait to wait for the Matrix motor to run for 4 rotations, you can use a Wait configured like this:

This Wait will wait for the Matrix Motor position to change by at least 4 rotations before continuing to the next block in the program. Note that this motor change can occur in either direction.

Matrix Move block Data Hub plugs

Clicking on the bottom edge of the block will fully open the Data Hub as shown.

  1. This plug wires the port number for the NXT Port used for the Matrix Controller.
  2. This plug wires the motor port on the Matrix Controller. This value is normally from 1 to 4 but if the motor direction is inverted then the value should be plus 4 (motor value from 5 to 8).
  3. The Comparison options are:
    1. <
    2. >
    3. Not Busy
  4. This plug is the Input value for use with the comparison. This value is in motor encoder ticks (approximately 752 per rotation).
  5. Reset    Set to True to reset the motor encoder position.
  6. Yes / No Output    This is the result of the comparison operation.
  7. Motor Encoder position in encoder ticks.

Matrix Controller Status Block

This block gets status information from the Matrix Controller. Specify the sensor port used for the controller and use a data wire to read the battery level or to check for a low battery or a fault condition. Use as part of a Wait block in a seperate sequence beam to use as a watchdog feeder.

 

Display Settings

  1. The number shows which NXT sensor port used for the Matrix Controller.
  2. This output is the Logic (True/False) result of the comparison.

 

 

Configuring the Matrix Controller Status Block

  1. Choose the NXT sensor port that is used for the Matrix Controller.
  2. Check if you want to change the watchdog timeout setting for the controller.
  3. If changing the timeout setting, set the new timeout value here in seconds.
  4. Select the comparison operation:
    1. Low Battery or Fault    Output will be True if controller status indicates there is either a Fault or a Low Battery condition.
    2. Fault    Output will be True if Controller status indicates there is a Fault.
    3. Low Battery    Output will be True if Controller status indicates there is a Low Battery condition.

 

Feeding the Watchdog

The Matrix Controller has a safety feature built-in called a watchdog that automatically deactivates the motors and servos if no command is received from the NXT for more than two seconds. This is designed to prevent run-away-robots after a program stops running. If your program needs the Matrix controller to remain active even when there are no motor or servo commands, then you will need a watchdog feeder. A simple way to do this is with a separate sequence beam going to a Wait block with the sensor set to Matrix Controller Status.

In this sample, the selected Wait block acts like a watchdog feeder keeping the Matrix Controller active while the program “waits” for the Touch Sensor to be pressed. Without the watchdog feeder, the motors will stop after two seconds even if the touch sensor bas not been pressed.

Matrix Move block Data Hub plugs

Clicking on the bottom edge of the block will fully open the Data Hub as shown.

 

  1. This plug wires the port number for the NXT Port used for the Matrix Controller.
  2. This plug wires the new TimeOut value if you wish to change the timeout value on the controller.
  3. The Comparison options are:
    1. Fault
    2. Low Battery
    3. Low Battery or Fault
  4. This gives the output status value from the controller. This value is normally 0.
    Status Value Description
    0 Normal operation
    1 Indicates a Fault state on the controller
    2 Indicates a Low Battery condition of the external battery pack
    3 Indicates both a Low Battery and a Fault state
  5. Battery Level of external battery pack in millivolts.
  6. Yes/No result of the comparison

adidas yeezy boost v3 shoe adidas yeezy boost v2 shoes adidas yeezy boost 350 v3 shoe adidas yeezy boost 350 v2 shoes adidas yeezy boost 350 v2 black red adidas yeezy boost 350 v2 black white adidas yeezy boost 350 v2 triple white adidas yeezy boost 350 v2 cream white adidas yeezy boost 350 v2 black adidas yeezy boost 350 v3 grey adidas yeezy boost 350 v3 yellow