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...

  • For this assignment, you will apply what you learned in analyzing for, while, and do-while loops...

    For this assignment, you will apply what you learned in analyzing for, while, and do-while loops by writing these statements yourself. The Java™ program you write should do the following: Display a pyramid of asterisks onscreen (i.e., a nested for loop) Display the integers 10 to 1 in decreasing order, one number per line (i.e., a while/do-whlie loop) Add 7 until the sum becomes greater than 157, at which point the program should display both the sum and the number...

  • 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...

  • CSE/EEE230 Assignment4 Due Date Thursday, January 24th, 5pm Important: This is an individual assignment. Please do...

    CSE/EEE230 Assignment4 Due Date Thursday, January 24th, 5pm Important: This is an individual assignment. Please do not collaborate. It must be submitted on-line (Blackboard). No late assignment will be accepted Minimal Submitted Files You are required to turn in the following source file: assignment4.s Objectives: -write assembly language programs to:             -perform decision making using branch instructions.             -use syscall operations to display integers and strings on the console window             -use syscall operations to read integers from the keyboard....

  • 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...

  • 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...

  • 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...

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