My Version of CreaBotLib

Fork of CreaBotLib by CreaLab

Revision:
9:efe9f76d6f76
Parent:
8:3b5b0a82b429
Child:
10:79509113310a
--- a/CreaBot.h	Tue Jan 01 21:31:14 2019 +0000
+++ b/CreaBot.h	Thu Jan 03 23:16:46 2019 +0000
@@ -2,20 +2,24 @@
  * \file CreaBot.h
  * \brief File contains Creabot Library.
  
- * CreaBot.h contains the Motor class, and related enums and structs.
+ * CreaBot.h contains the Creabot class, and required enums and structs.
  * Includes "mbed.h" and "motor.h"
  
  * Refactorings:
- * All variables with suffixes "_cm_sec" = speeds in centimeters per second
- * MotCommand -> BotCommand
- * cmdbot_t -> BotCmdVerb
- * cm -> dist_cm
- 
+ * All variables with suffixes "_cm_sec" = speeds in centimeters per second.
+ * MotCommand -> BotCommand.
+ * cmdbot_t -> BotCmdVerb.
+ * cm -> dist_cm.
+ * 'motorxx' -> 'wheelxxx': each motor now becomes a 'wheel with a diameter'
+ * FIFO queue management merged with Creabot Class, now called Queue 
+ * Queue does not use another extra ticker anymore. Instead triggers from Motor End commands. 
+ * Queue is worked through, and Callback is not called, until all queue is empty. 
+ *
  * @author Tarek Lule, Francois Druilhe, et al.
  * @date 21. Nov. 2018.
  * @see https://os.mbed.com/users/sepp_nepp/code/CreaBotLib/  */
  
- // -------------------- Motor ---------------------------
+ // -------------------- wheel ---------------------------
  
 #ifndef CREABOT_H
 #define CREABOT_H
@@ -23,324 +27,396 @@
 #include "mbed.h"
 #include "motor.h"
 
-#define MAX_SPEED_CM_SEC 30.0f /**< Clamp maximum advancement speed = 30cm/sec, was MAX_SPEED */
-#define MIN_SPEED_CM_SEC 0.001f /**< Clamp minimum advancement speed = 10um/sec */
+#define MAX_SPEED_CM_SEC 30.0f    /**< Clamp maximum advancement speed = 30cm/sec, was MAX_SPEED */
+#define MIN_SPEED_CM_SEC 0.001f   /**< Clamp minimum advancement speed = 10um/sec */
 #define DEFAULT_SPEED_CM_SEC 2.0f /**< Default advancement speed = 2.0cm/sec, was DEFAULT_SPEED */
-#define PI 3.141592f
-#define DEPTH_FIFO 256  /**< Initialize the depth of the command FIFO to 256 */
+#define PI 3.141592f    /**< PI needed to calcuate from angle to distances */
+#define DEPTH_Queue 256  /**< Initialize the depth of the command Queue to 256 */
 
 /** \enum BotCmdVerb 
 * \brief Robot Commands Verbs, gives the movement direction
-*  */
+* IDLE is not supported at the moment
+*/
 typedef enum {
-    IDLE = 0,   /**< Command to do nothing */  
-    FORWARD,    /**< Advance the robot straight forward */  
-    BACKWARD,   /**< Advance the robot straight backwards. */  
-    ROTATE,     /**< Rotate around its own axis */  
-    LEFT,       /**< Advance in a left curve */
-    RIGHT,      /**< Advance in a right curve */
-    REVLEFT,    /**< Reverse in a left curve */
-    REVRIGHT    /**< Reverse in a right curve */
+    FORWARD,    /**< Advance the robot straight forward   */  
+    BACKWARD,   /**< Reverse the robot straight backwards */  
+    ROTATE,     /**< Rotate around its own axis*/  
+    LEFT,       /**< Advance in a left curve   */
+    RIGHT,      /**< Advance in a right curve  */
+    BACKLEFT,   /**< Reverse in a left curve   */
+    BACKRIGHT   /**< Reverse in a right curve  */
 } BotCmdVerb;
 
 
