Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Project For the final project, you will work with your group to implement a two-robot follow-the-leader formation keeping

Project For the final project, you will work with your group to implement a two-robot follow-the-leader formation keeping

Computer Science

Project For the final project, you will work with your group to implement a two-robot follow-the-leader formation keeping. The leader robot will be controlled remotely using the Osoyoo App from Lesson #4. For this project, you will implement the following tasks: - Add additional functionality to those from Lesson 4 to control the Leader robot acceleration/deceleration - Add the Obstacle avoidance functionality controlled via the "Obstacle" button on the phone app. Pressing the "Obstacle" button will toggle the robot obstacle avoidance capability on and off. When it is off, your Leader robot will be manually controlled via the phone app. When it is on, the robot should autonomously try to avoid any obstacle, return to the trajectory it was on prior to adjusting for the obstacle, and continues straight at a constant speed until the user toggle the Obstacle mode back to manual. See the Python code from Lesson #3 for hints on how to do this. - The Follower robot will attempt to follow the Leader robot autonomously, while maintaining a constant distance apart. As part of this task, the Follower robot will need to use the ultrasonic sensor onboard to find and to estimate the distance from the Leader robot. The Follower robot will adjust its speed accordingly to speed up/slowdown in order to maintain the constant distance. See the Python code from Lesson #3 for hints on how to apply the ultrasonic sensor. #include #include #include #include #include const int speed_leftf = 6; const int speed_leftb = 7; const int speed_rightf = 5; const int speed_rightb = 4; int high_speed = 4000; int mid_speed = 2500; int low_speed = 2000; float short_delay = 0.2; float long_delay = 0.25; float extra_long_delay = 0.6; int GPIO_TRIGGER = 20; int GPIO_ECHO = 21; int IN1 = 23; int IN2 = 24; int IN3 = 27; int IN4 = 22; int ENA = 0; int ENB = 1; int servo_lft = 420; int servo_ctr = 300; int servo_rgt = 180 #define trig_pin A1 #define echo_pin A2 #define maximum_distance 100 bool goesForward = false; int distance = 50; int main() { printf("Basic Avoidance Model\n"); return 0; char operation; printf("Enter Operation : "); scanf("%c", &operation); printf("'f' for forward/\n"); printf("'b' for backward/\n"); printf("'l' for left/\n"); printf("'r' for right/\n"); printf("'s' for stop./\n"); switch (operation) { case operation == 'c': Forward(); break; case operation == 'b': Backward(); break; case operation == 'l': Left(); break; case operation == 'r': Right(); break; case operation == 's': if (!moveStop()) { moveStop(); } break; default: printf("Invalid Input!\n"); break; } } NewPing sonar(trig_pin, echo_pin, maximum_distance); Servo car; void setup() { pinMode(speed_rightf, OUTPUT); pinMode(speed_leftf, OUTPUT); pinMode(speed_leftb, OUTPUT); pinMode(speed_rightb, OUTPUT); car.attach(5); car.write(70); delay(200; distance = readSpeed(); delay(100); distance = readSpeed(); delay(100); distance = readSpeed(); delay(100); distance = readSpeed(); delay(100); } void loop() { int distanceRight = 0; int distanceLeft = 0; delay(50); if (distance = distanceLeft) { turnRight(); moveStop(); } else { turnLeft(); moveStop(); } } else { Forward(); } distance = readSpeed(); } void changeSpeedForward(speed_leftf, speed_rightf) { speed_leftf++; speed_rightf++; } void changeSpeedBackward(speed_leftb, speed_rightb) { speed_leftb++; speed_rightb++; } int Right() { car.write(25); delay(200); int distance = readSpeed(); delay(100); car.write(70); return distance; } int Left() { car.write(170); delay(500); int distance = readSpeed(); delay(100); car.write(115); return distance; delay(100); } int readSpeed() { delay(70); int cm = sonar.ping_cm(); if (cm == 0) { cm = 250; } return cm; } void moveStop() { digitalWrite(speed_rightf, LOW); digitalWrite(speed_leftf, LOW); digitalWrite(speed_rightb, LOW); digitalWrite(speed_leftb, LOW); } void Forward() { if (!goesForward) { goesForward = true; digitalWrite(speed_leftf, HIGH); digitalWrite(speed_rightf, HIGH); digitalWrite(speed_leftb, LOW); digitalWrite(speed_rightb, LOW); } } void Backward() { goesForward = false; digitalWrite(speed_leftb, HIGH); digitalWrite(speed_rightb, HIGH); digitalWrite(speed_leftf, LOW); digitalWrite(speed_rightf, LOW); } void turnRight() { digitalWrite(speed_leftf, HIGH); digitalWrite(speed_rightb, HIGH); digitalWrite(speed_leftb, LOW); digitalWrite(speed_rightf, LOW); delay(500); digitalWrite(speed_leftf, HIGH); digitalWrite(speed_rightf, HIGH); digitalWrite(speed_leftb, LOW); digitalWrite(speed_rightb, LOW); } void turnLeft() { digitalWrite(speed_leftb, HIGH); digitalWrite(speed_rightf, HIGH); digitalWrite(speed_leftf, LOW); digitalWrite(speed_rightb, LOW); delay(200); digitalWrite(speed_leftf, HIGH); digitalWrite(speed_rightf, HIGH); digitalWrite(speed_leftb, LOW); digitalWrite(speed_rightb, LOW); } pi@raspberrypi: ~/ENGR102_1/Lab_6 File Edit Tabs Help sort(array, currentSize); bool done = checkSame (array, iarray); if (done) { printf("***Solitaire Configuration Reached!!***\n"); break; } ArrayPrinting("Final Array Sorted: ", array, currentSize); printf("Number of solitaire steps needed: %d\n", counter); } pi@raspberrypi:-/ENGR102_1/Lab_6 $ gcc BulgarianSolitaire.c BulgarianSolitaire.c:12:15: error: expected identifier before 'false' typedef enum {false, true} bool; BulgarianSolitaire.c:12:15: error: expected '}' before 'false' BulgarianSolitaire.c:12:15: error: expected unqualified-id before 'false BulgarianSolitaire.c:12:26: error: expected declaration before '}' token typedef enum {false, true} bool; pi@raspberrypi:~/ENGR102_1/Lab_6 $ A - if (!goes Forward) { goesForward true; digitalWrite (speed leftf, HIGH); digitalWrite (speed rightf, HIGH); digitalWrite (speed leftb, LOW); digitalWrite (speed_rightb, LOW); } } void Backward (). { goesForward false; digitalWrite (speed_leftb, HIGH); digitalWrite (speed rightb, HIGH); digitalWrite (speed leftf, LOW); digitalWrite (speed_rightf, LOW); } void turnRight () { digitalWrite (speed_leftf, HIGH); digitalWrite (speed_rightb, HIGH); digitalWrite (speed_leftb, LOW); digitalWrite (speed_rightf, LOW); delay(500); digitalWrite (speed leftf, HIGH); digitalWrite (speed_rightf, HIGH); digitalWrite (speed leftb, LOW); digitalWrite (speed_rightb, LOW); } void turnLeft (). { digitalWrite (speed_leftb, HIGH); digitalWrite (speed rightf, HIGH); digitalWrite (speed_leftf, LOW); digitalWrite (speed_rightb, LOW); delay (200); digitalWrite (speed_leftf, HIGH); digitalWrite (speed rightf, HIGH); digitalWrite (speed_leftb, LOW); digitalWrite (speed_rightb, LOW); pi@raspberrypi:~/testing $ gcc -o ObstacleAvoidance ObstacleAvoidance.c pca9685/ pca9685.c -lwiringPi ObstacleAvoidance.c:10:19: fatal error: conio.h: No such file or directory #include compilation terminated. pi@raspberrypi:~/testing $ ! pi@raspberrypi:- $ ls Desktop keybd.jpg Music pca9685.tar.gz Templates Documents keybd.png oldconffiles picar-basic.py testing Downloads lesson1 osoyoo-robot Pictures Videos ENGR102 1 lesson-1.0 pca9685 Public Exam 1 lesson1.0 pca 9685-servo python_games keybd1.jpg motortest.c pca9685-servo.tar.gz sketchbook pi@raspberrypi:~ $ cd testing pi@raspberrypi:~/testing $ ls lesson1 lesson-1.c ModifyLesson1 ModifyLesson1.c pca9685 pi@raspberrypi:~/testing $ ls lesson1 ModifyLesson1 ObstacleAvoidance.c lesson-1.c ModifyLesson1.c pca 9685 pi@raspberrypi:~/testing $ more ObstacleAvoidance.c AM AR CAUTION! Reversing +/- can destroy your device and cause fire hazard! Installation Guide 13050 3.7V 18650 3.7V 18650 Battery 3.7V + vivrare -HDMI Uiwar we

Option 1

Low Cost Option
Download this past answer in few clicks

16.89 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE