Gonçalo Lopes
/
3_VFH
3_VFH
Robot.h@4:213afe3d5c4b, 2021-05-03 (annotated)
- Committer:
- xaficz
- Date:
- Mon May 03 15:45:29 2021 +0000
- Revision:
- 4:213afe3d5c4b
- Parent:
- 1:dc87724abce8
3_VFH
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fabiofaria | 1:dc87724abce8 | 1 | /** @file */ |
fabiofaria | 1:dc87724abce8 | 2 | #ifndef ROBOT_H_ |
fabiofaria | 1:dc87724abce8 | 3 | #define ROBOT_H_ |
fabiofaria | 1:dc87724abce8 | 4 | |
fabiofaria | 1:dc87724abce8 | 5 | #include "mbed.h" |
fabiofaria | 1:dc87724abce8 | 6 | |
fabiofaria | 1:dc87724abce8 | 7 | extern int16_t countsLeft; |
fabiofaria | 1:dc87724abce8 | 8 | extern int16_t countsRight; |
fabiofaria | 1:dc87724abce8 | 9 | |
fabiofaria | 1:dc87724abce8 | 10 | /** \brief Sets the speed for both motors. |
fabiofaria | 1:dc87724abce8 | 11 | * |
fabiofaria | 1:dc87724abce8 | 12 | * \param leftSpeed A number from -300 to 300 representing the speed and |
fabiofaria | 1:dc87724abce8 | 13 | * direction of the left motor. Values of -300 or less result in full speed |
fabiofaria | 1:dc87724abce8 | 14 | * reverse, and values of 300 or more result in full speed forward. |
fabiofaria | 1:dc87724abce8 | 15 | * \param rightSpeed A number from -300 to 300 representing the speed and |
fabiofaria | 1:dc87724abce8 | 16 | * direction of the right motor. Values of -300 or less result in full speed |
fabiofaria | 1:dc87724abce8 | 17 | * reverse, and values of 300 or more result in full speed forward. */ |
fabiofaria | 1:dc87724abce8 | 18 | void setSpeeds(int16_t leftSpeed, int16_t rightSpeed); |
fabiofaria | 1:dc87724abce8 | 19 | |
fabiofaria | 1:dc87724abce8 | 20 | /** \brief Sets the speed for the left motor. |
fabiofaria | 1:dc87724abce8 | 21 | * |
fabiofaria | 1:dc87724abce8 | 22 | * \param speed A number from -300 to 300 representing the speed and |
fabiofaria | 1:dc87724abce8 | 23 | * direction of the left motor. Values of -300 or less result in full speed |
fabiofaria | 1:dc87724abce8 | 24 | * reverse, and values of 300 or more result in full speed forward. */ |
fabiofaria | 1:dc87724abce8 | 25 | void setLeftSpeed(int16_t speed); |
fabiofaria | 1:dc87724abce8 | 26 | |
fabiofaria | 1:dc87724abce8 | 27 | /** \brief Sets the speed for the right motor. |
fabiofaria | 1:dc87724abce8 | 28 | * |
fabiofaria | 1:dc87724abce8 | 29 | * \param speed A number from -300 to 300 representing the speed and |
fabiofaria | 1:dc87724abce8 | 30 | * direction of the right motor. Values of -300 or less result in full speed |
fabiofaria | 1:dc87724abce8 | 31 | * reverse, and values of 300 or more result in full speed forward. */ |
fabiofaria | 1:dc87724abce8 | 32 | void setRightSpeed(int16_t speed); |
fabiofaria | 1:dc87724abce8 | 33 | |
fabiofaria | 1:dc87724abce8 | 34 | /*! Returns the number of counts that have been detected from the both |
fabiofaria | 1:dc87724abce8 | 35 | * encoders. These counts start at 0. Positive counts correspond to forward |
fabiofaria | 1:dc87724abce8 | 36 | * movement of the wheel of the Romi, while negative counts correspond |
fabiofaria | 1:dc87724abce8 | 37 | * to backwards movement. |
fabiofaria | 1:dc87724abce8 | 38 | * |
fabiofaria | 1:dc87724abce8 | 39 | * The count is returned as a signed 16-bit integer. When the count goes |
fabiofaria | 1:dc87724abce8 | 40 | * over 32767, it will overflow down to -32768. When the count goes below |
fabiofaria | 1:dc87724abce8 | 41 | * -32768, it will overflow up to 32767. */ |
fabiofaria | 1:dc87724abce8 | 42 | void getCounts(); |
fabiofaria | 1:dc87724abce8 | 43 | |
fabiofaria | 1:dc87724abce8 | 44 | /*! This function is just like getCounts() except it also clears the |
fabiofaria | 1:dc87724abce8 | 45 | * counts before returning. If you call this frequently enough, you will |
fabiofaria | 1:dc87724abce8 | 46 | * not have to worry about the count overflowing. */ |
fabiofaria | 1:dc87724abce8 | 47 | void getCountsAndReset(); |
fabiofaria | 1:dc87724abce8 | 48 | |
xaficz | 4:213afe3d5c4b | 49 | void VFH(float x, float y, float phi, float x_final, float y_final, float Log_Map[80][80], float Map[80][80], float Limiar_Histograma, float Limiar_Vale, float kv, float ki, float ks, float L, float r, float w_Max); |
xaficz | 4:213afe3d5c4b | 50 | |
xaficz | 4:213afe3d5c4b | 51 | int *y_bresenham(int x1, int y1, int x2, int y2); |
xaficz | 4:213afe3d5c4b | 52 | int *x_bresenham(int x1, int y1, int x2, int y2); |
fabiofaria | 1:dc87724abce8 | 53 | #endif /* ROBOT_H_ */ |