Difference between revisions of "ECE597 Project Robot Control"

From eLinux.org
Jump to: navigation, search
Line 140: Line 140:
 
         rightHigh - When following a wall. This is the max distance you want the robot to get away from the wall when the wall is on the right side of the robot.
 
         rightHigh - When following a wall. This is the max distance you want the robot to get away from the wall when the wall is on the right side of the robot.
 
         leftHigh - When following a wall. This is the max distance you want the robot to get away from the wall when the wall is on the left side of the robot.
 
         leftHigh - When following a wall. This is the max distance you want the robot to get away from the wall when the wall is on the left side of the robot.
 +
        farfromright - This is the distance you want your robot to give up and start finding another wall on the right side
 +
        farfromleft  - This is the distance you want your robot to give up and start finding another wall on the right side
 +
 +
        - The following two commands deal with the motor control of the robot. The farther apart they are the faster it turns away/toward a wall. The higher the number, the faster the overall operation is.
 +
        low_PWM  - When turning away from the wall the robot slows a motor down to this low_PWM to have a slight turn.
 +
        high_PWM - This is the max level the motors run at.
  
 
== Highlights ==
 
== Highlights ==

Revision as of 05:34, 18 November 2014

thumb‎ Embedded Linux Class by Mark A. Yoder


Team members: Alexandre van der Ven de Freitas, Eric Taylor

Grading Template

I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

00 Executive Summary
00 Installation Instructions 
00 User Instructions
00 Highlights
00 Theory of Operation
00 Work Breakdown
00 Future Work
00 Conclusions
00 Demo
00 Late
Comments: I'm looking forward to seeing this.

Score:  10/100

(Inline Comment)

Executive Summary

The objective of this project is to create an autonomous Robot based on Beaglebone Black. The robot's structure is consisted basically of two parallel back tractioned wheels, a guideball on the front, 3 Infrared rangefinders and two digital rotation encoders.

The Magician Robot encoder from Sparkfun is successfully working and being read by a python script as well as the Infrared distance sensors.

The IR distance sensors can be a little tricky to deal due to their non-linear nature, but putting them 10 centimeters away from the edge fixes the issue or compensating the distance from the edge to the actual distance measured.

End with a two sentence conclusion.

The sentence count is approximate and only to give an idea of the expected length.

Packaging

If you have hardware, consider Small Build, Big Execuition for ideas on the final packaging.

Installation Instructions

This project was developed in python which has a simple API created by Adafruit called Beaglebone Black IO - BBIO.

To install Adafruit's BBIO follow the instructions below. These installation instructions are for Debian and Ubuntu distributions:

1 - Update your Operating System and install the dependencies:

bone$ sudo apt-get update
bone$ sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus -y

2 - Next install the BBIO:

bone$ sudo pip install Adafruit_BBIO

3 - Verify if the BBIO was installed properly:

bone$ sudo python -c "import Adafruit_BBIO.GPIO as GPIO; print GPIO"
# You should see the following message:
bone$ <module 'Adafruit_BBIO.GPIO' from '/usr/local/lib/python2.7/dist-packages/Adafruit_BBIO/GPIO.so'>

If the previous installation method fails, install it manually:

1 - Update and install the depencencies:

bone$ sudo apt-get update
bone$ sudo apt-get install build-essential python-dev python-pip python-smbus -y

2 - Clone the BBIO's git repository and change into the directory it was downloaded into:

bone$ git clone git://github.com/adafruit/adafruit-beaglebone-io-python.git
bone$ cd adafruit-beaglebone-io-python

3 - Install the API and remove the installation file:

bone$ sudo python setup.py install
bone$ cd ..
bone$ sudo rm -rf adafruit-beaglebone-io-python

The specifics on how to use this API in Python can be found on the following link provided by Adafruit.

The python scripts used on the project can be found in this git repository.


  • Be sure your README.md is includes an up-to-date and clear description of your project so that someone who comes across you git repository can quickly learn what you did and how they can reproduce it.
  • Include any additional packages installed via opkg. // Probably won't be necessary.
  • Include kernel mods. // Probably won't be necessary.
  • If there is extra hardware needed, include links to where it can be obtained.

User Instructions

Once everything is installed, how do you use the program? Give details here, so if you have a long user manual, link to it here.

Two possible ways this will be implemented:

1. Manually run the main python script to start the robot.

2. Change the init.d file to start running the python script on boot.

Programming Tools and Instructions

Our group used python as the base for our program and you can do multiple tings with the code base that is in Github

motorControl.py

   -In our motor control code we setup functions that the user can use to properly set the PWM to make the robots move in specific directions. The following is included in the file
   stop()
       -This command stops all PWM pins thus stopping the robot.
   forward()
       - This command starts moving the robot forward. It does not stop the robot.
   backward()
       - This command starts moving the robot backward. It does not stop the robot.
   left()
       - This command starts turning  the robot left using one motor.
   right()
       - This command starts turning the robot right using one motor.
   leftb()
       - This command starts turning the robot left using both motors.
   rightb()
       - This command starts turnning the robot right using both motors.
   right_delay(delay)
       - This command turns the robot right for a specific amount of time, delay, using only one motor.
   left_delay(delay)
       - This command turns the robot left for a specific amount of time, delay, using only one motor.
   rightb_delay(delay)
       - This command turns the robot right for a specific amount of time, delay, using both motors.
   leftb_delay(delay)
       - This command turns the robot left for a specific amount of time, delay, using both motors.

run

   - This small program is used to test out the motor control functions and to conferm the motor pins are connected correctly.

IRread.py

   - This program reads the sensor values for the IR sensors off the analog pins and returns thier value, and also calculates distance from that value. This file contains two useful functions
   Out1, Out2, Out3, Out4, Out5, Out6 = IRread()
   distance = distanceCalc(out)

read

   - This small program prints out the read values from the IR sensors. This is useful for finding the correct voltage multiplier and judge distances with the sensor. Essentially seeing what the robot is seeing

AI_seq.py

   - This file contains our basic AI. This program finds a wall and then hugs it. If it unhuggs a wall if it gets to far, the robot finds another wall.
   The following options are changeable
       frontLow - This is the lower bond on distance you want your front sensor to read. The higher the number, the larger the buffer you give the robot.
       rightLow - This is the lower bond on distance you want your right sensor to read. The higher the number, the larger the buffer you give the robot.
       leftLow  - This is the lower bond on distance you want your left sensor to read. The higher the number, the larger the buffer you give the robot.
       rightHigh - When following a wall. This is the max distance you want the robot to get away from the wall when the wall is on the right side of the robot.
       leftHigh - When following a wall. This is the max distance you want the robot to get away from the wall when the wall is on the left side of the robot.
       farfromright - This is the distance you want your robot to give up and start finding another wall on the right side
       farfromleft  - This is the distance you want your robot to give up and start finding another wall on the right side
        - The following two commands deal with the motor control of the robot. The farther apart they are the faster it turns away/toward a wall. The higher the number, the faster the overall operation is.
       low_PWM  - When turning away from the wall the robot slows a motor down to this low_PWM to have a slight turn.
       high_PWM - This is the max level the motors run at.

Highlights

Here is where you brag about what your project can do.

Include a YouTube demo.

Theory of Operation

Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.

Work Breakdown

List the major tasks in your project and who did what.

Also list here what doesn't work yet and when you think it will be finished and who is finishing it.

1. Organize Breadboard circuit and test it: Alex. Completed Completed
2. Create codes to read the sensors and test the wheels: Alex Completed Completed
3. Create main code to run the robot: Alex and Eric. Work in Progress By 11/17
4. Design the PCB for the cape: Eric. Completed Completed
5. Solder the cape and test it: Eric. Completed Completed
6. Final robot assembly: Alex and Eric. Work in Progress By 11/17

Future Work

Suggest addition things that could be done with this project.

Conclusions

Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.




thumb‎ Embedded Linux Class by Mark A. Yoder