Apple Pi Robotics Logic System and Programming Basics
description
Transcript of Apple Pi Robotics Logic System and Programming Basics
![Page 1: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/1.jpg)
Apple Pi Robotics
Logic System
and
Programming Basics
![Page 2: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/2.jpg)
Agenda
Review Control System Hardware
On Robot
Driver Station
Where to begin application code
LabView Interface
LabView Programming Fundamentals
Application Challenge
![Page 3: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/3.jpg)
Control System
Hardware Controller
I/O and interface boards
Communications
Operator Interface
Software Operating System
Program Code
![Page 4: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/4.jpg)
Let's Look at the Hardware
Rack/Processor/Communication
Analog Module
Digital I/O
Solenoid Module
Extra Slot
The cRIO I had 8 slots, the newer cRIO II has 4. Both are compatible, and both are legal in competitions, if you have an 8 slot you may only use the 1st 4 slots.
![Page 5: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/5.jpg)
Additional HardwareAnalog Breakout
Up to 8 Analog sensors
12v Power from Power
Distribution Board
Analog Breakout Board
Jumper
![Page 6: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/6.jpg)
Additional HardwareDigital Sidecar
All speed controllers (up to 10),
sensors (up to 16) and
relays (up to 8) connect to sidecar
Connect to 12V output on Power Distribution Board
Robot SignalLight
![Page 7: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/7.jpg)
Additional HardwareSolenoid Breakout
Only used for pneumatics; spike relay,
pressure switch
12v Power from Power
Distribution Board
Solenoid Breakout Board
![Page 8: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/8.jpg)
Driver Station
• Laptop
• Driver Station Software
• Joystick
• Custom Controls
• Dashboard
![Page 9: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/9.jpg)
Laptop
• Classmate comes in the kit
• You can use any laptop that you like
• (Advanced) Software can run on the laptop and send data back to the robot, like vision processing
![Page 10: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/10.jpg)
Driver Station Software
• Software that is run on the DS laptop
• Allows driver control of the robot
• Diagnostics of the communication to the robot
• Battery Voltage Read out
• Enter Key = Disable
• Spacebar Key = Emergency Stop (Use Enter normally)
If you press Spacebar you will have to restart the robot before you can disable it
![Page 11: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/11.jpg)
Driver Station Software• 5 Tabs Provide Access to the different screens
• Operation
• Diagnostics
• Setup
• I/O
• Charts
If you press Spacebar you will have to restart the robot before you can disable it
![Page 12: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/12.jpg)
Driver Station Operation Tab
Communication Status
Enable/Disable Buttons
Station Number for Competition
Use
User Messages (This area can be controlled by the robot program)
Team Number (Make sure it is
correct)
Communication Status
• Communication = a connection to the cRIO
• Robot Code = the user code is running
Battery Voltage Display
Mode Selection• Teleoperated = Driver• Autonomous = Computer
Control• Practice = Run like a
match
Elapsed time since start of robot
communication
PC Battery
![Page 13: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/13.jpg)
Driver Station Diagnostics Tab
Joystick and IO LEDS: Green means they are active
Communication LEDS: Green means they are active
Hover over errors for messages that may help resolve issues
Firmware Versions: These must be stay up to date for you to work at competition
View Driver Station Log can be useful for debugging errors
Reboot cRIOUseful if you have an error that
a robot reset can fix
![Page 14: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/14.jpg)
Driver Station Setup Tab
(Advanced) Allows you to configure
Remote Dashboard
Allows you to configure how the practice rounds are
setup
Team Number Configuration:
Make sure this is set correctly
Choose NIC: Allows you select
which network adapter is connected
to the robot
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
![Page 15: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/15.jpg)
Driver Station I/O TabThis tab is used for configuring custom interfaces with the cypress I/O
module. If you aren’t using the cypress module you will not need this tab
There are several other ways to build custom I/O interfaces that don’t involve the cypress board or this I/O panel. You can find examples of these
on Chiefdelphi.com
![Page 16: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/16.jpg)
Driver Station Charts Tab
• Lost Pkts = Lost Packets this is an indication of connection issues, if you have a large amount of lost packets there is something wrong with your connection between the robot and the DS
• Volts = A graph of battery voltage this can be very useful to find correlations between battery volatage and problems that occur with the robot
• Msecs = This is reporting your trip time, which is how long it takes for information to go from the driver station to the robot, this should also be small
• CPU% = this is the percentage of CPU your cRIO is using, minimizing this will allow for better performance
This tab helps you diagnose problems with your robot
![Page 17: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/17.jpg)
Dashboard
The Dashboard can be used to get feedback from robot systems. This is the default Labview Dashboard
![Page 18: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/18.jpg)
D-Link DAP 1522 Router/Bridge
• Connects Robot to Driver Station Laptop
• Allows wireless control of the robot
• Also called the Radio
• Should be mounted away from motors and speed controllers to avoid interference
![Page 19: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/19.jpg)
D-Link DAP 1522 Router/Bridge
Power Light(blue)
Bridge Light(orange)
Access Point Light(blue)
Traffic Indicator Lights(blue)
![Page 20: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/20.jpg)
D-Link DAP 1522 Router/Bridge rev.B
![Page 21: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/21.jpg)
D-Link DAP 1522 Router/Bridge
Ethernet Ports AP/Bridge SwitchAP = Practice/Home
Bridge = At Competition
Reset Button
5v Power Connector Plugs in to grey power
inverter
![Page 22: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/22.jpg)
Other Electrical SystemDevices
Sensors Limit Switches
Photo Detectors
Infrared Sensors
Encoders
Potentiometers
Gyro
Speed Controllers
Jaguars
Victors
Talons
Solenoids
Lights
Pressure Switches
Gyro
Relays
![Page 23: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/23.jpg)
Let's Talk Application CodeWhere do we Start?
List Connected Hardware with purpose defined All Operator Interface
Pushbutton/Switches Meters Lights
All Robot Mounted Devices Limit switches Motor controllers Spike Relays Lights Photo sensors
![Page 24: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/24.jpg)
Application CodeWhere do we Start?
Develop Sequence of Operations Documentation of how robot works; all
subsystems defined including the purpose
Ball collector/conveyor Shooter Drive train Knockdown
All ties back to the hardware list
![Page 25: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/25.jpg)
Example:Knockdown Sequence of Operation
The purpose of the Knockdown arm is to allow for the lowering of the bridges that are used to cross from the offensive side of the field to the defensive side. It is also used for lowering of the bridge during the “end game” to allow the robot(s) to get on the bridge to attempt balancing.
Control devices include the “Arm Up” and “Arm Down” buttons on the Operator's joystick. The “Full Up” and “Full Down” limit switches control the stop points for actuation and prevent over travel. Both limit switches make use of the normally open contact. The “Knockdown Gearmotor” provides for the actuation of the arm. The motor operates clockwise for movement in the down direction (positive polarity) and counterclockwise for movement in the up direction (negative polarity).
![Page 26: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/26.jpg)
Example:Knockdown Sequence of Operation
Operation: When the “Arm Down” button is depressed, the motor is commanded to rotate clockwise with a preset speed reference. The arm continues to advance in the down direction until either the button is released or the full down limit switch is engaged. If the button is released the arm stops at that point. If the full down limit switch is activated the arm stops in the down direction and can not be lowered further. Only the “Arm Up” button may be used at this location.
When the “Arm Up” button is depressed, the motor is commanded to rotate counter clockwise with a preset speed reference. The arm continues to advance in the up direction until either the button is released or the full up limit switch is engaged. If the button is released the arm stops at that point. If the full up limit switch is activated the arm stops in the up direction and can not be raised further. Only the “Arm Down” button may be used at this location.
![Page 27: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/27.jpg)
LabView Interface Overview:1st do you have correct version installed?
• For those who don’t have correct version:
• We can start loading during initial discussion slides
• USB + 3 updates req’d
Open a blank “vi”
![Page 28: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/28.jpg)
LabVIEW InterfaceEach Virtual Instrument (VI) has 2
WindowsFront Panel• User Interface (UI)
– Controls = Inputs– Indicators = Outputs
Block Diagram• Graphical Code
– Data travels on wires from controls through functions to indicators
– Blocks execute by Dataflow
Front Panel
Block Diagram
![Page 29: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/29.jpg)
Block diagram execution Dependent on the flow of data
through wires Block diagram does NOT execute
left to right It is good practice to lay out
the code in an easy to follow left to right, top down manner
Function executes when data is available to ALL input terminals
Functions supply data to all output terminals when done
Dataflow Programming
30
Logic Thinking: What functions are needed, and in what order?
![Page 30: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/30.jpg)
LabVIEW Interface
![Page 31: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/31.jpg)
LabVIEW Interface
![Page 32: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/32.jpg)
LabVIEW Interface – function setsLabVIEW palette sets
Programming
FRC specific palettes FIRST Vision
WPI Robotics Library
PID Toolkit palette
Context Help
![Page 33: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/33.jpg)
WPI Robotics Library Interfaces with cRIO, sensors & actuators
Contains multiple palettesRobot Drive
Sensors
Actuators
IO
Driver Station
Camera
Communications
Utilities
![Page 34: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/34.jpg)
LabVIEW InterfaceSample Block Diagram
![Page 35: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/35.jpg)
LabVIEW Interface
![Page 36: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/36.jpg)
LabVIEW InterfaceHelp»Show Context Help, press the <Ctrl+H>
keysHover cursor over object to update window
Additional Help
– Right-Click on the VI icon and choose Help, or
– Choose “Detailed Help.” on the context help window
![Page 37: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/37.jpg)
LabVIEW Best PracticesCreate a New Folder in your work directory for your
LabVIEW work call it “Labview Data”You will save all your VIs & Projects to this folder.
Saving your VI frequently is good, but know that once you choose to save your VI, it resets the ‘undo call’ (Ctrl-Z) and you will not be able to go back on any steps you made before saving your VI.
Think function-to-function programming and not line-by-lineAvoid crossing wires while connecting different objects on
the block diagram. Crossed wires can be confusing to read and follow at times. (but can be unavoidable )
When in doubt, DEBUG! Use the light bulb icon on the status toolbar on the block diagram to highlight the path of the flow of data.
![Page 38: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/38.jpg)
LabVIEW Best Practices
Place output indicators at multiple steps during the data flow path of your VI to keep track of the output as it changes through the VI.
PLAN PLAN and PLAN! Plan out the various stages of your VI/Program prior to placing objects on the block diagram. This will make it easier to end up with a clean picture of code and will also allow you to pick out the functions that best suit your needs.
PRACTICE! The only way to get better at LabVIEW is
to practice.
We will teach basics and principles in next few weeks
In order to be proficient – independent work is required
![Page 39: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/39.jpg)
LabView for FRCA template is provided to set up the code
Open Labview FRC 20131. Select New FRC cRio Robot Project 2. Change Project name 3. Set IP Address to 10.20.67.02, select “Finish”4. In “Project Explorer” window select “Robot Main”
• Project explorer links multiple vi’s (Virtual Instruments)
![Page 40: Apple Pi Robotics Logic System and Programming Basics](https://reader036.fdocuments.in/reader036/viewer/2022062309/56814eca550346895dbc687e/html5/thumbnails/40.jpg)
That's All Folks!