Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.

Dependencies:   Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo

Committer:
shimniok
Date:
Wed Jun 20 14:57:48 2012 +0000
Revision:
0:826c6171fc1b
Updated documentation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shimniok 0:826c6171fc1b 1 #ifndef __CARTPOSITION_H
shimniok 0:826c6171fc1b 2 #define __CARTPOSITION_H
shimniok 0:826c6171fc1b 3
shimniok 0:826c6171fc1b 4 /** Geographical position and calculation based on cartesian coordinates
shimniok 0:826c6171fc1b 5 */
shimniok 0:826c6171fc1b 6 class CartPosition {
shimniok 0:826c6171fc1b 7 public:
shimniok 0:826c6171fc1b 8 /** Create a new cartesian coordinate object
shimniok 0:826c6171fc1b 9 */
shimniok 0:826c6171fc1b 10 CartPosition(void);
shimniok 0:826c6171fc1b 11 /** Create a new cartesian coordinate object
shimniok 0:826c6171fc1b 12 * @param x sets x coordinate
shimniok 0:826c6171fc1b 13 * @param y sets y coordinate
shimniok 0:826c6171fc1b 14 */
shimniok 0:826c6171fc1b 15 CartPosition(float x, float y);
shimniok 0:826c6171fc1b 16 /** Sets coordinates for object
shimniok 0:826c6171fc1b 17 * @param x sets x coordinate
shimniok 0:826c6171fc1b 18 * @param y sets y coordinate
shimniok 0:826c6171fc1b 19 */
shimniok 0:826c6171fc1b 20 void set(float x, float y);
shimniok 0:826c6171fc1b 21 /** Sets coordinates for object
shimniok 0:826c6171fc1b 22 * @param p sets coordinates of this object to that of p
shimniok 0:826c6171fc1b 23 */
shimniok 0:826c6171fc1b 24 void set(CartPosition p);
shimniok 0:826c6171fc1b 25 /** Computes bearing to a position from this position
shimniok 0:826c6171fc1b 26 * @param to is the coordinate to which we're calculating bearing
shimniok 0:826c6171fc1b 27 */
shimniok 0:826c6171fc1b 28 float bearingTo(CartPosition to);
shimniok 0:826c6171fc1b 29 /** Computes distance to a position from this position
shimniok 0:826c6171fc1b 30 * @param to is the coordinate to which we're calculating distance
shimniok 0:826c6171fc1b 31 */
shimniok 0:826c6171fc1b 32 float distanceTo(CartPosition to);
shimniok 0:826c6171fc1b 33 /** Computes the new coordinates for this object given a bearing and distance
shimniok 0:826c6171fc1b 34 * @param bearing is the direction traveled
shimniok 0:826c6171fc1b 35 * @distance is the distance traveled
shimniok 0:826c6171fc1b 36 */
shimniok 0:826c6171fc1b 37 void move(float bearing, float distance);
shimniok 0:826c6171fc1b 38 /** x coordinate of this object */
shimniok 0:826c6171fc1b 39 float _x;
shimniok 0:826c6171fc1b 40 /** y coordinate of this object */
shimniok 0:826c6171fc1b 41 float _y;
shimniok 0:826c6171fc1b 42 };
shimniok 0:826c6171fc1b 43 #endif