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.
Dependencies: QEI Motordriver ros_lib_melodic
Revision 24:4d6ff25fb9cc, committed 2020-01-06
- Comitter:
- florine_van
- Date:
- Mon Jan 06 15:37:11 2020 +0000
- Parent:
- 23:d1dc248b4e54
- Commit message:
- Correct issue on random generation number;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Jan 06 14:55:03 2020 +0000
+++ b/main.cpp Mon Jan 06 15:37:11 2020 +0000
@@ -159,14 +159,16 @@
for (int i =0; i<10; i++)
{
int distance = (rand()%7000+2000);
- float A_speed = (rand()%2-1);
- float B_speed = (rand()%2-1);
-/* if((A_speed < 0.4) && (A_speed > -0.4)){
+ double A_speed = (double(rand()) / (double(RAND_MAX)))*2-1;
+ double B_speed = (double(rand()) / (double(RAND_MAX)))*2-1;
+
+ if((A_speed < 0.4) && (A_speed > -0.4)){
A_speed = 0.4;
}
if((B_speed < 0.4) && (B_speed > -0.4)){
B_speed = 0.4;
- } */
+ }
+
move(A_speed,B_speed,distance);
wheel_B.reset();
wheel_A.reset();