frclabviewtutorials.com/workshop

Slides:



Advertisements
Similar presentations
Servo Background Servos provide control of rotary position Servos are used extensively in the remote control hobby world for: Aircraft (flaps, ailerons,
Advertisements

Add and Use a Sensor & Autonomous For FIRST Robotics
Intro to Arduino with LilyPad Make a MakerSpace, Artisan’s Asylum Linz Craig, Chris Taylor, Mike Hord & Joel Bartlett.
Living with the Lab Using servos with an Arduino EAS 199A Fall 2011.
FRC LabVIEW Software Overview Joe Hershberger Staff Software Engineer National Instruments.
PING))) Ultrasonic Distance Sensor living with the lab ultrasonic pressure waves from PING))) speaker The PING))) sensor emits short bursts of sound and.
1 Ultrasonic Distance Sensor. 2 How it Works The distance sensor emits short bursts of sound and listens for this sound to echo off of nearby objects.
Embedded Programming and Robotics Lesson 10 Ultrasonic Range Finder Range Finder1.
1 Servo Motor. 2 Overview A servo motor is a motor that is only capable of rotating 180 degrees A servo motor is controlled by giving it an angle to proceed.
Proportional/Integral/Derivative Control
DPNM Lab., POSTECH 1/25 CS490K - Internet of Things (IoT) Jonghwan Hyun DPNM Lab. Department of Computer Science and Engineering, POSTECH
PING))) Ultrasonic Distance Sensor living with the lab ultrasonic pressure waves from PING))) speaker The PING))) sensor emits short bursts of sound and.
Practical Electronics & Programming
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
Arduino Week 2 Lab ECE 1020 Prof. Ahmadi. Objectives 1. Control the rotation of standard servo motor  A standard servo motor is limited in its rotation.
David GiandomenicoFeedback Control for your FIRST Robot’s DrivetrainDec 2010 WRRF Workshops #1 David Giandomenico Team mentor for Lynbrook Robotics – Team.
Material taken from Robotics with the Boe-Bot
FRC Robot Programming 1.PID Continued 2.Downloading and Deploying Code 3.Program a 2012 Robot from Spec Basic code For FIRST Robotics.
ENGG*4420 Real Time System Design Labs Introduction
Final Exam M.Eng. Amjad Elshenawy RTECS Gc(s)Gc(s) Gc(s)Gc(s) Controller   n sensor noise  w load disturbance  Gp(s)Gp(s) Gp(s)Gp(s) Plant.
PID CONTROLLERS By Harshal Inamdar.
Control systems KON-C2004 Mechatronics Basics Tapio Lantela, Nov 5th, 2015.
Session 12 Sensors and Timers. 3 Main Types of Robot Projects Command-Based Robot A more complicated project for more complicated robots Iterative Robot.
Data Logging 4 PID Tuning
ARDUINO 1. Basics  Comments  /* * Blink * * The basic Arduino example. Turns on an LED on for one second, * then off for one second, and so on... We.
Basic Circuits – Lab 4 Serial and OSC (maybe some theory too) Xmedia Spring 2011.
CSCI1600: Embedded and Real Time Software Lecture 16: Advanced Programming with I/O Steven Reiss, Fall 2015.
Robot Project by Ahmad Shtaiyat Supervised by Dr. Salem Al-Agtash.
Flow of signal So you have a sensor, now to process data taken from a sensor you will need a processing unit and that is your controller. sensorcontroller.
INTERNET OF EVERYTHING SDU 2016 Week 6. Getting Input from Sensors  Sensors give report on the world around it  Sensors convert physical input an electrical.
Serial Communication RS-232. In order to make two devices communicate, whether they are desktop computers, microcontrollers, or any other form of integrated.
Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Object Detection by Ultrasonic How to install and program a ultra sonic sensor with Arduino.
Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Object Detection by Ultrasonic How to install and program a ultra sonic sensor with Arduino.
Istituto Tecnico Industriale A.Monaco EURLAB Control a Servo Motor If you want to swing an robot arm or … steer a robot you need a special motor (Servo).
Pulse-Width Modulation: Simulating variable DC output
Session 6 John Wolf (WolfDenElectronics.com). Objectives – We’ll Learn  Code to Voice  PIR sensors – motion detection  Quadrature Encoders  Audio.
Ultrasonic Sensor TYWu.
Harpeth Hall Jan 2016 Introduction to Arduino Prepared for Harpeth Hall Winterim January 2016.
Serial Communications
Application of Programming: Scratch & Arduino
Application Case Study Security Camera Controller
Assist. Prof. Rassim Suliyev - SDU 2017
Manual for Arduino Kit v1.0
Sensors with Arduino A Microcontroller.
Arduino motor control using servo & ultrasonic sensor
Serial I/O and Data Communication.
Arduino Part 1 Topics: Microcontrollers Programming Basics
Arduino Uno and sensors
Control Loops Nick Schatz FRC 3184.
Schedule 8:00-11:00 Workshop: Arduino Fundamentals
CSCI1600: Embedded and Real Time Software
Programming, Serial and Virtual Prototyping
Ultrasonic Distance Sensor
Arduino Week 2 Lab ECE 1020 Prof. Ahmadi.
Serial Communication Interface: Using 8251
Training 11/11/16 Robot Code (WPILib).
Secret Door Knock Detector
Debugging Debug environments Debug via serial
Acronyms Galore: Wired for Success
Programming 2: The Arduino IDE & First Sketches
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Arduino 7 Segment Display Lab
Advanced LabVIEW
Advanced LabViEW
CSCI1600: Embedded and Real Time Software
Serial Communications
A Tutorial Overview Proportional Integral Derivative.
Pulse-Width Modulation: Simulating variable DC output
CTY SAR FCPS Alexander Velikanov
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

frclabviewtutorials.com/workshop Advanced LabVIEW frclabviewtutorials.com/workshop

Using an Arduino for sensor input On the robo-RIO

Using an Arduino for sensor input Use Arduino to read sensors and stream data over connection to robo-RIO DIO/AIO Using Serial bus Connecting DIO or AIO lines to and from an Arduino and the RoboRIO can provide a simple interface – useful for a small finite set of states to communicate (i.e., Breakaway LED status in Recycle Rush – 2 DO for type and 1 AO for height). Serial bus is a tad harder to code, but allows for infinite states to be communicated (while only consuming one of the serial ports on the RIO).

Using an Arduino for sensor input DIO/AIO Code on Arduino to read/write pins Code on RoboRIO to read/write pins Code on destination to interpret result

Using an Arduino for sensor input Using Serial Bus Code on Arduino to open and transmit to port Code on RoboRIO to receive from port and interpret Code on RoboRIO to handle a loss of connection

Using an Arduino for sensor input Using Serial Bus Code on Arduino to open and transmit to port - setup #include <math.h> // largely from https://www.instructables.com/id/Simple-Arduino-and-HC-SR04-Example/ #define trigPin 13 #define echoPin 12 int order_of_mag; long duration; float distance; String message = "";

Using an Arduino for sensor input Using Serial Bus Code on Arduino to open and transmit to port - init void setup() { Serial.begin(9600); // must match baud rate on roboRIO open too. pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); order_of_mag = 0; while(!Serial); // wait for it to be connected }

Using an Arduino for sensor input Using Serial Bus Code on Arduino to open and transmit to port – read sensor void loop() { // write a 10 microsecond high pulse to the trigger - make sure it was low for at least 2 before digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); // measure time echoPin is HIGH in microS duration = pulseIn(echoPin, HIGH);

Using an Arduino for sensor input Using Serial Bus Code on Arduino to open and transmit to port – scale to cm // average time to send and receive distance = (duration/2); // convert time to cm // s * ( 343 m/s) = s * 343 m // distance / 1000 * 353 = d m // distance * .0353 = d cm distance = distance * .0353;

Using an Arduino for sensor input Using Serial Bus Code on Arduino to open and transmit to port – send // begin transmission Serial.print('^’); // transmit distance Serial.print(distance); // end transmission Serial.println('$’); // hold up 10 mS - don't need to overflow the buffer. delay(250);

Using an Arduino for sensor input Using Serial Bus Code on roboRIO to open port Make sure baud rate matches – select port

Using an Arduino for sensor input Using Serial Bus Code on roboRIO to receive when available Make sure baud rate matches – select port

Using an Arduino for sensor input Using Serial Bus Code on roboRIO to receive when available Make sure baud rate matches – select port

Using an Arduino for sensor input Using Serial Bus Code on roboRIO to receive when available Make sure baud rate matches – select port

Using an Arduino for sensor input Using Serial Bus Code on roboRIO to receive when available Make sure baud rate matches – select port

Using an Arduino for sensor input Using Serial Bus Code on roboRIO to receive when available Make sure baud rate matches – select port

Using an Arduino for sensor input Using Serial Bus Code on roboRIO to receive when available Make sure baud rate matches – select port

Using an Arduino for sensor input Using Serial Bus Code on roboRIO to receive when available Make sure baud rate matches – select port

Using an Arduino for sensor input Using Serial Bus Code on roboRIO to receive when available Make sure baud rate matches – select port

Using an Arduino for sensor input Using Serial Bus Code on roboRIO to receive when available Make sure baud rate matches – select port

Using an Arduino for sensor input Using Serial Bus Code on roboRIO to handle loss of connection Make sure baud rate matches – select port

Using an Arduino for sensor input Demo

Using an Arduino for sensor input On the robo-RIO On the Dashboard

Using and Arduino with the Dashboard Driver station i/o Potentiometer for extra input (autonomous selection, shooter speed, etc.) Buttons/switches for additional control LEDs for indication Etc.

Using and Arduino with the Dashboard Customize the dashboard to read/write to Arduino Implement own serial interface (like with previous example on RoboRIO) or Use LINX library (https://www.labviewmakerhub.com/doku.php?id=libraries:linx:start)

Using and Arduino with the Dashboard Use LINX library Open connection Read/write to I/O Close connection

Using and Arduino with the Dashboard Use LINX library Open connection Read/write to I/O Close connection Works in built exe with/without pressing stop. Need to press stop in dev (will leave the port reserved).

Using and Arduino with the Dashboard Demo

PID Proportional https://docs.google.com/viewer?a=v&pid=sites&srcid=aGFyZGluZy5lZHV8dGVhbS0zOTM3fGd4OjUyNzdiNzRkNjkxNjA3MGM https://www.youtube.com/watch?v=JEpWlTl95Tw https://www.youtube.com/watch?v=UR0hOmjaHp0 http://robotics.stackexchange.com/questions/167/what-are-good-strategies-for-tuning-pid-loops

PID Proportional Constant multiplied by error (offset) The larger this is, the faster the robot approaches the setpoint (smaller rise time)

PID Proportional Integral Constant multiplied by error (offset) The larger this is, the faster the robot approaches the setpoint (smaller rise time) Integral Constant multiplied by integral of all previous error values The larger this is, the less overshoot and settling time (less bounce)

PID Proportional Integral Differential Constant multiplied by error (offset) The larger this is, the faster the robot approaches the setpoint (smaller rise time) Integral Constant multiplied by integral of all previous error values The larger this is, the less overshoot and settling time (less bounce) Differential Used to eliminate steady state error (reducing offset after movement)

PID Proportional Integral Differential Constant multiplied by error (offset) The larger this is, the faster the robot approaches the setpoint (smaller rise time) Integral Constant multiplied by integral of all previous error values The larger this is, the less overshoot and settling time (less bounce) Differential Used to eliminate steady state error (reducing offset after movement)

PID Tuning

PID Tuning Several methods available Ziegler–Nichols* Tyreus Luyben Cohen–Coon Åström-Hägglund Manual Tuning* http://faculty.mercer.edu/jenkins_he/documents/TuningforPIDControllers.pdf#page=6 https://www.youtube.com/watch?v=JEpWlTl95Tw https://www.youtube.com/watch?v=UR0hOmjaHp0 http://robotics.stackexchange.com/questions/167/what-are-good-strategies-for-tuning-pid-loops Ziegler-Nichols: http://robotsforroboticists.com/pid-control/ Manual (page 16): https://docs.google.com/viewer?a=v&pid=sites&srcid=aGFyZGluZy5lZHV8dGVhbS0zOTM3fGd4OjUyNzdiNzRkNjkxNjA3MGM http://www.ni.com/white-paper/3782/en/

PID Tuning Manuel Ziegler-Nichols Raise CP Until robot oscillates about setpoint Raise CD Until Robot stops bouncing Raise CI (and change the setpoint) until robot turns and hits the target point Ziegler-Nichols Raise CP Until robot oscillates (Value of CP becomes Ku) Measure the period of this oscillation (Time to complete 1 cycle becomes TU)

PID Tuning Manuel Ziegler-Nichols Raise CP Until robot oscillates about setpoint Raise CD Until Robot stops bouncing Raise CI (and change the setpoint) until robot turns and hits the target point Ziegler-Nichols Raise CP Until robot oscillates (Value of CP becomes Ku) Measure the period of this oscillation (Time to complete 1 cycle becomes TU)

PID Tuning Manuel Ziegler-Nichols Raise CP Until robot oscillates about setpoint Raise CD Until Robot stops bouncing Raise CI (and change the setpoint) until robot turns and hits the target point Ziegler-Nichols Raise CP Until robot oscillates (Value of CP becomes Ku) Measure the period of this oscillation (Time to complete 1 cycle becomes TU)

PID Demo

Functional Global Variable

Functional Global Variable Quick Intro https://frclabviewtutorials.com/fgv/ demo

Functional Global Variable Code FGV Functional Global Variable Code

Implementing An FGV

Architectures State Machine

Architectures State Machine

Architectures State Machine

Architectures State Machine Producer-Consumer Parallel loops First creating data or instructions Other handling

Architectures State Machine Producer-Consumer Parallel loops Use either queue or fgv

Producer Consumer Demo Queue and FGV

Encoders Wiring (see notes for links) Rotational Encoders Fly wheel speed Drive distance Linear Encoders Linear actuator feedback Etc. https://www.chiefdelphi.com/forums/showthread.php?t=133263 https://www.andymark.com/encoder-p/am-3314.htm https://www.andymark.com/product-p/am-2992.htm

Encoders – Fly Wheel monitor demo

Questions