Robotic Arm

Image

_Challenge 1/2_

Here you see the arm connected to the EV3 brick base. The two large motors make up the link with the end effector connected to a medium servo motor. Some pieces are underneath the arm to provide stability. The code moves the arm to different positions by changing angle1 and angle2 for the two motors.

_Code_

Image

Challenge 3

Here we move the arm to different positions on our coordinate system and see the difference between expected and true values

Code

!/usr/bin/python3

ev3 = Device("this")

from time import sleep

import math

def main():

motor1 = ev3.LargeMotor('outB')

motor2 = ev3.LargeMotor('outC')

motor3= ev3.MediumMotor('outD')

motor3.run_to_abs_pos(position_sp = -8, speed_sp = 50, stop_action="hold"); sleep (0.1)

motor1.run_to_abs_pos(position_sp= 0, speed_sp = 75, stop_action="brake"); sleep(0.1)

motor2.run_to_abs_pos(position_sp= 0, speed_sp = 75, stop_action="brake"); sleep(0.1)

while True:

this prints the (x,y) coordinates of the end effector:

motor1 = ev3.LargeMotor('outB')

motor2 = ev3.LargeMotor('outC')

pen = ev3.LargeMotor('outD')

angle1 = motor1.position

angle2 = motor2.position

x = 13_math.cos(math.radians(angle1)) + 6.5_math.cos(math.radians(angle1 + angle2))

y = 13_math.sin(math.radians(angle1)) + 6.5_math.sin(math.radians(angle1 + angle2))

print ("X position is " + str(x))

print("Y position is "+ str(y))

sleep (5)

if name == 'main':

main()