-
Notifications
You must be signed in to change notification settings - Fork 7
GradBot Student Assignments
In this assignment, you will construct a function that will allow you to easily set your robot’s translational and rotational speeds. This function will be a handy function, and we will make use of it throughout future lab assignments.
Recall that the kinematic model of our robot consists of the following equations:
- x translational speed in m/s
$$V_{x}= \frac{r}{2}(S_{left}+S_{right})$$
- yaw rotational speed in radians/s
$$V_{yaw}= \frac{r}{L}(S_{left}-S_{right})$$
- motor speed in radians per second
$$S_{m}= \frac{(Power⋅6.80)}{100}$$
- r=0.065 m, L=0.238 m
-
Working as a class, solve the equations so that given a desired Vx and Vyaw, we can compute a corresponding power setting for the motors.
-
Type in the following skeleton of a function:
function setSpeed(vx, vyaw) {
const r = 0.065; //wheel radius
const l = 0.238; //axel length
var sleft; //left speed
var sright; //right speed
var lpower; //left power
var rpower; //right power
// Compute lpower and rpower
// YOUR CODE HERE
left.setPower(lpower);
right.setPower(rpower);
}
-
Complete the function by implementing the math that you developed in step 1 in the part that says “YOUR CODE HERE”.
-
Use your function to perform the following actions:
a. Have your robot roll forward 1 meter.
b. Have your robot roll in a circle that is 2 meters in diameter.
c. Have your robot stop after completing the circle.
-
Open notepad and create a file on your flash drive called “functions.txt”, copy the setSpeed function into this file so we can use it again later.
-
Download your robot.txt file from the robot simulator and submit your file on https://tinyurl.com/robotics-turnin. For “assignment” put “Lab 1”. You may also want to save your robot on your flash drive for later.