Presentation is loading. Please wait.

Presentation is loading. Please wait.

FRC Robot Framework Labview Made Easy (er) For FIRST Robotics 1.

Similar presentations


Presentation on theme: "FRC Robot Framework Labview Made Easy (er) For FIRST Robotics 1."— Presentation transcript:

1 FRC Robot Framework Labview Made Easy (er) For FIRST Robotics 1

2 FRC Framework Base Code with Architecture Pre-configured
Defines Interaction between code sections Designated places to add functionality Focus on robot functionality rather than program structure Let's walk through this together 2

3 FRC Project Select FRC cRIO Robot Project Dialogue box opens 3

4 Create Project Give Project a name Choose where to save project
Give cRIO IP address – your team number goes in xx.yy e.g Click “Finish” 4

5 Project Explorer Project Explorer appears
All code listed under “RT CompactRIO target 10.xx.yy.2” Displays pre-written set of VI's to allow for an out of box solution Top level VI is “Robot Main.vi” Double click to open it 5

6 Robot Main.vi – Front Panel
Front Panel has controls and indicators Not much on this one Driver’s Station is main operator interface Click on “Window” Then Select “Show Block Diagram” 6

7 Robot Main Block Diagram
Select and modify sub-VI's from here Or click on sub VI from Project Explorer Recommended not to make changes to “Robot Main.vi” 7

8 Robot Main Block Diagram
We will focus on the main block VIs: Begin TeleOp Autonomous X For now, never mind these 8

9 OPEN – SET/GET - CLOSE Programming of devices in general follows the following protocol: Open a Device, Tell the code where it is plugged in Give it a name Get info from a device, or Set a value to a device Close the Device Open a Joystick Get the Y Joystick Value Close the Joystick Open a motor Set the motor speed Close the motor

10 Begin.vi Initializes the camera, motors, joysticks
“Opens” devices Tells program where device is plugged into cRio Gives the device a “Refnum” name which can be recalled from other areas of the program (such as tele-op) Initialize additional components desired to be added to the system here 10

11 Begin.vi Camera configuration – unlikely to need to change this, if use it at all - Discuss in later session. Motor configuration set up for 2 motors drive. Tell which PWM port plugged into, give it a name Why is one motor inverted? Set up for 1 joystick Tell where plugged into DS “refnum” i.e.name of devices Device info stored by that name to be recalled when device is used (e.g.in tele- op) 11

12 Begin .vi Modify to Add Extra Motor
Edit vi: Add an accessory motor: Open function palette and select: WPI Robotics Library / Actuators / Motor Control Add Open Motor .vi Identify where plugged in What type of controller Add Refnum Set.vi Give it a name 12

13 Robot Main – Calling TeleOp or Autonomous.vi
This section uses a “State Machine” Case structure Inside a while loop Continues to loop until robot Disabled “Robot Mode” controlled by Driver Station or by Field Management System (In Competitions) “Robot Mode” selects Case 13

14 Tele-op.VI Out of Box Code will drive 2 motor drive with Joystick axes 1 & 2 Reads Refnums from Begin.vi Gets Joystick Axis data Cluster of data – uses the “Unbundle by Name” function block Sets Drive Motor Speed Arcade drive X axis turns, Y axis fwd / reverse Use Context Help (CTRL H) to investigate blocks These are available but not required 14

15 Modify Tele-op.VI for added Motor
First: Modify Joystick axes for a PS3 controller Right click on Axes elements Change Axes 1 & 2 to Axes 3 & 4 Right thumb control on PS3 style controller Next access Joystick Buttons by connecting to a “Unbundle by name” function from the “cluster,“ palette From WPI Robotics Library/ Actuators/ MotorControl Bring the Refnum Get and provide name Bring Motor Set Output vi and connect them Now from the “Comparison” palette bring a “Select” Block Button output is true or false Select function assigns a value if true and another if false Create constant of 1 if true and 0 if false Wire output to the Set Output block - Results in motor going full speed if trigger is pressed. 15

16 Interfacing with the Robot
Next we will see if our code works! Interfacing with the Robot

17 Driver Station Operation Tab
Battery Voltage Display Team Number (Make sure it is correct) Mode Selection Teleoperated = Driver Autonomous = Computer Control Practice = Run like a match Elapsed time since start of robot communication PC Battery Communication Status Communication = a connection to the cRIO Robot Code = the user code is running User Messages (This area can be controlled by the robot program) Communication Status Enable/Disable Buttons Station Number for Competition Use

18 Driver Station Setup Tab ID Team number to connect to robot
Team Number Configuration: Make sure this is set correctly Choose NIC: Allows you select which network adapter is connected to the robot Warning this will change your Computer TCP/IP properties to a static IP address vs.DHCP Joystick Setup: Drag Joystick up and down to switch which connected joystick is 1, 2, 3 or 4 in the program Exit: Logs off the Driver Station Account on the classmate

19 IP Address IP (Internet Protocal ) address is how devices address each other on the internet (public) or closed wi-fi network. Normally the IP address is temporary and created automatically (DHCP) But for a closed – local network we use a static IP address Using 10.XX.YY.A where XX. YY is team number and A is a device number (2 for cRio), e. g

20 IP Address To Change IP Address
On Computer go to : Control Panel> Network and Internet > view network status > change adapter settings > Right Click on Wireless connection, select properties: When driver station opens it will set your computer IP address to this static value, To connect to internet this must be reset to the “Obtain address automatically” Be sure to say ok and get all the way out.

21 Homework Challenge Slides
Add a gyro device: Begin – Open Tele-op – Read gyro and display reading on front panel

22 Begin .vi Updated for adding Gyro
Edit vi: Add an accessory motor: Open function palette and select: WPI Robotics Library / Sensors / Gyro Add Open Gyro .vi Identify where plugged in Add Refnum Set.vi Give it a name 22

23 Modify Tele-op.VI for Reading Gyro
From WPI Robotics Library/ Sensors/ Gyro palette Bring the Refnum Get and provide name it was given in the Begin.vi Bring Gyro Get Output vi and connect them Put cursor on “angle” output, right click select create indicator Indicator shows up on Front Panel Digital indicator is default but can be replaced with a Dial or Linear Indicator 23

24 Modify Front Panel Indicator for Gyro reading
Put Cursor on indicator, right click and select “Replace”, then “Gauge” Enlarge gauge by dragging diagonally Click on the 10 and change to 360 Hover on the 360 until you see the rotation arrows – then drag the 360 around to the zero. 24

25 # 2 Modify Tele-op.VI for option for Tank Drive, selectable from DS
Updated for PS3 Joystick control pad and selectable steering modes Add a “case structure” around the “arcade drive” Add a second case “Tank Drive” with a tank drive function block Use Driver station “Digital In 1” as case selector Update Joystick for PS3 controller 25

26 Extra slides for reference

27 Begin .vi updated for 4 motors Use this if you put 2 CIMs in each of two gearboxes.
Edit vi: Set up for 4 motor drive: Put cursor on open 2 wheel drive block > right click > replace > drive palette > 4 motor drive Update input parameters Why are 2 motors inverted? 27


Download ppt "FRC Robot Framework Labview Made Easy (er) For FIRST Robotics 1."

Similar presentations


Ads by Google