Session Objectives: Review basic math for single swerve module

Slides:



Advertisements
Similar presentations
US First Robotics Lab View Tutorials Jim Thomas Lawrence Berkeley National Laboratory Team 496 Port Jeff Powerhouse.
Advertisements

Proportional, Integral, Derivative Line Following October 5, 2013.
Feedback Control Systems Dr. Basil Hamed Electrical & Computer Engineering Islamic University of Gaza.
Add and Use a Sensor & Autonomous For FIRST Robotics
Jeff Beltramo NHTI-Concord’s Community College FRC Team 1922.
1. 2 LabVIEW for FRC Doug Norman National Instruments January 6, 2012.
Loop Shaping Professor Walter W. Olson
Mechanics of Machines Dr. Mohammad Kilani
Half-angle formulae Trigonometry.
Available at: – Program Optical Quad Encoders in Autonomous Mode Program optical quad encoders in autonomous mode.
Evolving Driving Controllers using Genetic Programming Marc Ebner and Thorsten Tiede.
FRC LabVIEW Software Overview Joe Hershberger Staff Software Engineer National Instruments.
Mobile Robotics: 11. Kinematics 2
Lynbrook Robotics Team, FIRST 846 Control System Miniseries - Summary of Lecture /03/2012.
Graphical Analytical Component Method
1 CMPUT 412 Motion Control – Wheeled robots Csaba Szepesvári University of Alberta TexPoint fonts used in EMF. Read the TexPoint manual before you delete.
GIRLS Robotic Camp. Let’s Begin Meet and Greet – Camp leaders introduce themselves – Students introduce themselves.
Weston Schreiber & Joshua Gabrielse Robotics Summer Training Programming #1: EasyC Basics.
LabVIEW Workshop September 26, 2009 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp.
Teacher/Mentor Institute Using easyC Joel Kirkland July 30-31, 2015.
Vectors & Scalars Vectors are measurements which have both magnitude (size) and a directional component. Scalars are measurements which have only magnitude.
Autonomous Robot Project Lauren Mitchell Ashley Francis.
FRC Robot Framework Labview Made Easy (er) For FIRST Robotics 1.
Trigonometric Equations M 140 Precalculus V. J. Motto.
Vectors & Scalars.
Gyro Turns ADVANCED EV3 PROGRAMMING LESSON By Droids Robotics
Southern Taiwan University of Science and Technology
David GiandomenicoFeedback Control for your FIRST Robot’s DrivetrainDec 2010 WRRF Workshops #1 David Giandomenico Team mentor for Lynbrook Robotics – Team.
Robot sensors MVRT 2010 – 2011 season. Analog versus Digital Analog Goes from 0 to 254 Numerous values Similar to making waves because there are not sudden.
Slide 9- 1 Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Rotational Motion 2 Coming around again to a theater near you.
Motion basics Chapter 1 Mr. Whitney. Sign Convention & Direction Motion has a 1) Direction 2) Magnitude - How much motion has or is occurring Positive:
FRC Robot Programming 1.PID Continued 2.Downloading and Deploying Code 3.Program a 2012 Robot from Spec Basic code For FIRST Robotics.
By Droids Robotics Line Followers: Basic to Proportional ADVANCED EV3 PROGRAMMING LESSON © 2015 EV3Lessons.com, Last edit 4/5/
Vector components and motion. There are many different variables that are important in physics. These variables are either vectors or scalars. What makes.
Find the Mindstorms Icon on the computer.. To start a new program click go.
Swerve Drive Software Design. Software Layers Joystick Axis Correction Joystick Response Calculation Field-oriented Angle Adjustment Swerve Drive Steer.
Physics VECTORS AND PROJECTILE MOTION
Chapter 3 Vectors in Physics.
EV3 Software EV3 Robot Workshop
RobotC Remote Control. Learning Objectives: Focusing on Virtual World with Physical Examples Understand Real-Time Joystick Mapping Understand how to use.
ROBOTC Software EV3 Robot Workshop
Mathematical Vector Addition. Mathematical Addition of Vectors The process of adding vectors can be accurately done using basic trigonometry. If you.
The Trigonometric Way Adding Vectors Mathematically.
ROBOTC Software EV3 Robot Workshop Lawrence Technological University.
2 - Pointer Speedometer Display 2 - Pointer Speedometer Display The speedometer on a car is traditionally a circular dial using around 270° of the arc.
Trigonometry and Applications References: xyz. Motivation Our character movements so far: Other types of movement:
Get your software working before putting it on the robot!
7-6 Solving Trigonometric Equations Finding what x equals.
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
Creating Flexible, Script-Controlled Autonomous Software Example Explanation.
Polar Coordinates Polar and Rectangular Coordinates Packet 3.
TRIGONOMETRIC FUNCTIONS OF ANY ANGLE
Chapter 10 - Rotational Kinematics
Oblique Triangles and Vectors
PID Controllers Jordan smallwood.
4.1 Vectors in Physics Objective: Students will know how to resolve 2-Dimensional Vectors from the Magnitude and Direction of a Vector into their Components/Parts.
DC MOTOR SPEED CONTROL 1. Introduction
Physics VECTORS AND PROJECTILE MOTION
College Physics Chapter 1 Introduction.
Line Followers: Basic to Proportional
Robot Kinematics We know that a set of “joint angles” can be used to locate and orientate the hand in 3-D space We know that the joint angles can be combined.
Kinematics Vectors and Motion
Line Followers: Basic to Proportional
Vector Addition How to resolve vectors into components and algebraically add them using a spreadsheet.
Physics VECTORS AND PROJECTILE MOTION
Physics VECTORS AND PROJECTILE MOTION
Advanced LabVIEW
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
PID Line Follower.
Presentation transcript:

