38
J.M. Gabrielse VEX Robotics Design System Simple EasyC Program

V E X Robotics Design System

  • Upload
    dinos

  • View
    35

  • Download
    1

Embed Size (px)

DESCRIPTION

V E X Robotics Design System. Simple EasyC Program. Outline. The Programming Kit The Joystick Your 1 st EasyC Program Common Problems. The Programming Kit. EasyC V4 for Cortex only works with the new controllers in your kits USB to serial port adapter connects a computer to the dongle - PowerPoint PPT Presentation

Citation preview

Page 1: V E X Robotics Design System

J.M. Gabrielse

VEX Robotics Design System

Simple EasyCProgram

Page 2: V E X Robotics Design System

J.M. Gabrielse

Outline

• The Programming Kit

• The Joystick

• Your 1st EasyC Program

• Common Problems

Page 3: V E X Robotics Design System

J.M. Gabrielse

The Programming Kit

• EasyC V4 for Cortex

• only works with the new controllers in your kits

• USB to serial port adapter

• connects a computer to the dongle

• dongle

• connects a telephone cable to a serial cable (or USB to serial adapter)

• telephone cable

• plugs into the programming port of your joystick

dongle

USB to serial adapter

EasyC CD

telephone cable

Page 4: V E X Robotics Design System

J.M. Gabrielse

8 channels:1. x-axis of right joystick

(-127 to +127)

2. y-axis of right joystick(-127 to +127)

3. y-axis of left joystick (-127 to +127)

4. x-axis of left joystick(-127 to +127)

5. left trigger buttons Up (0 or 1)Down (0 or 1)

6. right trigger buttons Up (0 or 1)Down (0 or 1)

7. left buttons Up (0 or 1)Down (0 or 1)Left (0 or 1)Right (0 or 1)

8. right buttons Up (0 or 1)Down (0 or 1)Left (0 or 1)Right (0 or 1)

VEXnet Joystick

↑ Top View ↑

↓ Front View ↓

↑ Front View ↑

Page 5: V E X Robotics Design System

J.M. Gabrielse

Sample Program in EasyC

Page 6: V E X Robotics Design System

J.M. GabrielseStart a New Competition Project

Page 7: V E X Robotics Design System

J.M. GabrielseSelect Field Control Competition Project

Page 8: V E X Robotics Design System

J.M. GabrielseSelect the Controller Configuration (F5)

Page 9: V E X Robotics Design System

J.M. Gabrielse

Type in descriptions of what you’re going to plug into each port.

Page 10: V E X Robotics Design System

J.M. Gabrielse

Type in descriptions of what you’re going to plug into each port.

Page 11: V E X Robotics Design System

J.M. GabrielseSelect the OperatorControl tab.

Page 12: V E X Robotics Design System

J.M. GabrielseExpand Joystick

Page 13: V E X Robotics Design System

J.M. GabrielsePick Tank or Arcade mode.

Modes

Arcade = 1 joystick drive (simpler)

Tank = 2 joystick drive (better control)

The number of motors should match your robot (2 for the protobot).

Page 14: V E X Robotics Design System

J.M. GabrielseDrag Tank – 2 motor onto the flow chart.

Modes

I will use Tank – 2 motor since driving with two joysticks gives the driver more control.

You can use Arcade – 2 motor if you prefer to drive with one joystick.

Page 15: V E X Robotics Design System

J.M. GabrielseDrag Tank – 2 motor into the WHILE loop.

WHILE Loops

Any statement placed in a while loop will execute over and over again (if the expression equals 1).

We drag the joystick block into the while loop so the program will get commands from the joystick over and over again.

Page 16: V E X Robotics Design System

J.M. Gabrielse

For Tank drive set the Left Channel to 3 (the y-axis of your left joystick)

Tank Drive

The y-axis of the left joystick should control the left wheels and the y-axis of the right joystick should control the right wheels.

Page 17: V E X Robotics Design System

J.M. Gabrielse

For Tank drive set the Right Channel to 2 (the y-axis of your right joystick)

Tank Drive

The y-axis of the left joystick should control the left wheels and the y-axis of the right joystick should control the right wheels.

