ENGINEERING DESIGN LAB II ENGR-102 WINTER 2015 WEEK 4 LECTURE – ROBOT MODULE LAB WEEK 4 – GRIPPER DESIGN DESIGN PROPOSAL NOTES PROGRAMMING EXAMPLES USING NXC 1 Pramod Abichandani, Ph.D. Richard Primerano, Ph.D. WEEK 3 LAB Design a robot that will move toward the light source in one corner of the arena Determine how best to place the light sensor Characterize the light sensor’s directionality Develop an algorithm that will allow the robot to detect and move toward the light 2 THE NXT LIGHT INTENSITY SENSOR The light sensor measures the intensity of light that strikes the sensing element. It can be operated with its integral light source on or off With light source turned on, the sensor can be used to detect the presence of an object by shining light on the object and measuring light reflected by it. With light source turned off, the sensor can be used to measure ambient light. 3 Reflected light (light source on) Ambient light (light source off) LIGHT SENSOR CALIBRATION The light sensor produces a voltage output that varies from 0V to 5V depending on the amount of light being received. The NXT converts this voltage to a number ranging from 0 to 100. How can we associate a numerical value from the NXT with a target color (or ambient light level)? Black target NXT reads 13 White target NXT reads 80 4 SOURCES OF ERROR WHEN USING THE LIGHT SENSOR If used to detect objects (in reflected light mode), the sensor can be fooled by ambient light. Object detected False detection caused by bright ambient light Typically, a sensor would be shrouded to block ambient light or a modulated light signal would be used to reject ambient light. 5 INSIDE THE NXT LIGHT SENSOR Phototransistor (sensor) NXT connector Red LED LED on/off control Sensor amplifier 6 SHROUDING THE LIGHT SENSOR The light sensor can not determine the difference between ambient light and the lighthouse Shrouding can help block ambient light and improve sensor performance Ambient light Lighthouse unshrouded shrouded 7 MOUNTING AND ALIGNING THE SENSOR If the sensor is not aligned correctly, it will not ‘see’ the lighthouse correctly. Shrouding the sensor makes it more sensitive to misalignment. proper alignment misaligned misaligned 8 SENSOR FIELD-OF-VIEW The shape of the shroud affects the sensor’s fieldof-view. long shroud short shroud 9 THE DIRECTIVITY OF SENSORS With sensor at a fixed position, a light source is moved in a circular path around the sensor At points along the path, we stop and record the light sensor’s output. 10 MOVING TOWARD THE LIGHT SOURCE Most techniques will involve these steps 1. 2. 3. Search for light source Move in the direction of the light source If the light source is lost, search again and go to 2 Things to consider How do you determine if the robot is looking at the light source or away from it? How will the robot respond if the light source becomes blocked (by the other robot)? How does the directionality of the sensor affect the robot’s performance? 11 EFFECT OF SENSOR FIELD-OF-VIEW What are the tradeoffs in sensor field-of-view selection? 12 REVIEW OF ROBOT CHALLENGE A derailed train has derailed, scattering trash and nuclear waste in an area. A consulting firm has issued a call for companies to submit designs and prototype robots capable of cleaning the affected area. Your group is to submit a design and compete against other groups in receive the contract. 13 THROUGH WEEK 3 OF LAB… Touch, ultrasonic, and light sensors use Basic movements hardcoded into the robot Light seeking behavior programmed For the competition, you will need to detect and avoid other robots and the arena fence detect contact between robot and trash/nuclear detect and move toward light source You should be thinking of how to integrate the week 1-3 (and week 4) materials into your challenge robot 14 WEEK 4 15 TEAMWORK EVALUATIONS Due this week This is meant mainly to help us identify potential teamwork issues and is not the only factor in deriving teamwork scores If you are having any issues with team members, please let us know ASAP (don’t wait for evaluations). 16 DUE NEXT WEEK Design Proposal See proposal template Signoff sheets Lab notebook pages from weeks 1-4 See journal guidelines 17 BEFORE ARRIVING TO LAB IN WEEK 4 Begin building your robot You don’t need a completed robot at this point This should act as a chassis for your gripper Before you begin, you should have a general idea of how you intend to construct your competition robot. Sensor placement Gripper placement Bumpers 18 ADDITIONAL NON-KIT BUILDING MATERIALS ALLOWED Paper, cardboard, foam core Tape, hot glue Rubber bands, string, copper wire Ping-pong balls, drinking straws Other Lego pieces, excluding additional sensors or motors Your robot must fit in a 1’ x 1’ x 1.5’ box, any orientation, at the start of the competition. 19 WEEK 4 LAB Design a mechanism that can capture waste objects in the arena and move them to a desired location There are no restrictions on how you do this Drag, lift, etc… In subsequent weeks you will need to determine if the object is trash or nuclear by buzzer, color, magnetism, or other means. 20 CANISTER CONSTRUCTION Each canister is made from 2.5” PVC end caps Nuclear canisters Yellow colored Magnetic Trash canisters Blue colored Nonmagnetic 21 KNOW THE COMPETITION RULES Read the Robot Module Week 7&10 Lab Writeup Unintentional Delivery (score not affected) A robot moving in reverse or rotating pushes a canister into the drop-off area A robot moving forward pushes the canister a distance of less than 1 foot without capturing the canister (up to referee’s judgment) Intentional Delivery (score affected) A robot transporting a canister any distance using its intended transport mechanism (e.g. a plow bumping the canister into the drop-off area) A robot pushing a canister a distance of 1 foot or more while moving forward (up to referee’s judgment). 22 ROBOT DESIGN PROPOSAL Should contain the following Summary of the design constraints under which you must design your robot Detailed description of your intended robot design Hardware design: sensor placement, mechanism design Algorithm design: behavior of robot Include any sketches, pictures, calculations relevant to your design 23 ROBOT DESIGN PROPOSAL Should be comprehensive in addressing all of the required “basic behaviors” listed in the robot competition guidelines Canister search Gripper design Canister delivery Object avoidance You must indicate the sensors that will be used for each behavior 24 BEGIN DOCUMENTING STRATEGY Before leaving lab this week, you must document and discuss with your instructor The design of your robot: sensor placement, gripper design The strategy your robot will take, including any defensive/negative strategies The algorithm your robot will follow Note: your robot must be designed to avoid contact with the walls of the arena and other robots The robot should detect and avoid the fence when approaching head-on There will be cases when these obstacles are in the robot’s blind spot and collisions do occur 25 THINGS TO CONSIDER Collisions will most likely occur. Design your robot with this in mind (bumpers maybe?). There are only four sensor ports on the robot. When thinking about your robot design, keep this in mind Can one sensor provide multiple functions? Consider defensive strategies. How can you keep your opponent from scoring points? You can’t damage the other robot 26 DUE NEXT WEEK! Design Proposal Discuss the basic design of the robot Physical/mechanical Sensing Algorithms Follow the template provided! First notebook check You should have a minimum of 15 page at the end of the project Document all experimental data, mechanism sketches, pseudo code, etc… 27 PROGRAMMING ALTERNATIVES THE LEGO NXT-G ENVIRONMENT Uses graphical programming Blocks are placed and wired together to make program Requires no prior programming knowledge Can be limiting for those with prior programming knowledge This is the ‘official’ programming alternative supported through our course. Additional/Advanced NXT-G Tutorials: http://www.stemcentric.com/nxttutorial/ 28 PROGRAMMING ALTERNATIVES NXC WITH BRICX COMMAND CENTER C-like syntax, more appropriate when writing complex code. Some prior programming knowledge is recommended Software is provided on lab computes and is free to install We offer this as an ‘unofficial’ option this year. No formal support is offered through the course but we will help when we can. Tutorial http://bricxcc.sourceforge.net/nbc/nxcdoc/NXC_tutorial.pdf 29 PROGRAMMING EXAMPLES USING NXC Basic motor control 30 PROGRAMMING EXAMPLES USING NXC Using #define to clarify your code 31 PROGRAMMING EXAMPLES USING NXC Declaring variables Random number generation 32 PROGRAMMING EXAMPLES USING NXC Using conditionals 33 PROGRAMMING EXAMPLES USING NXC Reading sensor data 34 PROGRAMMING EXAMPLES USING NXC Using subroutines 35 THANK YOU 36