Program your face off

Similar documents
Git, the magical version control

Making a One Degree Motor Arm with Potentiometer and PID

General Syntax. Operators. Variables. Arithmetic. Comparison. Assignment. Boolean. Types. Syntax int i; float j = 1.35; int k = (int) j;

Software Development I

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)

1. Which of these Git client commands creates a copy of the repository and a working directory in the client s workspace. (Choose one.

Last Updated: SHUFFLEBOARD

Git Introduction CS 400. February 11, 2018

Sphero Lightning Lab Cheat Sheet

Robot Code Review. Welcome!

Git. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes

git commit --amend git rebase <base> git reflog git checkout -b Create and check out a new branch named <branch>. Drop the -b

Github/Git Primer. Tyler Hague

Getting Started with the FTC SDK. Jaxon Brown August 5, 2017

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018

Autonomous Programming FTC Challenge Workshops VCU School of Engineering September 24, 2016 Presented by: Team 8297 Geared UP!

b. Developing multiple versions of a software project in parallel

Assignment 2.4: Loops

Lecture 6 Remotes. Sign in on the attendance sheet!

The Old World. Have you ever had to collaborate on a project by

EV3 Programming Workshop for FLL Coaches

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 11, 2017

Lab 7: PID Control with Trajectory Following

CompSci 125 Lecture 11

FAQ Q: Where/in which branch do I create new code/modify existing code? A: Q: How do I commit new changes? A:

Version Control for Fun and Profit

Git Workbook. Self-Study Guide to Git. Lorna Mitchell. This book is for sale at

Part A: Monitoring the Rotational Sensors of the Motor

PROGRAMMING FUNDAMENTALS

MANUAL FOR RECTILINEAR AND TORSIONAL POSITION CONTROL SYSTEM Prof. R.A. de Callafon, Dept. of MAE, UCSD, version

SPARTAN ROBOTICS FRC 971

Git for Subversion users

Overview. 1. Install git and create a Github account 2. What is git? 3. How does git work? 4. What is GitHub? 5. Quick example using git and GitHub

ROBOTICS AND AUTONOMOUS SYSTEMS

Git. CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015

Last Updated: ROBOTBUILDER

COMMAND BASED PROGRAMMING

Robotics and Autonomous Systems

Robotics and Autonomous Systems

Last Updated: ROBOTBUILDER

ECE 122. Engineering Problem Solving with Java

Midterm Review Topics Java Basics and Structure Variables Branching Loops Methods Arrays. Midterm Review Kage Weiss Lab 001 TA, SPR 17

PID Controller application in robotics. Victor Abreu A /5/2013. Executive Summary:

Git Workflows. Sylvain Bouveret, Grégory Mounié, Matthieu Moy

AVOIDING THE GIT OF DESPAIR

Chapter 4 Lab. Loops and Files. Objectives. Introduction

Version Control. Second level Third level Fourth level Fifth level. - Software Development Project. January 17, 2018

Positional Motion Profiling for FRC

Version Control Systems

Lecture Set 4: More About Methods and More About Operators

Tips on how to set up a GitHub account:

SECTION 1: CODE REASONING + VERSION CONTROL + ECLIPSE

Revision control. INF5750/ Lecture 2 (Part I)

Text Input and Conditionals

Accelerating Information Technology Innovation

Movement using Shaft Encoders

Review. Primitive Data Types & Variables. String Mathematical operators: + - * / % Comparison: < > <= >= == int, long float, double boolean char

Version Control. Collaborating with git. Tim Frasier

Variables and Functions. ROBOTC Software

Controller. Network-Compatible Products, Controller F-9 F-9 SCX11. Overview of Controllers F-10 SCX11 F-12. Network- Compatible Products Overview

Last Class. While loops Infinite loops Loop counters Iterations

A L A TEX-oriented intro to Git

Version Control. Version Control

Java 101 Build Season Code Standards. OCT

Create Open Interface Scripts: Using the Create Without an XBC

Lecture Set 4: More About Methods and More About Operators

Loops. CSE 114, Computer Science 1 Stony Brook University

Introduction to Programming Using Java (98-388)

TDDC88 Lab 4 Software Configuration Management

Using GitHub for scientific research

Git. Presenter: Haotao (Eric) Lai Contact:

Git. all meaningful operations can be expressed in terms of the rebase command. -Linus Torvalds, 2015

Build and Test Plan: IGV Team

Effective Software Development and Version Control

The Big Python Guide

Submitting your Work using GIT

University of Texas at El Paso Electrical and Computer Engineering Department. EE 3176 Laboratory for Microprocessors I.

CS1004: Intro to CS in Java, Spring 2005

Midterm Next Week. Last year s midterm (which didn t include remotes):

Ex: If you use a program to record sales, you will want to remember data:

CSE 142 Su 04 Computer Programming 1 - Java. Objects

Git. A Distributed Version Control System. Carlos García Campos

Version Control with Git ME 461 Fall 2018

Motion Graphs. Plotting position against time can tell you a lot about motion. Let's look at the axes:

Revision Control and GIT

Introduction to the Java Basics: Control Flow Statements

Continuous Delivery the hard way with Kubernetes. Luke Marsden, Developer

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

How to version control like a pro: a roadmap to your reproducible & collaborative research

Computer Programming I - Unit 5 Lecture page 1 of 14

CS313D: ADVANCED PROGRAMMING LANGUAGE

Version control CSE 403

C++ DATA TYPES BASIC CONTROL FLOW

Using git to download and update BOUT++

Introduction to Version Control using Git

COMPUTER SCIENCE LARGE PRACTICAL.

CS 177 Week 5 Recitation Slides. Loops

MS4SSA Robotics Module:

[Software Development] Development Tools. Davide Balzarotti. Eurecom Sophia Antipolis, France

age = 23 age = age + 1 data types Integers Floating-point numbers Strings Booleans loosely typed age = In my 20s

Transcription:

Program your face off

Game plan Basics of Programming Primitive types, loops, and conditionals. What is an Object oriented language? Tips and tricks of WPIlib Iterative and Command Based robots Feedback devices(encoders, Cameras, Sensors) Motion Controllers(Bang-bang, Hold Heading, PID Loops, Motion Profiling) Version Control and Subteam Management

Basics of Programming:

What is an object oriented language? Object Oriented Programming is a form of programming that relies on the idea of objects which contains data in its fields, and has different functions in its methods. The Object instantiated would be Car. Its fields would be max speed, fuel, tire pressure, price, etc. Its methods would be functions such as driving, setting speed, retrieving speed, refueling, and getting the amount fuel left in the tank.

Field data types Primitive types: Boolean - value that only reads out as true or false. Char - all singular characters, usually kept between, can be put together to make a string. Int - an integer with a value between -2,147,483,648 and 2,146,483,648 Long - an integer with a larger value range than an int Float - integers with decimals or decimals. Double - a larger and more precise Float String - an array of chars

Loops Just like Other Object oriented languages java contains these kinds of loops: For and While loops. For loops A single loop given parameters and test cases that will determine how many times it will run. The test is a limit to dictate how many times the loop will run (Stopping when the test is false) The parameters are an initial value and an incrementation of that same value. While loops Another type of loop that is responsible for repetitive actions Only takes one case as an argument that will determine whether or not the loop will run again, stopping when the case is false.

For Loop Examples for(initialization ; test; update){ Statement; } Now here is a real time example for(int i = 1; i <= 125; i++){ } System.out.println(i + Nutron ); // what does this print out

While loop Examples while(test){ statements; } Real example: while(a <= 10){ a++; }

Method writing access returntype methodname(parameters) { Function of the Method }

Method writing example public int multiplybytwo(int n) { return n * 2; }

Conditionals Conditionals are boolean variables used to evaluate conditions. They use True or False values to determine what expression is evaluated. If-Else statements are a form of conditionals that take in a condition and if it's true it runs a set expression that corresponds to that condition being true. If that condition is not true then it will run an expression under Else.

Conditional Example Int U == 7; if (U == 8){ System.out.println( This won't happen ); //If True } Else{ System.out.println( 8 does not equal 7 ); //If False }

Different types of Robots: Iterative and Command based

Iterative based Easy state transitions between two methods Init() methods Called only once Periodic() methods Called multiple times, once for each loop of the code Updates at 20 ms Also parameters and functions to be continuously updated

Command Based Uses the same base concept idea of the iterative robot Introduces the concept of Commands Commands are a special type of object that is made once for a single action(s) then deleted. Communicates directly with your subsystems. Has a init() method to help setup whatever the execution is Has an execute() method to run the commands desired action Has a end() method to clean up and revert things back to whatever Has a interupted() method to do an action just in case of interruption Can be used throughout the class and communicates with the robot's operator interface (OI) for teleop control.

Subsystem, Robot Map, and the Operator Interface Your Robot type communicates directly with your different Subsystems Your Subsystems communicate with your Robot Map to properly instantiate the different pieces of a subsystem (actuators, sensors, control) Your Operator Interface lays out your controllers and buttons and what subsystems they interact with to actually achieve something

Feedback Devices

Encoders A feedback device that allows for tracking of how much a motor has turned Counts in ticks per revolution, usually a 4 digit number for preciseness Can be used in correspondence with wheel circumference to determine the distance travelled Can be used for pretty much any type of precise motor control in conjunction with different motor control (explanation for later)

Encoders example public void driveinches(double inches, double wheelcircumfrence, double ticksperrev), { } if((inches / wheelcircumfrence) * ticksperrev > encoder.pos()){ } drive(1.0);

Cameras and Vision

IMU s (Gyros and Accelerometers) Feedback sensor that allows for the ability to track the angle and position of your robot. They measure: Angle Roll(X axis) Pitch(Y axis ) Yaw(Z axis ) Acceleration Gyro s and Accelerometers can be used for control

Control Theory

Introduction to Control Theory Making a physical system do what you want Using sensors and actuators to go to specific goal System - physical system with both actuators and sensors Have an internal state State - all variables needed to describe a system s operations Position, velocity, output voltage, etc Sensor - device used to measure the state of a system Encoder, gyro, etc Actuator - device used to affect state of a system Motors, etc

Bang Bang Controller Start will a goal position Which way do you need to go to get there? Positive direction Full forwards signal Negative direction Full backwards signal Results in massive oscillations ( vibrations ) around the goal Puts stress on certain systems Shooters can be effectively controlled by a bang-bang controller

Crash Course Calculus: Derivatives Instantaneous rate of change Slope of a function How fast is something changing? Can find the velocity from the position Can find the acceleration from the velocity

Crash Course Calculus: Integrals Area underneath a function of time between two specific points Find velocity from acceleration Find position from velocity Be aware of your units, and make sure they are intuitive

PID Loop error = goal - position Three parts of the calculation: (P)roportional Drive towards the goal (I)ntegral Builds up over time (D)erivative Slows down when moving too fast

PID Function

PID Function Continued Using an elevator as an example, your goal is to move to a specific position Output will be between -12 V and 12 V Think of your gains in terms of units Output u is in volts, error e is in meters gainp will have what units? Knowing units makes guessing gains much more reasonable

PID Tuning 1. Increase kp until the system starts to oscillate (move back and forth around a point) 2. If system isn t holding, increase kd until the oscillations stop 3. If there is steady state error (not reaching the goal in time), increase ki Start slow, and be conservative. Can very easily break a system

Hold Heading public void holdheading() { if(getheading() > headingsetpoint) { // Increase power to the left } if(getheading() < headingsetpoint { // Increase power to the right } }

GitHub and Team Code Organization

What is GitHub? GitHub is a version control and code repository website where groups and organizations can create code repositories for projects, like a particular year s robot code.

Setting up a Code Base

Repositories Repositories are code bases usually kept within organizations. Repositories usually consist of code for a singular project, multiple people can work on it at once under different branches. It's always good practice to keep the working code on the master branch and all other code currently in work on other branches to be merged later.

Branches and Version Control Branches are like mini version of your repository used to implement new features into your core code base The master branch is the main branch of your code base and should always be up to date When a feature is completed in a branch, it then merges with master

Git Bash Crash Course You can use the Git Bash to commit(add your code to the current repository) using git bash. Learning the bash is easy and gives you a lot more control over the process. Git User Branch Name

Git Bash Crash Course Cont. Use the command git status to view the changed files you have been working on locally. Changes that aren't staged to be committed(ready to be uploaded to the repository) will be in red

Git Bash Crash Course Cont. Git add is the next command you would use, type git add (file name) for whatever local files you want to be committed. Then git status again to see the files tracked to commit in green. Files tracked are now in green.

Git Bash Crash Course Cont. Now it's time to add your commit message. Your commit message should be what you did/edited in the code. Type git commit -m (commit message) and press enter. It shows how many files you changed as well

Git Bash Crash Course Cont. Now type git push, and all your code would be pushed to the repository. Now your code is pushed!

Git Bash Crash Course, Tips and Tricks Other github commands that are useful are git diff, git checkout -b, git merge, git mv, and git pull. Git diff tells you the difference between live code and any edits you ve made recently. Git checkout -b [branch name] lets you make a new branch in the current repo. Git merge lets you merge the code in one branch into another. Git mv [original file] [new filename] lets you refactor a file name. Git pull allows you to pull code from a branch from the repository.

screenstepslive