Project 2 - Create a Way-Point Traveling Robot

In this assignment, the robot is given a command relative to either a global reference point or the robot’s own perspective, and the robot must be able to move in accordance to the command, keeping track  of  its  global  position  at  all times. This movement of a robot to a specified point is commonly known as dead reckoning and has many useful applications in mobile robotics including unmanned exploration, search and rescue, and autonomous warehouse work.  The second ability this robot must have is to locate objects of specific color and determine their distances relative to the robot and each other.

Project Requirements

There are four basis commands which must be understood by this kind of robot:
  1. Rotate Relative - Rotate with respect to itself.
  2. Rotate Global - Rotate with respect to a reference point.
  3. Translate Relative - Move to a coordinate set with respect to itself.
  4. Translate Global - Move to a coordinate set with respect to a reference point.

In addition to these features, the robot must also be able to do the following:

  1. Locate a red or green can and display its coordinates with respect to itself.
  2. Locate a red or green can and display its coordinates with respect to a reference point.
  3. Locate one can and display its coordinates with respect to the other can.
  4. Hold a marker such that the robot's path is drawn onto a white board as it travels.

Mechanical Design

We decided to try and create a robot which could easily be altered for use in future projects. With that in mind, a small, front wheel, differential drive robot with a 6.25:1 gear reduction and rear castor wheel was constructed. While testing this robot, we noticed it sagged a bit in the middle due to the weight of the XBC, so two smaller tires were added underneath to help support it. A dry erase marker was also fitted down through the center of the robot so that it's path would be drawn on the white marker board.



Electrical Design

There really isn't much electrical design in this robot. The XBC is used as the controller, and an MCU camera is attached to the XBC to be used in color recognition and distance measurements. A sonar sensor is also placed on the front of the robot for distance measuring.

Technical Calculations

Saying "a lot of math went into this project" would be an understatement, but such is the way with robotics. To start, the distance traveled by the robot must be calculated by comparing a known amount of motor ticks (cycles, revolutions, etc) to the distance traveled to find the "motor ticks per inch" rate. The distance which will be traveled can then be calculated by multiplying the number of ticks by the ticks per inch rate. This would essentially be the same as monitoring the number of wheel rotations and multiply that by the wheel circumference, but the XBC uses back EMF, so the described method was used instead. For those of you who like equations, here you go:
  • If Monitoring Motor Ticks -> M ticks * K ticks/inch = S inches
  • If Monitoring Wheel Rotations -> R rotations * 2*pi*(wheel radius) = S inches

The really tricky part is the translation of global coordinates to local coordinates. It's like telling someone that the grocery store is a mile north of your house when they are 2 miles east of you at the park. Nothing a few more equations can't fix.

  • cos(theta) * X2Global + sin(theta) * Y2Global = X2Robot
  • cos(theta) * Y2Global - sin(theta) * X2Global = Y2Robot

In these equations, "theta" represents the angle the robot is turned with respect to the global reference point. The "X" and "Y' coordinates have a "2" after them to signify that they are the next coordinates and not the current coordinates.

Drawing shapes can be another point of confusion for some. For example, to create a circle of some given radius, each wheel must actually travel in a circle of radius plus or minus half the width of the robot. Our robot had a total width of 7.25 inches (from wheel to wheel), so to draw a circle with a radius of 10 inches, the inner wheel create a circle of radius 6.375" while the outer wheel's circle will have a radius of 13.625".







Afterthought

Overall, we were very happy with the project outcome. Our robot may have messed up a time or two during the demonstrations, but that is to be expected. It was out first mobile robot, and we learned a lot about how to plan what kind of decisions the robot should make - direction to rotate, speed of travel, etc. It was very interesting to see how differently every robot behaved when given the same type of commands. For example, when told to move from point A to point B, our robot would drive first in the "X" direction before rotating 90 degrees and driving in the "Y" direction. Other groups converted into polar coordinates instead of Cartesian, having their robots turn a calculated angle first, and then drive directly to point B. That way was more efficient travel but came so at a cost of more complicated programming and math.

The actual code used to control our robot was written in the "robot C" language used in the XBC. I'm not going to go over it here, because I didn't have much of anything to do with it! I built the robot and helped with the strategy, but didn't write any of the code. I do know that we used color blob tracking to find the colored objects and were actually able to determine their distance from the robot and overall coordinates using just the camera instead of using any distance sensors.







Comparing local and global coordinates and reference points can get confusing.



Our first mobile robot!




We tried to make it as compact as possible.



The sensors are in place.















The various circle radii.

































A Quick Side Note

One "trick" I learned from working on this project was the use of a dry erase marker and white board to track the robot movements. This can be very beneficial in testing how straight your robot actually drives. It can also be a big help in testing any sort of dead reckoning abilities you be using. This is a lot easier than using a measuring tape and guessing the exact start and stop points!