Session Objectives: Review basic math for single swerve module Identify special cases that need to resolution. Discuss how to program in Labview In a “simulation” mode – no cRio required. Now Open Labview (for later)

Unicorn – fully independent drive allows Strafe + Rotation “Superposition” – Vector Addition = + “Unicorn” or Fully Independent Swerve Each wheel to be driven and steered independently, Also able to turn infinite rotations 8 motors required, requires 4 PID Feedback controls Strafe Rotate Demo the “Swerve Tester 8” spreadsheet Make Labview program that reads XYZ Joystick input and sets angle and speed indicators

Swerve Kinematics (how things move) X and Y are the Joystick input movements w is the amount and direction of rotation Twist (Z axis) of the joystick. From those driver inputs we need to figure out how each wheel should aim and how fast to drive each. Figure and derivation from “Ether” from Chief Delphi Forums

All the Math You Need (and it is powerful): For Robot: Let’s agree to set 0o at top so a forward motion is in the 0o direction Trigonometric Functions: X = R * Cos (q) Y = R * Sin (q) Y/X = Tan (q) (q) = arcTan (Y/X) 2p radians = 360 degrees Use p/180 to convert degrees to radians Pythagorean Theorem: R2 = X2 + Y2 0o (360o) R Y q 90o X -90o (270o) 180o (-180o)

For Strafe Actions – No Rotation – Vector Sum of X and Y X and Y are the Joystick input movements Each wheel has same angle and speed X1=X2=X3=X4 =X Y1=Y2+Y3=Y4 = Y R1=R2=R3=R4 = R q1= q2=q3=q4 =q (angle from Fwd direction) Convert to the wheel angle and speed This is the same as converting cartesian coordinates to polar coordinates R = SQRT(X2 +Y2) q = ArcTan(X/Y) (Based on q from fwd direction) Y3 X3 R3 q4 Y4 X4 R4 q4 Y X R q Y1 X1 R1 q1 Y2 X2 R2 q2

For Strafe Actions Labview Implementation Y R = SQRT(X2 +Y2) q = ArcTan(X/Y) Caution on obtaining ArcTan(): ArcTan (X/Y) = Arctan (-X/-Y) , or are they? For X=1 and Y = 1 Arctan is -45 degrees. For X = -1 and Y=-1 Labview and calculators will return -45 degrees – but there are 2 solutions, and 135 degrees is what you want. Need to read signs of the X and Y component to adjust Arctan to correct quadrant. q= -45 q= 135 -X X -Y

For Rotation - Each wheel position will have different angle w is twist of joystick which gives desired amount and direction of rotation Positive twist directs wheel to be rotated to tangent to the center of the robot Q (Theta) is rotation angle = -ArcTan(A/B) For 2012 frame orientation – A=20 in, B = 24 in. Q = -140 degree (or 40) Negative twist Rotates vector 180 degrees to +40 degrees Advanced concept: Or can leave angle at -140 degrees and reverse voltage/speed to motor Therefore 2 possible solutions – code can evaluate which one is quickest (least change in theta) A w B Y1 X1 R1

For Rotation - Each wheel position will have different angle w is twist of joystick which gives desired amount and direction of rotation For rotation each wheel is directed tangential to center of robot R1=R2=R3=R4 = magnitude of w q1= -ArcTan(B/A)-90 q2= ArcTan(B/A)-90 q3= ArcTan(B/A) + 90 q4= -ArcTan(B/A)+90 X1 = R1*Sin(q), Y1 = R1*Cos(q) If w is negative then q is plus 180 or can reverse voltage/speed ( R ) to motor 2 solutions possible ! Y4 X4 R4 q4 Y3 X3 R3 q3 w B Y2 X2 R2 q2 A Y1 X1 R1 q1

