Package drawing
Class Pen
java.lang.Object
drawing.Pen
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
ConstructorsConstructorDescriptionPen()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 TypeMethodDescriptionvoidThis method causes the robot to move backwards up until the colourSensor detects a black line past a certain TachoCount threshold.booleanbeepGyro()This checks if the angle of gyroSensor past a certain threshold.voidThis 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.voidclose()Closes all motors and sensorsvoidopen()Method which gets the instances' of the Motor and Sensor singletons.voidThis moves the robot backwards.voidpenDiagonalLR(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.voidpenDiagonalRL(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.voidpenDown()This puts the pen down by rotating it negitvely.voidpenHorizontal(int fowardsRotate) This moves the pen Horizontally by the forwards rate.voidpenStop()This stops the motor from moving forwards.voidpenUp()This puts the pen up by rotating it positvely .voidpenVertical(int horizontalRotate) This moves the pen vertically by the horizontal rate.intReturns the tachoCount of the forwards motor.
-
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
-