Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

RobotCBasics

This Prezi is to help GTT students program their first robot (the testbed).
by

Maya Heissenbuttel

on 3 October 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of RobotCBasics

{
1
Natural Language...
A set of pre-created commands for your robot
Allows you to drag and drop code from the Function Library rather than typing it all from scratch
Saves time and is easier!
Switches...
double click the icon on the desktop
set the platform type correctly
the computer:
set download firmware to automatic
The Testbed!
None of this matters if you don't plug the robot (testbed) into the computer.
Use the orange USB cable and make sure you get a "bonk" when you plug it in.
Open the PLTW Template from the y: drive.
Immediately save it to your u:drive.
How do I name them?
Pseudocode is how you plan out your directions for the robot. Psudocode usually describes behaviors of the robot.
How do I start programing?
Challenge 1
Step 1:
Plug in your testbed
Launch RobotC
Set the correct Platform Type, Firmware download, and open the PLTW template
Under Robot, Motors and Sensor Setup, Select Standard Models and Choose GTT Testbed
Step 2:
Type in the header information and add your pesudocode for the project...
2
Step 3:
Drag and drop the code you need from the Function Library
Change the placeholders to fit your names and speeds
Compile and download your code to the robot...
You want to turn on the right motor, run it for 5 seconds and then turn it off again...
It should look like the video below, when done...
3
How do I make motors run in reverse?
There are basically 2 ways to make a motor go backwards...
1.) Put your speed in as a negative number...
2.) Go to Motors and Sensors setup and click the box to make the motor reversed.
We use two DIGITAL sensors; Bump Switches and Limit Switches. These sensors are either on (1) or off (0).
Challenge 3
embrace
Set it all Up
PLTW
template
Naming and
Pseudocode
Natural
Language
Practice Makes
Perfect
RobotC is a construct for programing robots.
We use RobotC to organize our commands in Natural Language
It is how we "tell" the robot what to do
Use an UntilTouch command so the robot does not turn on until the bump switch is pressed.
After the motor comes on, put in an UntilTouch to keep it running until the limit switch is touched.
Your testbed should do this when you are done.
Touch Sensors...
RobotC
check and double check your wiring guide
RobotC will automatically put in the names of motors and sensors once you enter them.
You enter the header information for your teacher to know who's project it is.
Task Description is your summary of what the project was about...
Pseudocode is the step by step directions you will give to your robot. These are in regular everyday language
After the task main is where your code goes. Always between the { and }
Names must all be one word (leftMotor)
No special characters (%, $, #...)
Cannot be a "reserved" word (while, motor, task, left, right...)
Yes you can name a motor Bob. But then how do you know what side of the car it is on, or what its purpose is?
Pseudocode
Go up to Robot and pull down to Motors and Sensors Set Up.
Pseudocode goes in the same order as the behaviors of the robot
Pseudocode IS important. Without it you will get lost in your code from one day's work to the next...
Most important command here is stop();
This will turn everything off at once.
Most Important
These commands tell the robot to wait "until" it senses something to do an action
Don't use this! We have Bumps not Buttons!
We have 269 two-wire motor
Plugged in directly at 1 and 10
At 2-9 must have Motor Controller 25
Full speed is 126, half is 63
This will set up all the motors and sensors for you. It just makes things a bit easier for this first project.
Challenge 2:
Run the right motor at 63 for 5 seconds
Then run the left motor backwards at 94 for 2.5 seconds
Finally make both motors run forward at 126 for 7.25 seconds.
To program them you use an "until" command. This tells the robot to do something (or nothing) until a sensor is touched.
Challenge 4:
Potentiometers are ANALOG sensors. They measure the turn of a shaft between 0 and about 4095. They have internal mechanical stops to prevent the shaft from turning all the way around.
Potentiometers are programed as GreaterThan for positive direction and LessThan for negative direction.
Have your testbed do nothing until the potentiometer is greater than 2048 (halfway) then the motor comes on and runs until the potentiometer is less than 2048.
While Loops...
A while loop is a structure that allows code to be repeated over and over again.
While loops are set up with a "condition" this is like saying "while this is true..."
The robot will check the condition every time the code loops
The simplest condition is 1==1 but there are others...
Notice in this example how there is an { after the while... this tells the robot to repeat from there down to the next }
Add a while loop to your potentiometer code...
It should now turn on an off multiple times, without resetting the cortex or uploading the code again...
Line Tracking...
A line tracker is a light sensor. It sends out an IR beam and measures the amount of light it can "see"
This is an ANALOG sensor because it measures a range
It reads values between 0 and 4095
You have to set Thresholds for the light sensor.
1. open the RobotC Debug window
2. place a white sheet of paper under the sensor and write down the reading.
3. Do the same with a black sheet of paper.
4. Add light # + dark # and then divide by 2 - this is your threshold
Then all you have to do is use UntilDark for no light and UntilLight for light...
Program your testbed to open and close the claw motor when the light sensor is covered
Put it in a while loop to keep it going...
Notice that I have to add a } at the end to close the while loop...
Check out the video of how it should look...
Full transcript