Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of CreaBotLib by
Diff: CreaBot.h
- Revision:
- 12:530772639065
- Parent:
- 11:5a94af0afa12
diff -r 5a94af0afa12 -r 530772639065 CreaBot.h
--- a/CreaBot.h Thu Apr 18 11:53:56 2019 +0000
+++ b/CreaBot.h Thu Apr 18 12:06:07 2019 +0000
@@ -32,8 +32,7 @@
/** \enum BotCmdVerb
* \brief Robot Commands Verbs, gives the movement direction
-* IDLE is no longer supported
-*/
+* IDLE is no longer supported */
typedef enum {
FORWARD, /**< Advance the robot straight forward */
BACKWARD, /**< Reverse the robot straight backwards */
@@ -73,15 +72,19 @@
*
* Handles two instances of CreaMot from motor.h library simultaneously.
* Using the set distance between the wheels, allows to run pecise curves.
-* A first other set of movement functions starting with qXXX are using command verbs,
+*
+* A first set of movement functions starting with qXXX are using command verbs,
* these commands are queued up in a waiting queue,
* and are executed one by one in programmed order.
+*
* A second set of movement functions starting with iXXX are also using command verbs,
* however these commands are executed immediately,
* they override each other if issued while the previous movement still ongoing
+*
* A third set of movements functions starting with moveXXXX are provided,
* each function performs one specific movement, also immediately.
* So they also override each other, and collide with queued commands.
+*
* A callback is supplied to react to the end of all programmed movements.
*
* Example:
@@ -89,7 +92,7 @@
* // --- Define the Four PINs & Time of movement used for wheel drive -----
* CreaMot wheelLeft(PA_12, PB_0, PB_1, PB_6); // Declare first the 2 wheels (to avoid to have an object with 8 pins to create)
* CreaMot wheelRight(PA_5,PA_4,PA_3,PA_1);
-* Creabot mybot(&wheelLeft, &WheelRight, 10.0f, 13.0f); // insert the wheels and indicate wheel diameter (10cm) and distance between wheels (13cm)
+* CreaBot mybot(&wheelLeft, &WheelRight, 10.0f, 13.0f); // insert the wheels and indicate wheel diameter (10cm) and distance between wheels (13cm)
*
* int main() {
*
@@ -127,10 +130,10 @@
public:
/** Create a Creabot object with 2 wheels
*
- * @param <left CreaMot> object, corresponding to left wheel of the Creabot
- * @param <right CreaMot> object, corresponding to right wheel of the Creabot
- * @param <wheel_diam_cm> diameter in cm of the wheels (both must be the same diameter)
- * @param <bot_diam_cm> distance cm between center of left wheel and center of right wheel
+ * @param[in] <left> CreaMot object, corresponding to left wheel of the Creabot
+ * @param[in] <right> CreaMot object, corresponding to right wheel of the Creabot
+ * @param[in] <wheel_diam_cm> Diameter in cm of the wheels (both must be the same diameter)
+ * @param[in] <bot_diam_cm> Distance cm between center of left wheel and center of right wheel
*/
Creabot(CreaMot *left, CreaMot *right, float wheel_diam_cm, float bot_diam_cm);
@@ -142,17 +145,19 @@
/** High level: set bot-speed parameter for all future wheel commands.
* The set speed is used for immediate as well as the queued movements.
- * In a curve movement it determines the speed of the outer wheel. */
+ * In a curve movement it determines the speed of the outer wheel.
+ *
+ * @param[in] <AbotSpeed_cm_sec> requested movement speed */
void setSpeed(float AbotSpeed_cm_sec);
public:
/** High level, queued: move bot according to command and parameter
+ *
* Composes a BotCommand and appends it to the queue for queued execution.
* Use for commands that need only one parameter: FORWARD, BACKWARD, ROTATE
* For details refer to docu of moveForward(), moveBackward(), moveRotate().
- * Can also be called with IDLE, but then has no effect.
- * Preset the speed using setSpeed().]
+ * Preset the speed using setSpeed().
*
* @param[in] <Acommand> Requested movement, of type BotCmdVerb.
* @param[in] <Aparam> Requested amount, defines angle for ROTATE, or distance for FORWARD, BACKWARD.
@@ -160,10 +165,10 @@
void qMove(BotCmdVerb Acommand, float Aparam);
/** High level, queued : move bot according to command and parameters
+ *
* Composes a BotCommand and appends it to the queue for queued execution.
* Use for commands that need two parameters: LEFT, RIGHT, BACKLEFT, BACKRIGHT
* For details refer to docu of moveLeft(), moveRight(), moveBackLeft(), moveBackRight().
- * Can also be called with IDLE, but then has no effect.
*
* Reserves a new command element at the head of the Queue
*
@@ -226,13 +231,13 @@
public:
/** High level, immediate: move bot and wait for movement end.
- * Simple wrapper for iMove(Acommand,Aparam) and iWaitEnd().
+ * Simple wrapper for iMove() and iWaitEnd().
* Refer to those methods for further docs.
*/
void iMoveAndWait(BotCmdVerb Acommand, float Aparam);
/** High level, immediate: move bot and wait for movement end.
- * Simple wrapper for iMove(Acommand,Aturn_angle_deg,Adist_cm) and iWaitEnd().
+ * Simple wrapper for iMove() and iWaitEnd().
* Refer to those methods for further docs.
*/
void iMoveAndWait(BotCmdVerb Acommand, float Aturn_angle_deg, float Adist_cm);
@@ -241,7 +246,6 @@
* Composes a BotCommand and passes it to executeCommand().
* Use for commands that need only one parameter: FORWARD, BACKWARD, ROTATE
* For details refer to docu of moveForward(), moveBackward(), moveRotate().
- * Can also be called with IDLE, but then has no effect.
* Preset the speed using setSpeed().
* Warning: Collides with queued commands.
*
@@ -254,7 +258,6 @@
* Composes a BotCommand and passes it to executeCommand().
* Use for commands that need two parameters: LEFT, RIGHT, BACKLEFT, BACKRIGHT
* For details refer to docu of moveLeft(), moveRight(), moveBackLeft(), moveBackRight().
- * Can also be called with IDLE, but then has no effect.
* Preset the speed using setSpeed().
* Warning: Collides with queued commands.
*
