Animated VEX IQ Clawbot IQ Instructions
ROBOTC Intermediate Programming with the VEX IQ
Getting Started
If you are having problems with your robot follow these steps:
1. Check your program to be sure that you are using the correct pragma statement and check the Motors and Sensor Setup to be sure you have selected the Clawbot IQ with Sensors
2. Unplug the USB cable and plug it in again
3. Turn off/on your robot
4. Remove then replace the battery
5. Download the Firmware
6. Run the VEXos Utility
7. Ask Mr. Merrill for help
Setup
1. About VEX IQ
A1: Watch Video (Show Mr. Merrill that you answered the questions on your computer)
2. Updating VEX IQ System Firmware SKIP THIS SECTION
3. Downloading ROBOTC Firmware
A1: Turn on Clawbot
A2: Download ROBOTC firmware
A3: Turn off Clawbot
A4: Remove battery from the Clawbot
Getting Started (Physical Robot)
1. Opening a Sample Program
A1: Save the sample program movingforward.c to your period folder
A2: Open the program MovingForward.c from your period folder
2. Download and Run (Physical)
A1: Download and run the program MovingForward.c on the Clawbot at your computer tethered and on top of a cube to prevent movement (Ask Mr. Merrill for a cube)
A2: Run the program MovingForward.c on one of the competition tables.
3. Motors and Sensor Setup (Physical)
A1: Edit the motors shown in the video (Motors 1, 12, 6, & 5) and rename or name them accordingly
Under Construction: Not Available Yet
Getting Started (Virtual Robot)
1. Opening a Sample Program
A1: Open the program MovingForward.c from your period folder
2. Download and Run (Virtual)
A1: Login as Guest and show Mr. Merrill you have opened the program.
A2: Run the program MovingForward.c on the virtual robot using the First Program
3. Motors and Sensors Setup (Virtual) SKIP THIS SECTION
4. Camera Controls in the Virtual Worlds
A1: Move the camera so you can see the front of the Clawbot
5. Measurement Toolkit
A1: Create three measurement points and delete them individually using the First Program
Motion
Basic Robot Motion
1. Robot Configuration SKIP THIS SECTION
2. Basic Robot Movement and Mini Challenges
A1: Create and save the program ForwardandBackward.c in the appropriate period folder on the desktop
A2: Run the program ForwardandBackward.c on the physical robot. Robot travels forward and backwards
A3: Try It 1! Modify the parameters of the program ForwardandBackward.c so that the robot goes forward by 3 seconds and backwards by 720 degrees
A4: Try It 2! Follow the instructions to produce an error in your code and attempt to download the program to your robot. Make a yellow error and a red error.
A5: Mini Challenge 1: Power vs. Distance Open the file labeled Mini Challenge PDF copy and complete the chart shown. Create and run the program PowerVDist.c on the physical robot. Measure the distance traveled using 4 different speeds (25, 50, 75, & 100) three different times. Use 3 rotations as the distance the robot will move.
A6: Mini Challenge 2: Wind Sprints Level 1 Create and run the program WindSprintsLv1.c on the physical robot. (Ask Mr. Merrill to assign challenge A, B, or C)
Moving the Arm
1. Robot Configuration SKIP THIS SECTION
2. Arm Control and Mini Challenges
A1: For this section you will need to move the claw arm, and at certain times you may feel like you want to move it by hand. DO NOT MOVE THE CLAW BY HAND! You can damage the motor. Instead you will need to use two program that will move the claw up or move the claw down. The two programs are below and you will need to download them to your period folder.
Claw Down Program Claw Up Program
After you click one of these, you will need to download it by pressing the downward arrow with the line underneath. You can ask Mr. Merrill, if you are having trouble.
A2: Create and run the program ArmControl.c on the physical robot. Robot arm will rise 90 degrees. By 90 degrees, I do not mean to use 90 degrees in your program. I want the arm to be pointing straight up.
A3: Modify the program ArmControl.rbc to make the robot arm rise 90 degrees and lower to its starting position on the physical robot
A4: Try It 1! Modify the program ArmControl.c to find the upper and lower limits of the arm. Be careful with this program. You could damage the motor or the robot by rotating it to far in either direction. Be sure to exit the program ( press X on the robot brain), when you see that you have rotated too far in either direction
A5: Mini Challenge 1: Wind Sprints Level 2 Create and run the program WindSprintsLv2.c on the physical robot. (Ask Mr. Merrill to assign challenge A, B, or C)
Turning
1. Robot Configuration SKIP THIS SECTION
2. Turning in Place and Mini Challenges
A1: Create and run the program TurningInPlace.c on the physical robot. The robot will rotate to the right for 2 rotations
A2: Try It 1! Create and run the program SwingTurn.c on the physical robot. Use only the moveMotor command on one motor to accomplish this maneuver.
A3: Mini Challenge 1: 90 Degree Right Turn Modify the program TurningInPlace.c to make the robot turn 90 degrees to the right.
A4: Modify the program TurningInPlace.c to make the robot turn 90 degrees to the left. (Hint: Make the motor speed negative)
A5: Mini Challenge 2: Mini Maze Create the program MiniMaze.c to make the robot navigate the maze on the virtual world. First select virtual robot in the compiler target. Under the Window tab Select Virtual World to Use as RVW Level Builder. You will need to select the Mini Maze Challenge from the VEX IQ folder in the W: drive to run your challenge.
Using the Repeat Loop
1. Robot Configuration SKIP THIS SECTION
2. Using the Repeated Loop and Mini Challenges
A1: Create and run the program MoveLoop.c on the physical robot. Test this program from the first part of the video to see if the distance and turn is correct
A2: Modify the program MoveLoop.c to perform a loop 4 times and travel around the square box
A3: Try It 1! Modify the program MoveLoop.c so that the curly brace is on the same line as the repeat text. Does it change the program?
A4: Try It 2! Modify the program MoveLoop.c so that it says "forever" inside the parentheses.
A5: Mini Challenge 1: Circle Maze SKIP THIS CHALLENGE
A6: Mini Challenge 2: Circle Maze Rewind SKIP THIS CHALLENGE
Commenting
1. Robot Configuration SKIP THIS SECTION
2. Commenting
A1: Open the program CommentDemo.c from the VEX IQ Folder on the sh110 (W:) Drive and show Mr. Merrill how to change a comment into actual code.
A2: Open the program MiniMaze.c from the previous lesson. Apply comments to the beginning of the program to describe the program in general terms. Also apply comments to each line of code to describe what happens when it is executed
A3: Mini Challenge 1: Code Exchange SKIP THIS CHALLENGE
A4: Mini Challenge 2: Time Capsule SKIP THIS CHALLENGE
Motion Capstone Challenge
1. Angular Maze Create and run the program AngularMaze.c on the virtual robot. You will need to select Browse and go to the SH110P7 W: drive, select the VEX IQ folder and select Motion Capstone Challenge. Robot should pick up the cube at the checkpoint and drop the block at the finish. You might be able to get the claw to pick up the cube but it is difficult. Don't worry if you are not able to transport the cube. You will need to figure out how to use the gripper on your robot. Start by finding out what motor controls the gripper. Below is some more information to help you control the gripper.
Sensing
Encoders
1. Robot Configuration SKIP THIS SECTION
2. Forward for Time and Mini Challenges
A1: Create and run the program ForwardForTime.c on the physical robot. Clawbot drives forward for 3 seconds and stops
A2: Try It 1! Copy the code to create the program Forward.c and run on the physical robot. Show Mr. Merrill what happens.
A3: Mini Challenge 1: Turn of Time Create and run the program TurnOfTime.c on the physical robot. Clawbot needs to turn exactly 90 degrees using milliseconds
Bumper 1. Robot Configuration SKIP THIS SECTION
Switch 2. Forward Until Touch and Mini Challenges
A1: Create and run the program ForwardUntilTouch.c on the physical robot. Clawbot will drive forward until the bump switch is pressed.
A2: Copy the following Boolean Logic Chart in your composition notebook. Do not copy the Sample Comparison or Result columns:
A3: Try It 2! Forward Until Release Create and run the program ForwardUntilRelease.c on the physical robot. Clawbot should move forward while the bumper switch is pressed and stop when it is released.
A4: Mini Challenge 1: Hub Drill Create and run the program HubDrill.c on the physical robot. Clawbot will touch all four walls and return to the center.
A5: Mini Challenge 2: Shifting Maze Hands On Create and run the program ShiftingMazeOn.c on the virtual robot. Clawbot must successfully navigate through both Shifting Maze #1 and Shifting Maze #2 found in the VEX IQ folder on the W: drive.
Distance 1. Robot Configuration SKIP THIS SECTION
Sensor 2. Move Until Near and Mini Challenges
A1: Create and run the program ForwardUntilNear.c on the physical robot. Clawbot will need to run in reverse to move forward and will stop 30 cm from the wall. For the distance sensor you must use the setDistanceMaxRange statement as the first line of code in order for it to work properly:
A2: Try It 1! Create and run the program BackwardUntilFar.c on the physical robot. Clawbot will back away from the wall and stop when it is 50 cm away
A3: Mini Challenge 1: Shifting Maze Hands Off Create and run the program ShiftingMazeOff.c on the virtual robot. Clawbot must successfully navigate through the maze without touching any walls. Clawbot must successfully navigate through both Shifting Maze #1 and Shifting Maze #2 found in the VEX IQ folder on the W: drive.
Gyro 1. Robot Configuration SKIP THIS SECTION
Sensor 2. Turn For Gyro Rotation and Mini Challenges
A1: Create and run the program TurnForGyroRotation.c on the physical robot. Clawbot will turn in place to the left for slightly more than 90 degrees.
A2: Modify the program TurnForGyroRotation.c on the physical robot to make the clawbot turn exactly 90 degrees to the left.
A3: Modify the program TurnForGyroRotation.c on the physical robot to make the clawbot turn exactly 90 degrees to the right.
A4: Mini Challenge 1 Gyro Hunt Create and run the program GyroHunt.c on the physical robot. However, do not follow the diagram pictured on the Carnegie Mellon website. Use the Angular Maze template to drive from the start and end at the finish. All turns must be made using the gyro!
Color 1. Robot Configuration SKIP THIS SECTION
Sensor 2. Conditionals and Mini Challenges
(Conditionals) A1: Ask Mr. Merrill to modify the clawbot to have the color sensor facing downwards
A2: Create the program ColorReader.c by copying the program displayed below. Be sure to set the colorDetector to ColorName in the Motors and Sensor Setup. The program will display the color that it is detecting. You will need this information to properly program your robot for this section. Check the color tiles and show Mr. Merrill.
Motor and Sensor Setup
A3: Create and run the program TurnIfGreen.c on the physical robot. Robot will turn when it detects the color GREEN. DO NOT USE THE COLOR RED. Use the following code at the beginning of any program using the color sensor. The sleep is needed to be sure that the color sensor is properly activated and ready to detect your color.
A4: Create and run the program GreenLeftElseRight.c on the physical robot. Clawbot will turn left on GREEN and right on any other color
A5: Try It 2! Modify the program GreenLeftElseRight.c on the physical robot. Clawbot turns right when it detects GREEN and turns left when it detects BLUE.
A6: Mini Challenge 1: Signal Reader Create and run the program SignalReader.c on the physical robot. Clawbot will sense a colored tile in the middle of the square. After sensing the color the robot should drive to the proper area and stop when the touch sensor bumps the wall by the proper color.
A7: Mini Challenge 2: Ladder Drill SKIP THIS CHALLENGE
Color 1. Robot Configuration SKIP THIS SECTION
Sensor 2. Repeated Behaviors and Mini Challenges
Repeated A1: Create and run the program SimpleMazePart1.c on the physical robot. Clawbot will turn right if
Behaviors there is an object in front of it or move forward.
A2: Modify the program in Activity 1 and rename it SimpleMazePart2.c on the virtual robot. Clawbot will move through a maze from start to finish. Select the Simple Maze Challenge on the W: drive.
A3: Modify and run the program from Activity 2 on the physical robot. Clawbot will move through the maze and stop when it detects the color YELLOW (not BLUE). Ask Mr. Merrill to modify the clawbot for this challenge.
A4: Mini Challenge 1: Color Hunt Create and run the program ColorHunt.c on the physical robot. Clawbot will move through the color maze.
A5: Mini Challenge 2: Recycle SKIP THIS CHALLENGE
Touch LED 1. The Touch LED is both a bumper switch and a multicolored light.
You can use it just as you would a bumper switch. To use it as a bumper switch the following code can be used:
You can also set the color displayed by the Touch LED using the following code:
The different colors colors that can be displayed by the Touch LED are found below:
2. Touch LED Uses
A1: Try It! 1Color Bumper Create and run the program ColorBumper.c on the physical robot. Clawbot will display the color RED when the robot is stopped and GREEN when it is moving. The description below shows ROBOTC as a graphical language. They are basically the same, but there are some differences. You will not be able to use the setMultipleMotors command shown in the example below. You must use what you have learned in previous lessons to setMotors. Furthermore, when you use the waitUntil command, you will not use getBumperValue(bumperSensorNL). Instead, use getTouchLEDValue(touchLED).
A2: Emergency Stop! Create and run the program EmergencyStop.c on the physical robot. Clawbot will move forward and stop when the TouchLED sensor is pressed. Once the button is pressed again the robot will resume it's program. The Touch LED should be GREEN when it is moving and RED when it stops.
A3: Mini Challenge 1: Shifting Maze LED Create and run the program ShiftingMazeLED.c on the physical robot. Clawbot will recreate the challenge from the Distance Sensor Mini Challenge: Shifting Maze Off (Activity 3). However, you must program the clawbot to start with the Touch LED displaying RED at the start. The robot should begin the maze only when the Touch LED is pressed. Once it is pressed the Touch LED color should turn to GREEN. After sensing the first wall it should change to YELLOW. After sensing the second wall it should change to BLUE. After sensing the third wall it should change to DARK ORANGE, and when it reaches the finish it should change back to RED.
While 1. To access information about While loops click the link below:
Loops While Loops
Display 1. To display text on your brain use the link:
Text DisplayText
Multi-Tasking 1. This will allow you to run more than one program at a time. Here is how to access a sample program:
Go to File
Click on Open Sample Program
Open the Multitasking Folder
Click on VEX IQ Multitasking Demo.c
Play Sounds