Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this section you will use kinematics to implement a library for differential navigation, and then you will perform several tasks using the library. B.2.1

In this section you will use kinematics to implement a library for differential navigation, and then you will perform several tasks using the library. B.2.1 Differential Navigation Library Implement the 5 functions in the header file MyServos.h:

1) void setSpeeds(int microsLeft, int microsRight) 2) void calibrateSpeeds() 3) void setSpeedsRPS (float rpsLeft, float rpsRight) 4) void setSpeedsIPS(float ipsLeft, float ipsRight) 5) void setSpeedsvw(float v, float w)

The first function should set the speed of the motors by giving the speeds in microseconds.You should write the code so that microsLeft and microsRight control the left and right speeds of the wheels respectively. Also, you should implement the function so that if both values are positive the robot will move forward, if both are negative it will move backwards, and if both are 0, it should not move. The second function should use the encoder functions implemented on section B.1.2 to create a mapping from the servos input (micro seconds) to the servos output (wheel speed in revolutions per second). In other words, measure the speeds of the wheels for different input values and store the results. You should do this for both wheels since the servos output wont necessarily be the same for both wheels. This information will be used by the following functions. The third function should set the speed of the motors as in the first function, but this time, the input parameters indicate the speeds at which each wheel should spin. The fourth function is the same as the previous one, but this time, the speed is given in inches per second. The fifth function should set the speed of the robot, so that the robot will move with a linear speed given by the parameter v (in inches per second), and with an angular velocity w (given in radians per second). Positive angular velocities should make the robot spin counterclockwise. Aspects to consider: The wheels diameter is 2.61''. The wheels are separated by 3.95'' approximately, although this may vary from robot to robot since some may be bent.

MyServos.h

#ifndef __MY_SERVOS__ #define __MY_SERVOS__ //NOTE: you are allowed to modify this file as long as the functions //implement the requested functionality  //this function should set the left and right speeds of the wheel //when both inputs are positive the robot should move forward //when both inputs are negative the robot should move backward //microsLeft should encode the left wheel velocity and viceversa void setSpeeds(int microsLeft, int microsRight); //same as the function setSpeeds, but the inputs now indicate //the revolutions per secont (rps) at which each wheel should spin void setSpeedsRPS(float rpsLeft, float rpsRight); //same as the function setSpeeds, but the inputs now indicate //the inches per second (ips) at which each wheel should spin void setSpeedsIPS(float ipsLeft, float ipsRight); //this function is meant for doing whatever necessary for the //functions 'setSpeedsIPS' and 'setSpeedsRPS' to work properly void calibrate(); //this function should make the robot move with a linear speed of v //measured in inches per second, and an angular speed of w //in rads per second. Positive ws should indicate a counterclockwise spin. void setSpeedsvw(float v, float w); #endif 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Explain the differences between deadlock, livelock, and starvation.

Answered: 1 week ago

Question

What are some global employee and labor relations problems?

Answered: 1 week ago

Question

=+free to pirate employees from competitors?

Answered: 1 week ago