Question
Please answer question 1,2,3 and 4
This is an individual assignment. You are allowed to discuss this assignment with you classmates but any work you submit must be your own. Trapezoidal Velocity Profile: For a certain application, it is desired to program the BaseBot to move forward in the following pattern 1. i. Start from standstill. ii. Move forward at 1/4 speed for 1 sec. ili. Move forward at 1/2 speed for 1 sec. iv. Move forward at 3/4 speed for 1 sec. v. Move forward at full speed for 15 sec. vi. Move forward at 3/4 speed for 1 sec vii. Move forward at 1/2 speed for 1 sec. vili. ix. Move forward at 1/4 speed for 1 sec. Stop. Write an Easy C program to accomplish this task. Submit the C code only Repeat Question 1 if the transition between each step is triggered by pressing a single push-buttor instead of set durations. Redo Question 1. But this time use functions, constants and loops effectively. Also, add comments to your code Write an Easy C program for your BaseBot to travel along the following trajectory. Assume that each segment is 2ft long. State all your assumptions. Use functions, constants and loops in your program. Also, add comments to your code. 2. 3. 4.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer for part 1:

#include <stdio.h>
#include <time.h> /*used to manipulate date and time*/


void move_forward(float spd, double secs); /*funcion for bot to move forward at 'spd' speed for 'secs' seconds*/

int main()
{
printf("Start\n"); /*Start from standstill*/
move_forward(0.25, 1.0);
move_forward(0.5, 1.0);
move_forward(0.75, 1.0);
move_forward(1, 15.0);
move_forward(0.75, 1.0);
move_forward(0.5, 1.0);
move_forward(0.25, 1.0);
printf("\nStop"); /*Start from standstill*/
return 0;
}

void move_forward(float speed, double secs){
  
clock_t begin;
double time_spent;
  
begin = clock(); /*Start time*/
while(1) /*infinite loop*/
{
printf("Moving forward at %f the speed", speed); /*put here function to move bot forward*/
time_spent = (double)(clock() - begin) / CLOCKS_PER_SEC; /* Get CPU time since loop started */
if (time_spent >= secs)
break;
}
  
  
}

please rate this question

Add a comment
Know the answer?
Add Answer to:
Please answer question 1,2,3 and 4 This is an individual assignment. You are allowed to discuss...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Assignment 4 2018 Simple Functions and Looping Task or estimated I. The progam will ask the rr Th...

    Assignment 4 2018 Simple Functions and Looping Task or estimated I. The progam will ask the rr The functionwl Assignment 4 2018 Simple Functions and Looping Here is one approach you couild take Upload We were unable to transcribe this image5. Sample results: starting with 100 Streptococcus lactis for 90 minutes 90min 26min-3.5generations (will use 3 for number of generations) . After the first generation b 100 x21 200 .After the second generation b 100 x 22 400 After the...

  • Please go to the Practice Exercises (at the end of Chapter 3 in your text on...

    Please go to the Practice Exercises (at the end of Chapter 3 in your text on page 129) and do Exercise E 3.14 which asks you to compute and print the current season of the year depending on the month and day (input as integers). Be sure to review Java boolean operators, multi-way IF-ELSE statements, Switch statements, and String comparison methods before implementing your Java code. The algorithm for this program has been written for you and is included in...

  • This question is about the Arduino code. Please complete a 4-input circuit on your Arduino. Your...

    This question is about the Arduino code. Please complete a 4-input circuit on your Arduino. Your circuit, in addition to cycling through a binary representation of the numbers 0-15 using LEDs, should use the Serial port to output the decimal equivalent of each of the numbers in the format: Output: 15 ... if the value was 1111, and so forth. You will be asked to upload your code as well as a photo of your working breadboard circuit. Add comments...

  • Can I have the answer for the Questions in Python 3 CSC1015F Assignment 4: Control (if,...

    Can I have the answer for the Questions in Python 3 CSC1015F Assignment 4: Control (if, for, while) Assignment instructions This assignment e s con Python programs that use isputandoutput statements, and 12-lea control flow w a nts, whila'stament, and statement that perform INote that you don't have to retuition in the order in which they are presented on the assignments You should do what works best for you! Question 1 mark) write a program called growth as their tenteramentation...

  • Write a C++ code based this question n this assignment you will create three additional functions...

    Write a C++ code based this question n this assignment you will create three additional functions for each one of the data structures created in class. You will be provided with a header file which you will modify and a demo program for each data structure. If your functions are implemented correctly the demo programs should compile and execute correctly. Part 0 (Comments) 1. Over the course of the semester we have discussed comments for each data structure. Please add...

  • Write the code in python, if you cannot answer all the question please dont anser, thanx very much. Please gimme a scr...

    Write the code in python, if you cannot answer all the question please dont anser, thanx very much. Please gimme a screen shot for code. Write clear code with comments and follow coding convention. Comments should include your name, student number and subject code on top of your code Question 1 Create a list to store all the subject codes that you are currently doing at UOW Then use for loop to display it in a table as in the...

  • Help with programming in C++ Phase 1 is complete, please help with phase 2. Thank you....

    Help with programming in C++ Phase 1 is complete, please help with phase 2. Thank you. Phase 1 You must design 3 algorithms, and provide both a flow chart and pseudo code for the algorithms.    Algorithm descriptions: Given an integer parameter named current_number and two constant global variables: const int MIN_NUMBER = 1; const int MAX_NUMBER = 8; Create an algorithm named forward, that will advance ONE value through a sequence of numbers 1, 2, 3 ... MAX_NUMBER. In...

  • For this assignment, you submit answers by question parts Assignment Scoring Your best submission f...

    For this assignment, you submit answers by question parts Assignment Scoring Your best submission for each question part is used for you O-1 points SCalcET8 7.1.513.XP 7. Evaluate the integral. 1 ydy e5y Jo Need Help? Watch It Tal Read It Save Progress Practice Ano Submit Answer e Assignment Submission For this assignment, you submit answers by question parts. The nu Assignment Scoring Your best submission for each question part is used for your score 0 -1 points SCalcET8 7.1.030...

  • COSC 1437 C++ Project Assignment 2 Poll Summary Utilize a dynamic array of structure to summarize...

    COSC 1437 C++ Project Assignment 2 Poll Summary Utilize a dynamic array of structure to summarize votes for a local election Specification: Write a program that keeps track the votes that each candidate received in a local election. The program should output each candidate’s name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. To solve this problem, you will use one dynamic...

  • Im struggling with my final assignment and I don’t know how to start. The code has...

    Im struggling with my final assignment and I don’t know how to start. The code has to be done in python using tkinter module. I would very appreciate the help thank you QUESTION 1 Write a program that counts the number of names on a list. The program must include a class named FinalProjectlastName with the following attributes (class variables) and functions: Name: FinalProjectLastName Attributes: names: list of strings that stores names count: number of names on the list. Functions:...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT