Package drawing

Class Pen

java.lang.Object
drawing.Pen

public class Pen extends Object
This is the object which manages the functionality of the pen. It contains abstractions which make it easier to draw out what is needed.
Since:
2023
  • Constructor Summary

    Constructors
    Constructor
    Description
    Pen()
    Constructor which opens the Motor and Sensor singletons as well as setting the speeds of motors and initialising the boolean 'isPenUp'.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This method causes the robot to move backwards up until the colourSensor detects a black line past a certain TachoCount threshold.
    boolean
    This checks if the angle of gyroSensor past a certain threshold.
    void
    This uses the touchSensor to calibrate the pen on its Vertical axis as well putting the pen back up.This is done by moving the motor until it touchs the sensor.
    void
    Closes all motors and sensors
    void
    Method which gets the instances' of the Motor and Sensor singletons.
    void
    This moves the robot backwards.
    void
    penDiagonalLR(int horizontalRotate, int fowardsRotate)
    This uses a horizontal and forwards input inorder to draw from Left to Right diagonally by synching the motors and moving them at the same time.
    void
    penDiagonalRL(int horizontalRotate, int fowardsRotate)
    This uses a horizontal and forwards input inorder to draw from Right to Left diagonally by synching the motors and moving them at the same time.
    void
    This puts the pen down by rotating it negitvely.
    void
    penHorizontal(int fowardsRotate)
    This moves the pen Horizontally by the forwards rate.
    void
    This stops the motor from moving forwards.
    void
    This puts the pen up by rotating it positvely .
    void
    penVertical(int horizontalRotate)
    This moves the pen vertically by the horizontal rate.
    int
    Returns the tachoCount of the forwards motor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Pen

      public Pen()
      Constructor which opens the Motor and Sensor singletons as well as setting the speeds of motors and initialising the boolean 'isPenUp'.
  • Method Details

    • open

      public void open()
      Method which gets the instances' of the Motor and Sensor singletons.
    • tachoCount

      public int tachoCount()
      Returns the tachoCount of the forwards motor.
      Returns:
      int
    • close

      public void close()
      Closes all motors and sensors
    • calibrate

      public void calibrate()
      This uses the touchSensor to calibrate the pen on its Vertical axis as well putting the pen back up.This is done by moving the motor until it touchs the sensor.
    • penUp

      public void penUp()
      This puts the pen up by rotating it positvely .
    • penDown

      public void penDown()
      This puts the pen down by rotating it negitvely.
    • penStop

      public void penStop()
      This stops the motor from moving forwards.
    • penDiagonalLR

      public void penDiagonalLR(int horizontalRotate, int fowardsRotate)
      This uses a horizontal and forwards input inorder to draw from Left to Right diagonally by synching the motors and moving them at the same time.
      Parameters:
      horizontalRotate -
      fowardsRotate -
    • penDiagonalRL

      public void penDiagonalRL(int horizontalRotate, int fowardsRotate)
      This uses a horizontal and forwards input inorder to draw from Right to Left diagonally by synching the motors and moving them at the same time.
      Parameters:
      horizontalRotate -
      fowardsRotate -
    • penVertical

      public void penVertical(int horizontalRotate)
      This moves the pen vertically by the horizontal rate.
      Parameters:
      horizontalRotate -
    • penBackwards

      public void penBackwards()
      This moves the robot backwards.
    • penHorizontal

      public void penHorizontal(int fowardsRotate)
      This moves the pen Horizontally by the forwards rate.
      Parameters:
      fowardsRotate -
    • backUpPen

      public void backUpPen()
      This method causes the robot to move backwards up until the colourSensor detects a black line past a certain TachoCount threshold.
    • beepGyro

      public boolean beepGyro()
      This checks if the angle of gyroSensor past a certain threshold.
      Returns:
      boolean