robotics overview of nxt-g actuators in mindstorms. touch sensor labwork: right turn. touch/bump....
TRANSCRIPT
Robotics
Overview of NXT-GActuators in Mindstorms.
Touch sensor Labwork: Right turn. Touch/bump. [Explore move versus Motor Move mini & motor mini. Motor*.]Add bumper and program move to (gentle) stop.
Homework: Postings.
Mechanics readings
• What did you learn?
Mindstorms terms
• NXT-G refers to iconic language– NXT-G programs are compiled (translated)
into [what is termed] byte code and downloaded to
• NXT Brick, which holds – a 32-bit microprocessor (little computer)
• 32 bit refers to size of data handled by microprocessor
– memory for programs + system routines + sound + startup/demo programs
Actuators
• Multiple blocks for connecting to motors– Motor vs Move differ as to what the
programmer does versus built-in controls– Motor*, etc. used for other motors, sensors,
etc., including hardware from older Lego products
• Legacy
– “mini” blocks later addition• Produces smaller code• Some reduction in function
Note
• Up to you (robot builder) how the motor is attached– What port
• And what the motor is attached to…– Wheel– Grabber– ?
• And direction
Move block• Set synchronized movement of 1 to 3 motors
(usually 2)– Forward, backward, or specified degree of turning
• Units can be – time (in seconds)– Rotations or degrees– Unlimited
• Something else, a subsequent block, puts on the brakes
• Set to brake or coast (if not unlimited)• Move will make sure to go exactly the rotations
specified by control of motor.– Contrast with the motor blocks in which you the
programmer specify ramping….
Defaults
• Note for all blocks: default settings– Which port for motors (default B and C)– Specific ports for each sensors– Default rotation versus others– Default power– Default: brake versus coast– other
Move block: data links: can set values and/or transmit values to subsequent blocks
Left motor (port)Right motor (port)Other motor (port)Direction (forward/backward)SteeringPowerDurationNext action
Move mini block
• Must use exactly 2 motors
• Otherwise, reportedly produces smaller programs on the NXT brick.
• NOTE: reports that using different blocks produces larger code– So…use just move mini, not move mini, move
and motor, if possible– Worry about this only if you need to…
Motor block
• Specify movement of one motor
• Power
• Duration
• Action: constant or ramp up to set speed or ramp down to stop
• Specify wait for completion or go on to next block
• Brake or coast
Changed settings
Motor mini block
• Appears to be identical functionality
• Claimed to produce smaller code
Wait blocks
Wait for something to happen
In programming language: event driven or event based programming
NXT-G: program will wait for the indicated condition.
Default assumption is port 1. You can change this.
Basic bumper exercise
• Use directions to build a bumper: a flexible piece that when it hits something, the touch sensor is pressed– coupled
Program: move until bumper hits
• Move block (forward, unlimited)
• Wait until touch block (press)
• Move block (stop)
Lab
• Change name
• Program right angle move/spin (left and right)
Lab
• Add bumper sensor– Move until bump, back up, turn slightly, move
again… • Need to look up Loop block
– Loop fixed number of times OR– Loop forever
[Exercises]
• Replace move blocks with move mini blocks. Download new program (different name)
• With the robot connected, check size of the two programs.
Classwork/Homework
• Invent application involving bump/touch sensor
• Postings