Download presentation
Presentation is loading. Please wait.
Published byDiana Hood Modified over 9 years ago
1
Team 5: DEATH Software Design Overview
2
Software Path Main/Startup Function –Initialize Peripherals –Setup RTI to call main program loop –Put processor to sleep until RTI fires
3
Main Program State Machine Based RTI based (not dependent on accurate timing) Main Program GuidancePIDSonarNetworking GPSWaypoint ReadATD Rotate Servo OpenTCP
4
Software Areas Guidance PID Sonar Network
5
Guidance Provides target for PID routine Communicate with GPS using SiRFBinary protocol Handles FIFO Waypoint queue
6
PID Control Proportional – Integral – Derivative Most Complex Branch Three complementary control schemes
7
Proportional Control Correction for set level to set point Correction factor is proportional to the error (Δ) Not accurate, results in an error offset.
8
Integral control Accounts for process deviation Measures ∫(Δ) over time, and corrects –∫(Δ) → 0 “Straight line over time”
9
Derivative control Measures how fast error is accumulating –dΔ/dt Fast error → Fast (large magnituge) correction Quick response to growing error
10
PID, all together now… Source: Programmable Logic Controllers, Fourth Edition, Prentice Hall PTR by John W. Webb Ronald A. Reis Accessed: http://zone.ni.com/devzone/conceptd.nsf/http://zone.ni.com/devzone/conceptd.nsf/ webmain/D211223AE3DE7E74862568110052F62F?OpenDocument
11
Software mechanism Read process Value (read ATD) Determine Proportional correction Update and determine integral correction Determine Derivative correction Calculate final correction Update drive Motor PWM
12
Pseudocode SetPoint = …// Desired process output IntegralState = 0; IntegralMax = …; IntegralMin = … // Keep track of accumulated error DerivState = 0// Keep track of derivative PGain = …; IGain = …; DGain = … // Tuning parameters PID( ) SetLevel = ReadATD(); Error = SetPoint – SetLevel Proporional= Error * PGain// Set proportional term IntegralState = IntegralState + Error // Set integral term, correct if outside bounds If( IntegralState > IntegralMax) Then IntegralState = IntegralMax Elsif( IntegralState < IntegralMin ) Then IntegralState = IntegralMin Integral = IntegralState * IGain Derivative= ( SetLevel – DerivState ) * DGain // Set derivative term DerivState = SetLevel SetPoint = Proportional + Integral – Derivative // Set new process output End PID
13
Sonar Sends out pulse and times with timer module Pulse code 100% ASM If obstacle found, moves into obstacle avoidance state Can rotate sonar via servo to track object while avoiding
14
Networking Connectionless UDP protocol to simplify coding Query/Command based protocol Common commands include New Waypoint, Start Moving, Get Location, Rotate Turret, and Fire. Video handled externally with network camera on same network
15
Basic States IDLE: Wait for coordinates WAIT: Accept new coordinates and wait for go MOVE: Go to coordinates in order AVOID: Obstacle avoidance
16
Obstacle Avoidance Substates Scan Left Scan Right Turn Tank Turn Servo Toward Waypoint Move Check Obstacle
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.