Revision 891
Moved comments to headers. That was painful.
move.c | ||
---|---|---|
44 | 44 |
|
45 | 45 |
// global varaibles for move_avoid |
46 | 46 |
int d1, d2, d3, d4, d5; |
47 |
/** |
|
48 |
* @defgroup move Movement |
|
49 |
* @brief Functions fo controlling robot motion |
|
50 |
* Higher level functions to control the movement of robots. |
|
51 |
* |
|
52 |
* @{ |
|
53 |
**/ |
|
54 | 47 |
|
55 |
|
|
56 |
/** |
|
57 |
* Causes the robot to move with the given translation and rotational velocities. |
|
58 |
* motors_init must be called before this function can be used. |
|
59 |
* |
|
60 |
* @param velocity the translational velocity of the robot, in the range -255 to 255. |
|
61 |
* A positive value indicates forward motion, while a negative value indicates |
|
62 |
* backwards motion. |
|
63 |
* |
|
64 |
* @param omega the rotational velocity of the robot, in the range -255 to 255. |
|
65 |
* A positive value indicates a counterclockwise velocity, while a negative |
|
66 |
* value indicates a clockwise velocity. |
|
67 |
* |
|
68 |
* @see motors_init, motor1_set, motor2_set |
|
69 |
**/ |
|
70 | 48 |
void move (int velocity, int omega) { |
71 | 49 |
int vl = 0; |
72 | 50 |
int vr = 0; |
... | ... | |
86 | 64 |
} |
87 | 65 |
|
88 | 66 |
|
89 |
/** |
|
90 |
* Moves the robot with the given translational and angular velocities |
|
91 |
* while avoiding obstacles. To be effective, this function must be |
|
92 |
* called repeatedly throughout the motion. It relies on the IR |
|
93 |
* rangefinders to detect obstacles. Before calling this function, |
|
94 |
* motors_init and range_init must be called. |
|
95 |
* |
|
96 |
* @param velocity the translational velocity of the robot, in the |
|
97 |
* range -255 to 255. A positive value indicates forward motion. |
|
98 |
* |
|
99 |
* @param omega the rotational velocity of the robot, in the range |
|
100 |
* -255 to 255. A positive value indicates a counterclockwise velocity. |
|
101 |
* |
|
102 |
* @param strength the strength of the avoid behavior, in the range |
|
103 |
* 0 to 100. |
|
104 |
* |
|
105 |
* @see motors_init, range_init, move |
|
106 |
**/ |
|
107 | 67 |
void move_avoid(int velocity, int omega, int strength) { |
108 | 68 |
int pControl; |
109 | 69 |
int vl = 0; |
... | ... | |
151 | 111 |
} |
152 | 112 |
} |
153 | 113 |
|
154 |
/**@}**///end the motion group |
|
155 |
|
|
156 | 114 |
void translateAngulartoLinear (int velocity, int omega, int* vl, int* vr) { |
157 | 115 |
//omega: angle measure, positive couter-clockwise from front. |
158 | 116 |
// -180 <= omega <= 180 |
Also available in: Unified diff