Page 18: V E X Robotics Design System

J.M. Gabrielse

For Arcade set the Forward/Reverse Channel to 2 (the y-axis of the right joystick).

Arcade Drive

The y-axis of your right joystick (if you’re right-handed) should control the speed (forward/reverse) of the robot.

Page 19: V E X Robotics Design System

J.M. Gabrielse

For Arcade set the Rotate Channel to 1 (the x-axis of the right joystick).

Arcade Drive

The x-axis of your right joystick (if you’re right-handed) should control the rotation (turning) of the robot.

Page 20: V E X Robotics Design System

J.M. GabrielseSelect the motor number for your Left Motor.

Motor Numbers

The number of the slot/port on the robot controller that a motor is plugged into is its Motor Number.

Labels from the Controller Configuration automatically appear in green.

Page 21: V E X Robotics Design System

J.M. GabrielseSelect the motor number for your Right Motor.

Motor Numbers

The number of the slot/port on the robot controller that a motor is plugged into is its Motor Number.

Labels from the Controller Configuration automatically appear in green.

Page 22: V E X Robotics Design System

J.M. Gabrielse

Arm

Page 23: V E X Robotics Design System

J.M. Gabrielse

Page 24: V E X Robotics Design System

J.M. Gabrielse

Gripper

Page 25: V E X Robotics Design System

J.M. Gabrielse

Gripper

Page 26: V E X Robotics Design System

J.M. Gabrielse

You are done writing your first program.

Congratulations!

Page 27: V E X Robotics Design System

J.M. Gabrielse

Build & Download your program.

Page 28: V E X Robotics Design System

J.M. Gabrielse

Build & Download your program.

Page 29: V E X Robotics Design System

J.M. Gabrielse

Your program is finished downloading whenthe bar goes down (erases old code)

and goes back again (loads new code).

Page 30: V E X Robotics Design System

J.M. Gabrielse

Save your program even if it didn’t work.

Page 31: V E X Robotics Design System

J.M. Gabrielse

The ROBOT light should be green (charged battery).The VEXnet light should be green (connected).

“My code won’t download!”(Is your robot on?)

Make sure to turn your joystick on too.

The POWER switch

should be ON.

Page 32: V E X Robotics Design System

J.M. Gabrielse

What color is the ROBOT light on the controller?

“My code won’t download!”(Did you use a fresh battery?)

• green: okay battery • red: dead battery

Page 33: V E X Robotics Design System

J.M. Gabrielse

• The USB A-A cable should be plugged into the robot controller in the USB port where the VEXnet key normally plugs in.

• The other end of the USB A-A cable should be plugged into a USB port on the computer.

“My code won’t download!”(Is the robot connected to the computer?)

USB A-A cable

computer

joystick

remove the VEXnet key robot controller

Page 34: V E X Robotics Design System

J.M. Gabrielse

• The telephone cord should be plugged into the port labeled PROGRAM on the joystick.

• The other end of the telephone plug should be plugged into the dongle.

• The other end of the dongle should be attached to the computer (either by the USB to serial adapter or a serial cable).

“My code won’t download!”(You can use the programming cord instead of the USB A-A cable)

dongle USB

to serial adapter

telephone cable

computer

joystick

Page 35: V E X Robotics Design System

J.M. Gabrielse

“My robot doesn’t drive right!”(Are the motors plugged in correctly?)

Everything should be plugged in according to the Controller Configuration

Page 36: V E X Robotics Design System

J.M. Gabrielse

“My robot doesn’t drive right!”(Did you use servos instead of motors?)

• check the label

• motors spin continuously (360° of rotation)

• the controller sets the speed (-127 to +127)

• servos spin back and forth (120° of rotation)

• the controller sets the location (-127 to +127)

Page 37: V E X Robotics Design System

J.M. Gabrielse

“My robot doesn’t drive right!”(Do you need to invert any of your motors?)

• Test drive your robot with all it’s wheels off the ground

• Look to see if any motors need to spin in the other direction

• Check Invert Direction to make a wheel spin in the other direction.

• Build & Download your modified code

Page 38: V E X Robotics Design System

J.M. Gabrielse