-/** \enum TMotorsState
-* \brief Possible states of the two motors of the Bot
+/** \enum TWheelsState
+* \brief Possible states of the two wheels of the Bot
 *  */
 typedef enum {
-    LRMOTS_STOP = 0,/**< All Motors have stopped */  
-    LMOT_RUNS,  /**< Left  Motor  runs */  
-    RMOT_RUNS,  /**< Right Motor  runs */  
-    LRMOTS_RUN  /**< Both  Motors run */  
-} TMotorsState;
+    LRWHEELS_STOP = 0, /**< All wheels have stopped */  
+    LWHEEL_RUNS   = 1, /**< Left  wheel  runs */  
+    RWHEEL_RUNS,  = 2, /**< Right wheel  runs */  
+    LRWHEELS_RUN  = 3, /**< Both  wheels run */  
+} TWheelsState;
 
 /** \struct BotCommand
-* \brief Structure of a Motor Command.
-* The command structure is put into command FIFO, and treated by the FIFO-Handler */
+* \brief Structure of a wheel Command.
+* The command structure is put into command Queue, and treated by the Queue-Handler */
 typedef struct {
     BotCmdVerb command; /**< General Command to give movement direction.*/
     float dist_cm;      /**< Distance in dist_cm for translational movements .*/
-    float angle_deg;    /**< Angle in degree for rotational movement .*/
-    void set(BotCmdVerb Acommand, float Aangle_deg, float Adist_cm); /**< Helper; set structure fields to values  */
+    float turn_angle_deg;    /**< Angle in degree for rotational movement .*/
+    void set(BotCmdVerb Acommand, float Aturn_angle_deg, float Adist_cm); /**< Helper; set structure fields to values  */
     void set(BotCmdVerb Acommand, float Aparam); /**< Helper; set structure fields to values  */
 } BotCommand;
 
