# Import EEZYbotARM library from easyEEZYbotARM.kinematic_model import EEZYbotARM_Mk2 from easyEEZYbotARM.kinematic_model import EEZYbotARM_Mk1 # initial joint angles jointAngle1 = 0 jointAngle2 = 70 jointAngle3 = -100 # Create an EEZYbotARM Mk2 object myRobotArm = EEZYbotARM_Mk2(jointAngle1, jointAngle2, jointAngle3) # Plot it myRobotArm.plot() # Create an EEZYbotARM Mk1 object myRobotArm = EEZYbotARM_Mk1(jointAngle1, jointAngle2, jointAngle3) # Plot it myRobotArm.plot()
def __init__(self, arduino_port = "/dev/ttyUSB0"): self.arduino = arduinoController(port=arduino_port) self.arduino.openSerialPort() self.arm = EEZYbotARM_Mk2(initial_q1=0, initial_q2=90, initial_q3=-90) self.homePos = [0, 110, -140] self.return_home()
# The servos are plugged into the following pin positions on the PCA9685 board: # Servo_q1 -> EzzyBot base (q1) -> PCA9685 pin 1 # Servo_q2 -> Main arm (q2) -> PCA9685 pin 2 # Servo_q3 -> Horarm (q3) -> PCA9685 pin 3 # Servo_EE -> End Effector (EE) -> PCA9685 pin 0 # Import EEZYbotARM library from easyEEZYbotARM.kinematic_model import EEZYbotARM_Mk2 from easyEEZYbotARM.serial_communication import arduinoController # Insert your Arduino serial port here to initialise the arduino controller myArduino = arduinoController(port="COM3") myArduino.openSerialPort() # Initialise kinematic model with initial joint angles (home position) myVirtualRobotArm = EEZYbotARM_Mk2( initial_q1=0, initial_q2=90, initial_q3=-130) # Plot it myVirtualRobotArm.plot() # Define end effector open and closed angle servoAngle_EE_closed = 10 servoAngle_EE_open = 90 # Calculate the current servo angles servoAngle_q1, servoAngle_q2, servoAngle_q3 = myVirtualRobotArm.map_kinematicsToServoAngles() # Send the movement command to the arduino. The physical EEZYbotARM will move to this position myArduino.communicate(data=myArduino.composeMessage(servoAngle_q1=servoAngle_q1, servoAngle_q2=servoAngle_q2, servoAngle_q3=servoAngle_q3, servoAngle_EE=servoAngle_EE_open))
# Import EEZYbotARM library from easyEEZYbotARM.kinematic_model import EEZYbotARM_Mk2 # Initialise robot arm with initial joint angles myRobotArm = EEZYbotARM_Mk2(initial_q1=0, initial_q2=70, initial_q3=-100) myRobotArm.plot() # plot it # Assign cartesian position where we want the robot arm end effector to move to # (x,y,z in mm from centre of robot base) x = 240 # mm y = 85 # mm z = 200 # mm # Compute inverse kinematics a1, a2, a3 = myRobotArm.inverseKinematics(x, y, z) # Print the result print( 'To move the end effector to the cartesian position (mm) x={}, y={}, z={}, the robot arm joint angles (degrees) are q1 = {}, q2= {}, q3 = {}' .format(x, y, z, a1, a2, a3)) # Visualise the new joint angles myRobotArm.updateJointAngles(q1=a1, q2=a2, q3=a3) myRobotArm.plot()
# Import EEZYbotARM library from easyEEZYbotARM.kinematic_model import EEZYbotARM_Mk2 from easyEEZYbotARM.serial_communication import arduinoController import time import easyEEZYbotARM import cv2 as cv from imutils.video import VideoStream # Insert your Arduino serial port here to initialise the arduino controller myArduino = arduinoController(port="/dev/ttyUSB0") myArduino.openSerialPort() import numpy as np # Initialise kinematic model with initial joint angles (home position) robot = EEZYbotARM_Mk2( initial_q1=0, initial_q2=90, initial_q3=-90) # Plot it #myVirtualRobotArm.plot() # Define end effector open and closed angle servoAngle_EE_closed = 15 servoAngle_EE_open = 90 # Calculate the current servo angles servoAngle_q1, servoAngle_q2, servoAngle_q3 = robot.map_kinematicsToServoAngles() print("Initial = , ", servoAngle_q1, ", ", servoAngle_q2, ", ", servoAngle_q3) # a1 = 0 # a2 = 45 # a3 = -45 # x, y, z = robot.forwardKinematics(q1=a1, q2=a2, q3=a3) # print("xyz = , ", x, ", ", y, ", ", z)