artificialpicasso.arm.ArmController#

class artificialpicasso.arm.ArmController(*, arm1len, arm2len, arm1servo, arm2servo, tip_servo)[source]#

Bases: object

__init__(*, arm1len, arm2len, arm1servo, arm2servo, tip_servo)[source]#

Initializes all the different components of the robot, as well as their positions.

The default position of the arms are them perpendicular to each other and the base. The default position of the tip_servo connects the pen to the paper.

Parameters:
  • arm1len (float) – The first arm of the robot

  • arm2len (float) – The second arm of the robot

  • arm1servo (Servo) – The servo connected to arm1

  • arm2servo (Servo) – The servo connected to arm2

  • tip_servo (Servo) – The servo connected to the pen

Methods

__init__(*, arm1len, arm2len, arm1servo, ...)

Initializes all the different components of the robot, as well as their positions.

drop_tip()

Drops the tip of the pen onto the page.

get_angles(x, y)

Given a (x, y) coordinate, find the two angles that the robotic arms need to make in order to move to that position.

lift_tip()

Lifts the tip of the pen from the page.

move_to(x, y[, seconds])

Given a (x, y) coordinate and a specified time, moves the robotic arm to the desired coordinate within that exact time frame.

reset_positions()

Resets the positions of all the servos to their default position.

drop_tip()[source]#

Drops the tip of the pen onto the page.

Return type:

None

get_angles(x, y)[source]#

Given a (x, y) coordinate, find the two angles that the robotic arms need to make in order to move to that position.

Parameters:
  • x (float) – The x coordinate of the target location

  • y (float) – The x coordinate of the target location

Return type:

tuple[float, float]

Returns:

The angles made by arm1 and arm2, respectively.

lift_tip()[source]#

Lifts the tip of the pen from the page.

Return type:

None

move_to(x, y, seconds=0.5)[source]#

Given a (x, y) coordinate and a specified time, moves the robotic arm to the desired coordinate within that exact time frame.

Parameters:
  • x (float) – The x coordinate of the target location (Left is positive)

  • y (float) – The y coordinate of the target location (Up is positive)

  • seconds (float, default: 0.5) – The time taken to get to the location.

Return type:

None

reset_positions()[source]#

Resets the positions of all the servos to their default position. The default position is both the arms perpendicular to each other and the base. The default position of the tip_servo connects the pen to the paper.