P' 1 - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

P' 1

Description:

Can hurt IR reception, shaft encoder counts, etc. Should keep number of threads small. ... shaft encoder ticks, motor power, course side, IR output) ... – PowerPoint PPT presentation

Number of Views:39
Avg rating:3.0/5.0
Slides: 18
Provided by: mattg
Learn more at: http://feh.osu.edu
Category:
Tags: encoders

less

Transcript and Presenter's Notes

Title: P' 1


1
Robot Programming Tips
  • Week 4 Day 2
  • By Matt Gates and James Beams
  • FEH Class of 1999

2
Robot Programming Tips
3
Limitations of the Handy Board
  • Limited memory (16K available for program code)
  • Limited CPU speed
  • Very slow floating point calculations (no
    floating point hardware)
  • Limited I/O (LCD screen, 7 analog, 8 digital
    ports)
  • Strategy Code must be small, fast, and make
    efficient use of the resources you have.

4
Limitations of the System
  • Controlling a mechanical system is much different
    than controlling a computer!
  • Why? System will never run the same way twice!
  • System runs in real time, independent of your
    program.
  • You must constantly monitor the system and ensure
    that what you want to happen is actually
    happening.
  • Test, test, and test some more!!!

5
Strategies I What NOT To Do
  • DO NOT write one large main ( )
  • DO NOT write code without error checking
  • DO NOT assume your code will work right
  • DO NOT use lots of memory or complex algorithms
  • DO NOT wait until the last minute to test your
    code

6
Strategies II Maintainable Code
  • Break your code into small segments (functions)
    that perform specific, simple tasks.
  • Example motors_half_speed ( )
  • Use symbolic constants (define) instead of
    literals.
  • motor (LEFT_SIDE, FULL_POWER)
  • NOT motor (1, 100)
  • Makes it easier to update your code if you make
    changes to the robot design or your goals.

7
Strategies III Getting Around
  • The most difficult part of your task will be
    getting from Point A to Point B.
  • Driving straight
  • Turning
  • Avoiding obstacles

8
Strategies III Getting Around
  • You should spend time developing and testing a
    routine that allows you to move around reliably.
  • Use shaft encoder data to keep wheels _at_ same RPM.
  • Shaft encoders can also help in turning.
  • Have adequate bump sensors and intelligent
    responses.

9
Pseudo code Example 1
  • The following pseudo code example is for a
    drive_straight function for a specific distance
    to be traveled and which corrects for uneven
    motor speeds.

10

11
Strategies IV Break up Course
  • The course can be handled more easily if you
    break it up into sections or tasks.
  • Ex Determine object values, navigate to and pick
    up object, navigate and drop off object.
  • Write code to handle each section separately.
  • Now you can test parts of the course
    individually.
  • Use the knob to select what section of code to
    execute.

12
Pseudo code Example 2
  • The following pseudo code example breaks the
    course (for that year) into six routines.

13
(No Transcript)
14
Strategies V Multithreading
  • IC can run more than one functional thread at
    once.
  • Useful to perform background monitoring while
    doing main tasks.
  • Ex Run drive straight code to make corrections
    to motor power while driving.

15
Strategies V Multithreading
  • The more threads running, the more CPU resources
    used.
  • Can hurt IR reception, shaft encoder counts, etc.
  • Should keep number of threads small.
  • See IC documentation on start_process ( ) for
    more info.

16
Strategies VI Testing
  • Thorough testing is essential!
  • Tips
  • Begin by testing individual course sections, then
    combine until you can do the whole course.
  • Use the LCD screen to output useful values (ex.
    shaft encoder ticks, motor power, course side, IR
    output).
  • Make sure your robot will work even if the
    battery charge is low.
  • Dont stop testing until the competition is over!

17
Grade Sheet for Pseudo Code / Flow Chart
Write a Comment
User Comments (0)
About PowerShow.com