More LEGO by yurtgc548


									  More LEGO
     Mark Green
School of Creative Media
 Now  that we know the basics its time to
  look at putting some robots (or toys)
 Look at how we can put theory into
 A few examples to get you thinking about
  things that you could build
               New Tippy
 Our  tippy robot didn’t work very well
 By braking after each collision it
  responded better, but it still kept bumping
  into things
 It would be better if the robot turned before
  it can into things
 This means we have to know when
  something is in front of us
             Light Sensor
 We   can use the light sensor for this
 The light sensor measures the amount of
  light that it receives
 When we are close to an object, light will
  reflect off of it from the LED
 Remember the light sensor has a red LED,
  this serves as a light source
 Lets see how this works
             Light Sensor
 The   light sensor measures the amount of
  light it receives
 With nothing in front of the robot, this is
  just the room’s light level
 Assume that the room is relatively dark, so
  this light level will be fairly low
 When we get close to an object, the LED
  will reflect off it giving a higher light
              Light Sensor
 To  see how this works I put together a
  simple program that reads the light sensor
  and displays the value on the RCX display
 Start with a light sensor, set its range to 0
  to 100, the full range of the light sensor
 Use a display value block to show the
  value of the light source on the RCX
Light Sensor Program
             Light Sensor
 With  this program running I walked around
  the room and noted the light values
 Most of the time the light was in the low
  30s or less
 When I got close to an object it was in the
  high 30s or even the 40s
 By looking at the light sensor value we can
  see if we are close to an object
               New Tippy
 This  suggests a new Tippy robot
 I remove the touch sensor, since we don’t
  need it now
 I added a plate to the top of the RCX
  extending out the front
 The light sensor is attached to this plate,
  so it is in front of the rest of the robot
New Tippy
               New Tippy
 The   light source tells us when we need to
  avoid a collision
 When the value is greater than 35 there is
  likely to be a collision
 In response we could do the same thing
  as in the previous program
 Back up, turn a bit, and then go forward
  again, this will work
                New Tippy
 With the light sensor we can do a lot better
 The light sensor value tells us if there is an
  obstacle in front of us
 We can turn until there are no obstacles
 We can turn until the light sensor has a
  normal value
 In our case we turn until the light sensor is
  33 or less
New Program
                 New Program
 When     the light value is greater than 35:
     The robot stops
     It moves backwards for 0.5 seconds
     It turns until the light value is less than 33
A  repeat block is used to turn until the light
  value is less than 33
 We could also use a wait-for block to do
  the same thing
     robot produces more interesting
 This
     It stops and turns before it runs into things
     It turns until it will avoid obstacles, it doesn’t
      go smashing into another object because it
      didn’t turn enough
 This makes the robot look more intelligent,
 and it doesn’t come apart from crashing
 into things!
              Mobile Platform
 The next example is motivated by several
     A one motor motion platform, can use the
      second motor for other actions
     A platform for a small mobile camera, a
      wireless security camera ($250 at a stall in
      Temple Street), runs on a 9 volt battery
 Produce     a simple platform of the camera
           Mobile Platform
 Aim  is to have robot wander through room
  collecting video
 The video will then be used as a video
  texture in our VR system
 A way of importing the real world into a VR
 Would like to have the camera rotate as
  the robot moves
            Mobile Platform
 Need   to be able to go forward and turn
  with a single motor
 Know that we need a differential to do this,
  but haven’t really tried it yet
 Start investigating some designs that will
  do this for us
 Start by fitting a motor and differential onto
  a simple 4 wheel frame
                 First Try
 Firsttry is long and thin
 The motor and differential are at the back
  of the robot
 The RCX and light sensor are at the front
  of the robot
 Does a good job of going forward, but
  doesn’t turn (more on this later)
                   First Try
 Aim  of the first try is to get the differential
  right, then worry about turning and other
 Need a crown gear on the motor to
  change direction of rotation, motor is
  aligned along the long axis of the robot
 But, cannot connect the crown gear
  directly to the differential, motor is too
                 First Try
 Need   to put another gear in between to
  get enough room for the differential to turn
 Also need to ensure that all the gear line
  up correctly
 If everything isn’t aligned correctly and
  solid the differential won’t work, the wheels
  won’t spin
 I had several versions of this mistake
