Robotics Lab 1
Robotics Lab 1
ENGR 3100
22 September 2020
Lab 1 Report
Part 3:
/*
Part 3
William Ard and Hoa Nguyen
This is a script for Part 3 of Lab 1 to practice learning how to
direct the servos to move.
*/
#include "simpletools.h" // Include simple tools
#include "abdrive.h" // Include simple tools
int main() // Main function
{
drive_speed(20, 20);
pause(30/(0.325*20)*1000); //Go forward 30cm at a speed of 20
ticks per second
drive_speed(0,0);
pause(2000); //stop and pause for 2 seconds
drive_speed(40, 40);
pause(40/(0.325*40)*1000); //Go forward 40cm at 40 ticks per
second.
drive_speed(0,0);
pause(2000); // Stop and pause for 2 seconds
drive_speed(-10, -10);
pause(10/(0.325*10)*1000); // Go backwards 10cm at 10 ticks per
second
drive_speed(0,0);
}
In order to calculate how much time was needed to travel 30 cm, the following calculation were
made:
30 𝑐𝑚
= 6.5 𝑠
20 𝑡𝑖𝑐𝑠 . 325 𝑐𝑚
∗
𝑠𝑒𝑐 𝑡𝑖𝑐
Part 4:
The robot moved at 1 tic/s and 1 cm/s using the drive_goto function which only required the
calculation of the amount of tics each wheel needed to move,
1 𝑡𝑖𝑐
40 𝑐𝑚 ∗ = 123.07 𝑠𝑒𝑐𝑜𝑛𝑑𝑠 𝑜𝑟 123.07 𝑡𝑖𝑐𝑠
. 325 𝑐𝑚
Once the robot moved forward 40 cm, it turned 90 degrees, this process was repeated three
additional times.
Using the drive_goto function, the left wheel was made to move 26 tics clockwise while the right
wheel was made to move 26 ticks counterclockwise in order to make a 90 degree turn. The above
process was repeated three additional times.
Upon completion of following the perimeter of the 40 cm square, it turns around to retrace its
step. It does this by using the drive_goto function to turn the left wheel 26 tics
There could be several factors that contributed to the robot not being able to end up exactly at the
original location. This could be due to not a perfect calibration of the encoders, slip between the
floor and the wheels, and an uncertainty in the encoder measurements.
/*
Part 4
William Ard and Hoa Nguyen
This is a script to practice moving the Activity Bot
*/
#include "simpletools.h" // Include simple tools
#include "abdrive.h" // Include simple tools
𝐿
𝑉(1 − )
𝑉 = 2𝑅
3.25
In order to handle the robot being able to both move in a circle while also checking the
sensor for obstacles in order to stop, a while loop to keep the proximity sensor always
on was utilized. The for loop made the robot always move in a circle as long as there
wasn’t an obstacle 20 cm in front of the robot which the while loop was checking for.
/*
Part 5
William Ard and Hoa Nguyen
This is a script to practice moving the Activity Bot
*/
#include "simpletools.h" // Include simple tools
#include "abdrive.h" // Include simple tools
#include "ping.h"
else
{
freqout(3,1000,800); //output to pin 4 for 1000 milliseconds at
800 hz