Jason Howard Agenda I. How to download robotc II. What is tele-op used for? III. How to build a basic tele-op program IV. Getting the robot to drive V. Questions & contact information Download Robotc To download robotc go to robotc.net After this click on the download tab and go to Robotc 3.0 for Mindstorm. Click download link and save it to your desktop for easy access. Tele-op is used for… Tele-op is the two minute driver control period. • Tele-op is much more basic than autonomous it but its just as important. • In a tele-op program you set basic functions like movement of your robot, to a Logitech controller. • How to set your tele op up First thing that needs to be done is to set up a folder to store all of your programs and drivers. I recommend you place it on your desktop next to your robotc shortcut. The drivers are loacted on the same page as where you download robotc 3.0 and when you save them, save them to your folder When you open up robotc look in the top left corner for the new program icon or press Ctrl n. After this open the windows tab and change your menu level from basic to expert for later usage involving sensors. Before you do anything more switch the platform from LEGO Mindstorm NXT to LEGO Mindstorm NXT+ TETRIX in the robot tab at the top First step is to set up your daisy chain and motor ports. Go to the robot tab and open motor and sensor setup Go to the tab TETRIX Controllers and set up your chain. For this deminstation I am just going to use one DC box Next move to the motors tab and name your motors. Call one left and the other right. When you do this make sure you put a check mark in the reverse box in one of the two motors. Then click apply. This technique can be use with a two or four motor drive. If your using four motors, when you wire them wire the two left together and the two right together. After you click apply then your pragrma statements should appear. Next you add your include statements which you add your joystick drivers and Hitechnic sensor drivers. For this I am only going to use the joystick drivers. - The joystick driver is the driver folder and common.h is a program inside it After your include statement you start your task main which is your program. To start your task main your program should look like this: task main() After your task main add a { and after initialize your variables. Our variables are for the motors and we will use y1 and y2. Your program should look like this: task main() { int y1,y2; After you initialize your variables then you add your waitForStart(); which makes it not start until you hit tele-op running. After your wait for start you start your while loop. Your while loop is a loop that will keep repeating whatever function is in the loop until the function you give it is proven false. What I use is the function true. This makes the loop continuous and cant stop because true will never be false. while(true) After the while true statement you open a new bracket { and you start your tank drive controls. Before you use your function you must add the joystick settings, getJoystickSettings(joystick); For your tank drive controls you have your y1 or y2 variable assigned to a joystick’s analog and multiply it by how much power you want to assign to that motor and then divide it by 128. You divide it by 128 because the analog reads 128 in all directions. It will look like this : { getJoystickSettings(joystick); y1=joystick.joy1_y1*100/128; y2=joystick.joy1_y2*100/128; Now that you given a variable a function you assign a motor to that variable. In order to do this you put in a motor and set it equal to the variable. motor[left] =y1; motor[right] =y2; After this you close your two open brackets } } This is what the finished program looks like: Now that your program is done, you comment the code so that you can see what each function does without trying to figure it out. In order to comment it you add a double backslash and the rest of the code on that line turns green and you can write what that line does. You can also comment out any code that might be old or if your testing something. Commenting out code is better than deleting the code because you may want the code back y1=joystick.joy1_y1*100/128; // left side moves forward at 100% power Getting the Robot to drive Now that all the coding is ready its time to connect to the robot and see if the coding is right. First you must download the correct firmware onto the NXT. In order to do this connect the robot with you computer via usb then go to the robot tab, go to download firmware and select standard file Wait a second while it loads the NXT by usb and select F/W Download and wait about a minute until it is completely done. You should update your firmware regularly and keep in mind every time you do the NXT memory is wiped. NEVER download new firmware right before any tournament Now that your firmware is updated you can connect to your robot via Bluetooth(if you don’t have Bluetooth in your computer I recommend you get a usb Bluetooth adaptor, if you cant a usb will still work and skip this next step) To connect via Bluetooth go to the robot tab, NXT devices, then communication link setup. Wait about 30 seconds and then look on the left side for the NXT you wish to use and then click Select via BT The first time you do this it will ask to press the orange button on the NXT. Do so and it will start downloading the hardware to your computer. It will say unable to connect, just wait for the downloading to stop and connect to it again After you connect its time to download your program. Go to the robot tab and click compile and download. The first time you do this it will ask for you to save it. I recommend you save it as tele-op ____(team number here) If it downloads successfully and there are no issues with your program then no X’s should appear and a debugger window should open, in order for the robot to move you must go to the robot tab, debugger windows, Joystickcontrol-FTC If you are to get and X on any line of code then there is a issue with your program: White X: there is a variable with no reference and the program will still work Yellow X: there is a issue were the syntax is wrong but it assumes you meant something else and it still works Red X: there is a issue with the program where you are missing something completely and the program wont run. Now that you have your debugger windows up, turn on the robot’s main power. After this select tele op: ready then select tele op: running and press start. Now move the analogs and you should be running. If its not then there could be something wrong with your robot and I would check it out. Contact Information If you have any questions about programming then you can send an email to either me or my dad. Also you can send us an email if you would like a copy of my presentation. email me at: jasonhoward1996@yahoo.com email my dad at: bobhoward@yahoo.com If you would like a current copy of my teams teleop program for reference then ask me at some point today and I’ll give you the drivers as well. Keep in mind our tele-op has some advanced programming in it.