First Try
First Try
First Try
                 First Try
 After several attempts the first version was
 Need to be careful to have all the gears
  and differential solidly in place, no
 Positioning the ratchet was a bit difficult
  since the differential was right at the back
  for the robot
                 First Try
 Used  the Tippy2 software to test this robot
 Without the ratchet the robot goes
  forwards and backwards quite well
 Need to have a smooth surface
 With ratchet the robot can’t turn!
 The one rear wheel stops spinning, but the
  other one just spins in place
 What went wrong??
                First Try
 Allour previous robots had two wheels
  and this turning approach worked okay
 The new robot has four wheels
 The two front wheels prevent the robot
  from turning
 We can’t do this with a four wheeled robot,
  we need another design
 Don’t want to use two wheels if we can
  avoid it
              Second Try
 There  needs to be some way of turning
  the robot
 Remove the two front wheels, they prevent
  the turning
 Replace them with a caster wheel, a wheel
  that can rotate about the vertical axis
 Now the front of the robot can spin, so it
  can make a turn
              Second Try
 The  caster wheel makes the front of the
  robot quite high
 Replace the two small back wheels with
  the largest wheels
 This raises the back end so the robot is
  almost level
 Also gain some room to reinforce the
  motor on the bottom
Second Try
Second Try
Second Try
 Time  to modify the software
 Since the wheels are bigger, this robot
  goes faster than the previous one
 Set the power level to 6, so it goes a bit
  slower in the forward direction
 In reverse the power level is set to 8, this
  helps it turn the caster wheel
 The   light sensor is a bit simpler since there
  is only one motor to control
 It now plays a tune while it is trying to turn,
  this is a helpful debugging aid, know when
  the robot has got itself stuck
 Software is still fairly simple
 Still doesn’t quite work the way I want it to
 It now turns quite well, even when it is
  moving forward
 The caster wheel tends to turn when
  moving forward, giving some interesting
 Still have trouble turning when backing up
 If caster wheel is pointing straight forward
  it is hard to turn
 But,  the backward turn works at least part
  of the time, and the robot doesn’t get stuck
  as often
 New problem, the robot tends to tip over
 The front wheel doesn’t give it enough
  stability, so it sometimes turns over when
  it hits an obstacle
 This is not particularly good
            Possible Solution
 Instead   of using wheels we could use
 This will provide more stability, don’t need
  to worry about the robot tipping over
 Not sure if the differential is strong enough
  to drive the tracks, may not work
 We have something that sort of work,
  maybe look at this approach later
             Camera Brick
 We   want to attach the camera to the robot,
  how are we going to do this?
 We want the camera to be a LEGO block,
  but it really isn’t
 Would like to fit it onto a model like any
  other LEGO brick
 Need a mechanical interface between the
  camera and LEGO
                Camera Brick
 Thereare several ways that we could
 approach this problem:
     Tape the camera to a LEGO brick, this would
      work, but its not too stable
     Drill a hole through a LEGO brick and attach
      the camera to it, this destroys a brick if it
      doesn’t work
     Make a frame for the camera out of LEGO
      blocks, camera may not be the right size for
            Camera Brick
 The   bracket on the bottom of the camera
  has three holes
 These holes line up with the holes in beam
 One of these holes is large enough for an
  axle, so the first solution was to put an
  axle through the hole and beam and
  fasten it
 This sort of worked, but the camera could
  still move around a lot
             Camera Brick
 After some experimentation, the best
  solution was found to be a twist-tie
  threaded through the other two holes
 These holes are quite small, so this is one
  of the few things I could find that would go
  through them
 Doesn’t look pretty, but we know have a
  camera attached to a LEGO beam
            Camera Brick
 One  problem left, the beam is facing
  sideways so it can’t be attached to other
 This doesn’t help us, we need to attach
  the camera to our robot
 This can be solved using a 2x2-2x2 angle
  bracket (there are two in the Mindstorms
             Camera Brick
 The  bracket is attached to the beam, and
  then a standard 2x2 brick is attached to it
 This provides a little stand for the camera
  and it can now be attached to the top of
  the RCX
 We now have our robot mounted camera,
  but does it actually work??
Camera Brick - Front
Camera Brick - Back
 Well it sort of works, which is a bit of a
  surprise to me
 The robot moves too quickly and tends to
  get stuck
 Video image fades out if it gets too far
  from the receiver
 But we have a good proof of concept
 Fuzzy image taken from TV
                  Future Work
 It   would probably work better with tracks
      Use a lower speed, images won’t change so
      It will be more stable, less chance of it falling
      With slower speed it will react to obstacles
       better, be able to avoid them before collision
      Important to brake before changing directions,
       gears behave better

To top