December 7th, 2022
The Project
The goal of this project was to design a system that can securely hold and transport a surgical instrument to an autoclave for sterilization. The project was split into two sub-teams: the computing sub-team, responsible for designing the program to interact with the Q-Arm, and the modeling sub-team, responsible for designing the container that houses the surgical tool.
My Role
I worked as the team manager on the computing sub-team and implemented the movement functions in a Python-based virtual environment. This was one of the first projects in the engineering program and, while not overly complex, it included some noteworthy functions that required programming skills, mathematical knowledge, and an understanding of the hardware. Below, I highlight one of the significant functions I developed, along with a unique Python concept that received praise during the evaluation.
Designing the Program
Rotate Base
The rotate base function was crucial for the program. The goal was to convert digital potentiometer inputs into 1-to-1 movement of the arm.
Initially, the function used the Q-Arm library function rotate_base(deg), but this built-in function made movements based on a relative angle, changing with each call. Instead, we used the alternative function move_arm(x, y, z), which allows for coordinate-based movement.
To achieve the desired movement, the function converts potentiometer
inputs into direct motion of the Q-Arm. By relating the desired path
of the arm to a circle, we can use the equation:
where
def rotate_base(colour):
stop = False
while stop == False:
value = potentiometer.right()
## Using the equation of a circle, moves arm using input from right potentiometer
if value >= 0.5:
x = 0.406-(.406*((value-0.5)/0.25))
y = ((.406**2)-(x**2))**.5
arm.move_arm(x, y, 0.483)
else:
x = 0.406-(.406*((((0.5-value)+0.5)-.5)/0.25))
y = -(((.406**2)-(x**2))**.5)
arm.move_arm(x, y, 0.483)
## Determines when the effector is within range of correct autoclave
#red
if (colour == "red") and arm.check_autoclave("red")==True:
stop = True
print("true")
#green
elif (colour == "green") and arm.check_autoclave("green")==True:
stop = True
print("true")
#blue
elif (colour == "blue") and arm.check_autoclave("blue")==True:
stop = True
print("true")
Dictionaries
Early in the design process, I decided to incorporate dictionaries into the program due to the extensive variable information required and its dependency on individual objects.
The simplified project description was to design a program that sorts objects into different containers. This required the program to have specific information for each object. Using dictionaries made the program more concise and easier to read.
## Item dictionary, keeps the information of each object. Colour, size, drop-off coordinate, and gripper strength
ObjectInfo = {
1: ["red", "small", (0.0, -0.56, 0.296), 40],
2: ["green", "small", (-0.552, 0.18, 0.296), 40],
3: ["blue", "small", (0.0, 0.56, 0.296), 40],
4: ["red", "large", (0.0, -0.323, 0.166), 30],
5: ["green", "large", (-0.364, 0.118, 0.166), 30],
6: ["blue", "large", (-0.0 , 0.323, 0.166), 30]
}