SRM / Mbed 2 deprecated LabWork4

Dependencies:   mbed

Committer:
shut
Date:
Sun Jun 09 14:54:11 2019 +0000
Revision:
0:25f4809c2729
observer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shut 0:25f4809c2729 1 /** @file */
shut 0:25f4809c2729 2 #ifndef ROBOT_H_
shut 0:25f4809c2729 3 #define ROBOT_H_
shut 0:25f4809c2729 4
shut 0:25f4809c2729 5 #include "mbed.h"
shut 0:25f4809c2729 6
shut 0:25f4809c2729 7 extern int16_t countsLeft;
shut 0:25f4809c2729 8 extern int16_t countsRight;
shut 0:25f4809c2729 9
shut 0:25f4809c2729 10 /** \brief Sets the speed for both motors.
shut 0:25f4809c2729 11 *
shut 0:25f4809c2729 12 * \param leftSpeed A number from -300 to 300 representing the speed and
shut 0:25f4809c2729 13 * direction of the left motor. Values of -300 or less result in full speed
shut 0:25f4809c2729 14 * reverse, and values of 300 or more result in full speed forward.
shut 0:25f4809c2729 15 * \param rightSpeed A number from -300 to 300 representing the speed and
shut 0:25f4809c2729 16 * direction of the right motor. Values of -300 or less result in full speed
shut 0:25f4809c2729 17 * reverse, and values of 300 or more result in full speed forward. */
shut 0:25f4809c2729 18 void setSpeeds(int16_t leftSpeed, int16_t rightSpeed);
shut 0:25f4809c2729 19
shut 0:25f4809c2729 20 /** \brief Sets the speed for the left motor.
shut 0:25f4809c2729 21 *
shut 0:25f4809c2729 22 * \param speed A number from -300 to 300 representing the speed and
shut 0:25f4809c2729 23 * direction of the left motor. Values of -300 or less result in full speed
shut 0:25f4809c2729 24 * reverse, and values of 300 or more result in full speed forward. */
shut 0:25f4809c2729 25 void setLeftSpeed(int16_t speed);
shut 0:25f4809c2729 26
shut 0:25f4809c2729 27 /** \brief Sets the speed for the right motor.
shut 0:25f4809c2729 28 *
shut 0:25f4809c2729 29 * \param speed A number from -300 to 300 representing the speed and
shut 0:25f4809c2729 30 * direction of the right motor. Values of -300 or less result in full speed
shut 0:25f4809c2729 31 * reverse, and values of 300 or more result in full speed forward. */
shut 0:25f4809c2729 32 void setRightSpeed(int16_t speed);
shut 0:25f4809c2729 33
shut 0:25f4809c2729 34 /*! Returns the number of counts that have been detected from the both
shut 0:25f4809c2729 35 * encoders. These counts start at 0. Positive counts correspond to forward
shut 0:25f4809c2729 36 * movement of the wheel of the Romi, while negative counts correspond
shut 0:25f4809c2729 37 * to backwards movement.
shut 0:25f4809c2729 38 *
shut 0:25f4809c2729 39 * The count is returned as a signed 16-bit integer. When the count goes
shut 0:25f4809c2729 40 * over 32767, it will overflow down to -32768. When the count goes below
shut 0:25f4809c2729 41 * -32768, it will overflow up to 32767. */
shut 0:25f4809c2729 42 void getCounts();
shut 0:25f4809c2729 43
shut 0:25f4809c2729 44 /*! This function is just like getCounts() except it also clears the
shut 0:25f4809c2729 45 * counts before returning. If you call this frequently enough, you will
shut 0:25f4809c2729 46 * not have to worry about the count overflowing. */
shut 0:25f4809c2729 47 void getCountsAndReset();
shut 0:25f4809c2729 48 //Pose estimation [time,omega,x,y,phi,v] -> [xk,yk,phik]
shut 0:25f4809c2729 49
shut 0:25f4809c2729 50 double limitSpeed(double speed);
shut 0:25f4809c2729 51
shut 0:25f4809c2729 52 #endif /* ROBOT_H_ */