Superposition (Vector Sum) Now add the X and Y components for rotation + strafe at each wheel, Then find the polar coordinates R, Theta Normalize the four R’s (1 at each wheel) to a max of 1.0, keeping proportion between them Y1 X1 R1 q1 Y1 X1 R1 q1 q1 + = Y1 R1 X1 Strafe Rotation Resultant

Program Elements - Summary Read Joystick Input Strafe – X & Y Rotation - Z Identify each wheel location rotation angle to achieve robot spin Each wheel aimed to be at a tangent to the center of rotation At each wheel superposition of strafe and rotation X & Y components Convert to Polar Coordinates (R & q = wheel speed and steering angle) Get each wheel angle, Normalize angle to between -180 & 180 degrees Get each wheel speed, - need to normalize wheel speeds to max of 1.0 Read Gyro Setting and adjust X&Y’s for field centric steering Set drive motors – synchronize Read steering encoder/potentiometer – normalize reading to within 180 to -180 degrees. Set steering motors – PID control with encoder/potentiometer feedback Set PID error to the lessor of 1) target minus encoder reading, or 2) target minus encoder reading +/- 180 degrees. If latter is used reverse polarity to drive motor. Watch the 180 to -180 crossover avoid false error Elements included in Labview Simulator

Labview Simulation Mode (no cRio req’d) Use dials and slide controls to mimic Joystick and sensor inputs Us gauge and slide indicators to simulate output actuators – motors etc. Then can debug much of the logic involved without having a cRio /Robot handy

Front Panel of LV Custom Swerve Simulator: Control dial simulates Gyro reading input Control dial simulates Twist of Z axis on Joystick Slider Controls simulate X & Y Joystick Inputs Indicator Dials show the 4 wheel angles based on the X, Y & Z inputs Additionally adjusted for the Gyro input Slider indicators show the rotational speed of each wheel. Mathematical relationships between input controls and output indicators based on prior slides.

Challenge! If you gotten this far maybe you are ready to try to make the Labview simulator yourself! Bring to cruise night. The math is all in the prior slides – it is just a matter of converting those equations into Labview relations. A hint is that you can use some functions blocks already defined within the “Holonomic drive” function block, in cartesian mode I found the rotate vector block and the normalize 4 function useful Caution - DO NOT MODIFY the holonomic or other premade function blocks - but you can copy elements from within the function block and paste into your own vi.

Open new robot project, move ‘team code’ from cRio target to My Computer, Open Tele-op and add While loop (get rid of arcade drive functions)

Add input dial and slider to control panel, and put inside loop Align the dials in the block diagram while loop We will next determine motions for one wheel, then adjust for other positions

Add the “Strafe” relationships, and add Indicator gauges to show output – simulating how motors would steer and drive – 1 wheel Run it! (Crab drive – all 4 wheels can be steered with one steering motor, no robot rotation)

Single Wheel Control (Position 1 – Rear Left Wheel) Strafe + Rotation Run it - any problems? - add the digital display to the R indicator See how the X&Y inputs combine with the Z twist proportions

4 wheel positions – each appear same except for Rotation Steering Angles

Front Panel – 4 wheels Note that R values are >1. 0, All above 1 Front Panel – 4 wheels Note that R values are >1.0, All above 1.0 will saturate to same level – Need to “Normalize” R’s

Let’s Make Life Easier! In a vi place a Holonomic Drive – cartesian – (This is what we used to drive our Mecanum system in 2011, it is found in the WPI Robot Library) Then look inside it (double click it) See the “normalize 4” function block – see how it works – let’s use it

4 wheel positions – but not field centric

Front Panel – 4 wheels – Max Speed Normalized – no gyro (or field centric steering)

Again we will copy prior blocks to achieve field centric steering Once again look in the Holonomic Drive block Look at the “Rotate Vector” block - see how it works?

Final Block Diagram (Gyro & Rotate Vector Added) To convert to Robot code: Replace the input dials with Joystick reads, Eliminate the while loop (the teleop vi is inside a while loop in Robot Main) Add the drive motor speeds from the R’s And set up PID control for the 4 steering motors with targets of the thetas and reading encoders on each steering motor.

Final Front Panel

Absolute Encoder Provides Steering Feedback Read encoder and add indicator to front panel Add to dashboard

PID Control and Special Considerations PID target Check if going through 0-360 is shorter Next check to go max of 90 degree turn and reverse speed if greater than 90 degrees. Hiccup going though zero…. Dead-band