-/** \struct geometries
-* \brief Some geometric encapsulation
-* Holds some geometric values */
-typedef struct {
-    float diam_cm;
-    float perim_cm;
-    float degree_per_cm;
-    void setDiam( float Adiam_cm); /**< Helper; set diameter and perim to values  */
-} circle_geos;
-
-/** \class CommandFIFO
- * \brief 256 elements deep Command FIFO, to puts BotCommand in a queue.
- * 
- *  Internally stores all BotCommand in a static 256 array used as a circular ring buffer.
- *  Adds incoming commands at the head of the ring buffer at position writeIdx, 
- *  Gets oldest commands from the tail of the ring buffer at position readIdx,
- *  Keeps track of the occupied size in Count.
- *  BotCommands are passed back as pointers.
- */
-class CommandFIFO {
-  public: 
-    /** Class Creator: initializes an empties FIFO
-    *
-    * Ring buffer is allocated statically. Read and Write Index are set to 0. */
-    CommandFIFO();
-    
-    /** Empty the FIFO.
-    *
-    * Since ring buffer is static, it suffice to set all pointers to 0, commands are left in memory. */
-    void empty() {readIdx=writeIdx=Count=0;};
-
-    /** Reserve a new element at the head of the FIFO
-    *
-    *If FIFO is full, it passes back NULL 
-    *Otherwise Advances the write index once and returns a pointer the next free command struct.
-    *The caller then has to fills the command structure at that position. 
-    *Do not free memory associated to the pointer.
-    *
-    *@return <BotCommand*> Pointer to the reserved BotCommand to write to. 
-    */
-    BotCommand *put();
-
-    void put(BotCmdVerb Acommand, float Adist_cm, float Aangle_deg); 
-
-    /** Get and remove the oldest element at the tail of the FIFO
-    *
-    *If FIFO is empty, it passes back NULL 
-    *Otherwise advances the read index once and returns a pointer the oldest stored command in the FIFO.
-    *Do not free memory associated with the pointer.
-    *
-    *@return <BotCommand*> Pointer to the oldest BotCommand. 
-    */
-    BotCommand *get();
-    
-    /** Access FIFO used Count. 
-    *
-    *@return <int>  the number of commands in the FIFO */
-    int getCount() {return Count;}
-    
-     /** Check if FIFO is full. 
-    * 
-    * Space is limited to DEPTH_FIFO=256 BotCommand elements.
-    * Should be checked before trying to put new elements
-    *
-    * @return <bool>  True if FIFO is full*/
-    bool isFull() {return Count>=DEPTH_FIFO;}
-    
-     /** Check if FIFO is empty. 
-    * 
-    * Should be checked before trying to get new elements
-    * 
-    * @return <bool>  True if FIFO is empty*/
-    bool isEmpty() {return Count<=0;}
-    
-  private:
-    int readIdx;  /**< Index in FIFO array where to get the oldest element from. */
-    int writeIdx; /**< Index in FIFO array where to put the next new element to. */
-    int Count;    /**< Counts the number of elements in array used. */
-    BotCommand cmd[DEPTH_FIFO]; /**< Actual static FIFO array where all elements reside. */
-    BotCommand cmd_idle; /**< A Constant Idle command  */
-};
 
 /** \class Creabot
 
-* \brief Synchronous Control of 2 motors as part of a two wheel robot
- *
- * Example:
- * @code
- * // --- Define the Four PINs & Time of movement used for Motor drive -----
- * Motor motorLeft(PA_12, PB_0, PB_1, PB_6); // Declare first the 2 motors (to avoid to have an object with 8 pins to create)
- * Motor motorRight(PA_5,PA_4,PA_3,PA_1);
- * Creabot mybot(&motorLeft, &motorRight, 10.0f,13.0f); // insert the motors and indicate wheel diameter and distance between wheels
- * 
- * int main() {
- * 
- *     mybot.setSpeed(12.5); // 12.5cm/s
- *     mybot.move(FORWARD,10); // Go forward of 10cm
- *     mybot.waitEndMove(); // Wait end of Move
- *     mybot.move(ROTATE,90); // Start rotation of 90° around the center between wheels (two wheels running in same direction at same speed)
- *     mybot.move(BACKWARD,40); // Stop immediately the rotation and go backward of 40cm
- *     mybot.waitEndMove(); // Wait end of Backward
- *     mybot.moveAndWait(LEFT,60); // Move Left of 60° in circle, center being the left wheel (off). Wait end of move
- *     mybot.waitEndMove();  // Not needed, as already waited... 
- *     mybot.moveAndWait(RIGHT,45, 33); // Move Right of 45°, center being at 33cm of the right wheel. Right wheel moving slower and on a shorter distance than left one. 
- *     mybot.moveAndWait(ROTATE,90);
- *     mybot.move(ROTATE,-90); // Opposite direction.
- *     mybot.waitEndMove(60); // with watchdog => if after 60s the move is not ended, continue the execution
- *     mybot.stopMove(); // Stop the movement before end...
- *     
- *     // Same with a fifo of command, opposite to the move, receiving a new command will not stop the current execution, but the bot will store it.
- *     mybot.fifo(FORWARD,10); // Already starting...
- *     mybot.fifo(BACKWARD,10); // will wait end of previous command to go
- *     mybot.fifo(ROTATE,120.0);
- *     mybot.fifo(LEFT, 30, 120);
- *     mybot.fifo(RIGHT, 25);
- *     mybot.waitEndMove(100000); // wait until fifo end... can flush anytime with stopMove...
- *     mybot.stopMove(); // before end... Flush the fifo and remove all instructions…
- * 
- *     while(1) {
- *     };
- * }
- * @endcode
- */
+* \brief Synchronous Control of 2 wheels as part of a two wheel robot
+*
+* Handles two instances of Motor from motor.h library simultaneously. 
+* Using the set distance between the wheels, allows to run pecise curves. 
+* One set of movement commands starting with iXXX are executed immediately, 
+*   they override each other if issued too quickly.
+* The other set of movement commands starting with qXXX are queued up in a 
+*   waiting queue, allowing to execute them one by one in programmed order. 
+* A callback is supplied to react to the end of all programmed movements. 
+*
+* Example:
+* @code
+* // --- Define the Four PINs & Time of movement used for wheel drive -----
+* Motor 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)
+* Motor 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)
+* 
+* int main() {
+* 
+*     mybot.setSpeed(12.5); // Preset speed to 12.5cm/s
+*     mybot.iMove(FORWARD,10); // Go forward of 10cm
+*     mybot.iWaitEnd(); // Wait end of Move
+*     mybot.iMove(ROTATE,90); // Start rotation of 90° around the center between wheels (two wheels running in same direction at same speed)
+*     mybot.iMove(BACKWARD,40); // Stop immediately the rotation and go backward of 40cm
+*     mybot.iWaitEnd(); // Wait end of Backward
+*     mybot.iMoveAndWait(LEFT,60); // Move Left of 60° in circle, center being the left wheel (off). Wait end of move
+*     mybot.iWaitEnd();  // Not needed, as already waited... 
+*     mybot.iMoveAndWait(RIGHT,45, 33); // Move Right of 45°, center being at 33cm of the right wheel. Right wheel moving slower and on a shorter distance than left one. 
+*     mybot.iMoveAndWait(ROTATE,90);
+*     mybot.iMove(ROTATE,-90); // Opposite direction.
+*     mybot.iWaitEnd(6); // with time-out => if after 6s the move is not ended, continue the execution
+*     mybot.iStop(); // Stop the movement in case it was not ended before ...
+*     
+*     // Same with a Queue of command, opposite to the move, receiving a new command will not stop the current execution, but the bot will store it.
+*     mybot.qMove(FORWARD,10); // Already starting...
+*     mybot.qMove(BACKWARD,10); // will wait end of previous command to go
+*     mybot.qMove(ROTATE,120.0);
+*     mybot.qMove(LEFT, 30, 120);
+*     mybot.qMove(RIGHT, 25);
+*     ... // insert other code here that executes while the motors continue to move
+*     mybot.iWaitEnd(100000); // wait until Queue end... can flush anytime with stopMove...
+*     mybot.qEmpty(); // before end... Flush the Queue and remove all instructions…
+* 
+*     while(1) {
+*     };
+* }
+* @endcode
+*/
  
 class Creabot {
 public:
-   /** Create a Creabot object with 2 motors
+   /** Create a Creabot object with 2 wheels
      *
-     *  @param left Motor object declared before corresponding to left motor of the Creabot
-     *  @param right Motor object declared before corresponding to right motor of the Creabot
-     *  @param wheel_diam_cm diameter in cm of the wheels (both muste be the same diameter)
-     *  @param bot_diam_cm distance cm between center of left wheel and center of right wheel
+     *  @param <left motor> object, corresponding to left wheel of the Creabot
+     *  @param <right motor> 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
      */
-    Creabot(Motor *left, Motor *right, float wheel_diam_cm, float bot_diam_cm);
-     /** Property access to Motor state */
-    TMotorsState getState() {return MotState; };
-   
-public:
-    void qMove(BotCmdVerb moveType, float angle_or_cm);
-    void qMove(BotCmdVerb moveType, float angle_deg, float dist_cm);
+    Creabot(motor *left, motor *right, float wheel_diam_cm, float bot_diam_cm);
     
-    void setCallBack(void (*Acallback)(int status));
-    void moveAndWait(BotCmdVerb moveType, float angle_or_cm);
-    void moveAndWait(BotCmdVerb moveType, float angle_deg, float dist_cm);
-    void flushFifo();
-    void spirale(float b, float turns);
-    int moveInFifo();
-    void executeFifo();
-    void stopMove();
-         
-private:
-    uint32_t computeSpeed(Motor *motor, float speed_cm_sec);
+    /** Property access to wheel state, indicating which of the wheels are moving */
+    TWheelsState getState() {return wheelsState; };
     
-private: 
-    CommandFIFO fifoBot;
-    Ticker botTicker;
-    bool executingFifo;
+    /** Setup a Callback method. It is called when all programmed movements are finished. */
+    void setCallBack(void (*Acallback)(int status)); { extCallBack = Acallback; };
+
+    /** High level: set bot-speed parameter for all future wheel commands. 
+    * The set speed is used for immediate and queued movements alike.
+    * In a curve movement it determines the speed of the outer wheel. 
+    */ 
+    void setSpeed(float AbotSpeed_cm_sec);
 
 public:
-    /** Mid level, immediate: set bot-speed parameter all future motor commands*/ 
-    void setBotSpeed(float Abot_speed_cm_sec);
+
+    /** 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().
+    * @param[in] <Acommand> Requested movement, of type BotCmdVerb.
+    * @param[in] <Aparam>   Requested amount, defines angle for ROTATE, or distance for FORWARD, BACKWARD.
+    */
+    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(), moveRevLeft(), moveRevRight().
+    * Can also be called with IDLE, but then has no effect. 
+    *
+    * Reserves a new element at the head of the Queue
+    *
+    * Adds incoming commands at the head of the ring buffer at position writeIdx, 
+    * If Queue is full, it passes back NULL 
+    * Otherwise Advances the write index once and returns a pointer the next free command struct.
+    * The caller then must fill the command structure at that position. 
+    * Do not free memory associated to the pointer.
+    *
+    * @param[in] <Acommand> Requested movement, of type BotCmdVerb.
+    * @param[in] <Aturn_angle_deg>   Requested angle in degrees.
+    * @param[in] <Adist_cm>   Requested distance in centimeters.
+    */
+    void qMove(BotCmdVerb Acommand, float Aturn_angle_deg, float Adist_cm);
+    
+    /** Execute and remove the oldest element at the tail of the Queue
+    *
+    * If Queue is empty, nothing happens
+    * Otherwise executes oldest commands from the tail of the ring buffer at position readIdx,
+    * Then advances the read index once.
+    */
+    void qExecuteNext();
+
+    /** Public access of Queue used Count. 
+    *
+    * @return <int>  the number of commands in the Queue */
+    int qCount() {return Count;}
 
-    /** Mid level, immediate:  move bot according to command and parameter
+    /* Immediately end all queue activites, and the motor
+    * Does not call the external callback handler */
+    void qStopAll();
+
+private: 
+    /** Empty the Queue.
+    * Since ring buffer is static, it suffice to set all pointers to 0, commands are left in memory. */
+    void qReset() { qBlock = true; readIdx=writeIdx=Count=0; qBlock = false; qCollide = false;};
+
+     /** Check if Queue is full. 
+    * 
+    * Space is limited to DEPTH_Queue=256 BotCommand elements.
+    * Should be checked before trying to put new elements
+    * @return <bool>  True if Queue is full*/
+    bool qIsFull() {return Count>=DEPTH_Queue;}
+    
+     /** Check if Queue is empty. 
+    * Should be checked before trying to get new elements
+    * @return <bool>  True if Queue is empty*/
+    bool qIsEmpty() {return Count<=0;}
+    
+    /** 256 elements deep Command Queue, to put BotCommand in a queue.
+    * Stores all BotCommand in this static 256 array used as a circular ring buffer. */
+    BotCommand cmd[DEPTH_Queue]; /**< Actual static Queue array where all elements reside. */
+    
+    int writeIdx; /**< Index in Queue array where to put the next new element to. */
+    int readIdx;  /**< Index in Queue array where to get the oldest element from. */
+    int Count;    /**< Counts and keeps track of the number of elements in array used. */
+    bool qBlock;  /**< Blocks read access while a write is ongoing. */
+    bool qCollide;/**< Indicates a colliding access to the queue. */
+public:
+    /** High level, immediate:  move bot and wait for movement end. 
+    * Simple wrapper for botMove(Acommand,Aparam) and waitEndWheels().
+    * 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 botMove(Acommand,Aturn_angle_deg,Adist_cm) and waitEndWheels().
+    * Refer to those methods for further docs.
+    */
+    void iMoveAndWait(BotCmdVerb Acommand, float Aturn_angle_deg, float Adist_cm);
+
+    /** High level, immediate:  move bot according to command and parameter
+    * 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 setBotSpeed().
+    * Preset the speed using setSpeed().
     * Warning: Collides with queued commands. 
-    * @param[in] <Acommand> Requested movement, of type BotCmdVerb
-    * @param[in] <Aparam>   Requested amount, defines angle for ROTATE, or distance for FORWARD, BACKWARD
+    * @param[in] <Acommand> Requested movement, of type BotCmdVerb.
+    * @param[in] <Aparam>   Requested amount, defines angle for ROTATE, or distance for FORWARD, BACKWARD.
+    */
+    void iMove(BotCmdVerb Acommand, float Aparam);
+    
+    /** High level, immediate:  move bot according to command and parameters
+    * 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(), moveRevLeft(), moveRevRight().
+    * Can also be called with IDLE, but then has no effect. 
+    * Preset the speed using setSpeed().
+    * Warning: Collides with queued commands. 
+    * @param[in] <Acommand> Requested movement, of type BotCmdVerb.
+    * @param[in] <Aturn_angle_deg>   Requested angle in degrees.
+    * @param[in] <Adist_cm>   Requested distance in centimeters.
     */
-    void moveBot(BotCmdVerb Acommand, float Aparam);
-    void moveBot(BotCmdVerb Acommand, float Aangle_deg, float Adist_cm);
-    void executeCommand(BotCommand *cmd);
-    LEFT,       /**< Advance in a left curve */
-    RIGHT,      /**< Advance in a right curve */
-    REVLEFT,    /**< Reverse in a left curve */
-    REVRIGHT    /**< Reverse in a right curve */
+    void iMove(BotCmdVerb Acommand, float Aturn_angle_deg, float Adist_cm);
+    
+    /** High level, immediate: move bot according to prefilled command structures.
+    * Recommended to use botMove() methods to fill the command structure correctly. 
+    * Branches to the moveXXXX() methods. For details see docs for those methods. 
+    * Preset the speed using setSpeed().
+    * Warning: Collides with queued commands if called individually. 
+    * @param[in] <*cmd> Pointer to type BotCommand, the prefilled command structure,
+    */
+    void iExeCommand(BotCommand *cmd);
+
+    /** High Level: spends all time with waits, 
+    * returns only once wheelState = LRWHEELS_STOP, 
+    * not recommended due its blocking behavior */
+    void iWaitEnd();
+    
+    /** High Level: spends all time with waits, 
+    * returns only once wheelState = LRWHEELS_STOP,
+    * but waits no more than max_wait_ms milli seconds. 
+    * Not recommended due its blocking behavior  */
+    void iWaitEnd(uint32_t max_wait_ms); // time-out
+
+    /** High level, immediate: Both wheels get stopped, and turned off
+    * updates the wheel state wheelsState, does not call the callback handler!
+    * It does not empty the queue. Adding new elements into the queue after
+    * calling iStop() would continue using all commands still in the queue. 
+    */
+    void iStop();
 
 public: 
     
-    /** Mid level, immediate:  move bot forward for a given distance,
-    * Set speed with setBotSpeed, collides with queued commands. */
+    /** Mid level, immediate:  advance bot straight forward for a given distance,
+    * Preset the speed using setSpeed().
+    * Warning: Collides with queued commands. 
+    */
     void moveForward(float dist_cm);
     
-    /** Mid level, immediate:  move bot backwards for a given distance,
-    * Set speed with setBotSpeed, collides with queued commands. */
+    /** Mid level, immediate:  reverse bot straight backwards for a given distance,
+    * Preset the speed using setSpeed().
+    * Warning: Collides with queued commands. 
+    */
     void moveBackward(float dist_cm);
     
     /* Mid level, immediate: turn bot forward right, 
     * around a radius twice the bot size ,
-    * Set speed with setBotSpeed, collides with queued commands. */
-    void moveRight(float angle_deg);
+    * Same as  moveRight(turn_angle_deg, 0);
+    * Preset the speed using setSpeed().
+    * Warning: Collides with queued commands. 
+    */
+    void moveRight(float turn_angle_deg);
     
     /** Mid level, immediate: turn bot forward right, 
     * around a radius that is center_cm away from the right wheel,
-    * Set speed with setBotSpeed, collides with queued commands. */
-    void moveRight(float angle_deg, float center_cm);
+    * Preset the speed using setSpeed().
+    * Warning: Collides with queued commands. 
+    */
+    void moveRight(float turn_angle_deg, float center_cm);
     
     /** Mid level, immediate: turn bot forward left, 
     * around a radius twice the bot size,
-    * Set speed with setBotSpeed, collides with queued commands. */
-    void moveLeft(float angle_deg);
+    * Same as  moveLeft(turn_angle_deg, 0);
+    * Preset the speed using setSpeed().
+    * Warning: Collides with queued commands. 
+    */
+    void moveLeft(float turn_angle_deg);
     
     /** Mid level, immediate: turn bot forward left, 
+    * around a radius that is center_cm away from the left wheel,
+    * Preset the speed using setSpeed().
+    * Warning: Collides with queued commands. 
+    */
+    void moveLeft(float turn_angle_deg, float center_cm); 
+    
+    /* Mid level, immediate: turn bot backwards right, 
+    * around a radius twice the bot size ,
+    * Same as  moveRevRight(turn_angle_deg, 0);
+    * Preset the speed using setSpeed().
+    * Warning: Collides with queued commands. 
+    */
+    void moveRevRight(float turn_angle_deg);
+    
+    /** Mid level, immediate: turn bot backwards right, 
+    * around a radius that is center_cm away from the right wheel,
+    * Preset the speed using setSpeed().
+    * Warning: Collides with queued commands. 
+    */
+    void moveRevRight(float turn_angle_deg, float center_cm);
+    
+    /** Mid level, immediate: turn bot backwards left, 
+    * around a radius twice the bot size,
+    * Same as  moveRevLeft(turn_angle_deg, 0);
+    * Preset the speed using setSpeed().
+    * Warning: Collides with queued commands. 
+    */
+    void moveRevLeft(float turn_angle_deg);
+    
+    /** Mid level, immediate: turn bot backwards left, 
     around a radius that is center_cm away from the left wheel,
-    Set speed with setBotSpeed, collides with queued commands. */
-    void moveLeft(float angle_deg, float center_cm);
-    
+    * Preset the speed using setSpeed().
+    * Warning: Collides with queued commands. 
+    */
+    void moveRevLeft(float turn_angle_deg, float center_cm);
+
     /** Mid level, immediate: turn bot on its place for a given angle.
     * positive angles turn right, negative angles turn left,
-    * Set speed with setBotSpeed, collides with queued commands. */
-    void rotate(float angle_deg);
-
-    /** Low Level: spends all time with waits, 
-    * returns only once MotorState = LRMOTS_STOP, 
-    * not recommended due its exclusive blocking behavior */
-    void waitEndMotors();
-    
-    /** Low Level: spends all time with waits, 
-    * returns only once MotorState = LRMOTS_STOP,
-    * but waits no more than max_wait_ms milli seconds. 
-    * Not recommended due its exclusive blocking behavior  */
-    void waitEndMotors(uint32_t max_wait_ms); // watchdog
+    * Preset the speed using setSpeed().
+    * Warning: Collides with queued commands. 
+    */
+    void moveRotate(float turn_angle_deg);
 
   private: 
 
-    /** Low level, immediate: sets both motor speeds   */ 
-    void setMotorsSpeed(float mot_speed_cm_sec);
+    /** Low level, immediate: sets Both wheel speeds   */ 
+    void wheelsSetSpeed(float mot_speed_cm_sec);
     
-    /** Low level, immediate: command wrappers, speed, move and stop, state management */
-    void setMotorSpeed(Motor *motor, float speed_cm_sec);
+    /** Low level, immediate: command wrappers, speed, move and stop, state management 
+    */
+    void wheelSetSpeed(Wheel *Wheel, float speed_cm_sec);
     
-    /** Low level, immediate: Left Motor Move for a given angle in a given direction 
-    * updates the Motor state MotState */
-    void moveMotorLeft(motorDir dir, float angle_deg);
+    /** Low level, immediate: Left wheel Move for a given angle in a given direction 
+    * updates the wheel state wheelsState */
+    void wheelLeftRun(WheelDir dir, float rot_angle_deg);
     
-    /** Low level, immediate: Right Motor Move for a given angle in a given direction 
-    * updates the Motor state MotState */
-    void moveMotorRight(motorDir dir, float angle_deg);
+    /** Low level, immediate: Right wheel Move for a given angle in a given direction 
+    * updates the wheel state wheelsState */
+    void wheelRightRun(WheelDir dir, float rot_angle_deg);
 
-    /** Callback when left Motor stops; 
-    * updates the Motor state MotState */
-    void cbLeftMotStopped();
+    /** Callback when left wheel stops; 
+    * updates the wheel state wheelsState */
+    void wheelLeftStoppedCB();
     
-    /** Callback when right Motor stops. 
-    * updates the Motor state MotState */
-    void cbRightMotStopped();
+    /** Callback when right wheel stops. 
+    * updates the wheel state wheelsState */
+    void wheelRightStoppedCB();
     
-    /** Callback when all Motors have stopped. 
-    * updates the Motor state MotState, switch off all Phases */
-    void AllMotorsStopped();
+    /** Callback when all wheels have stopped. 
+    * updates the wheel state wheelsState, switch off all Phases */
+    void wheelsAllStoppedCB();
 
     /** Callback function pointer: 
-    * If set non-NULL it is called when All Motors Stopped()*/
+    * If set non-NULL it is called when All wheels Stopped()*/
     void (*extCallBack)(int status);
 
-    /** Motor status register:
-    * Remembers which of the motors still run */
-    TMotorsState MotState; 
+    /** Wheel status register:
+    * Remembers which of the wheels still run */
+    TWheelsState wheelsState; 
 
-    /** geometric properties of each wheel and the bot */
-    circle_geos wheel,bot;
+    /** geometric properties of the bot */
+    float botDiameter;
+    
     /** Ratio of wheel diameter and bot diameter */
     float ratio_wheel_bot;
+    
     /** last requested bot speed */ 
-    float bot_speed_cm_sec;  
+    float botSpeed_cm_sec;  
 
-    /** The two motors, as pointers to their classes */
-    Motor *motor_left;
-    Motor *motor_right;
+    /** The two wheels, as pointers to their classes */
+    wheel *wheelLeft;
+    wheel *wheelRight;
 
-    /* members that were already stale in last public release
-     * float macro_move_parameter;
-     * BotCommand macro_move;
-     * void setSpeedLeft(float speed_cm_sec);
-     * void setSpeedRight(float speed_cm_sec); */
 };
 
+
 #endif
\ No newline at end of file