Skip to content

1. Control Interface

Manousos Linardakis edited this page Aug 16, 2023 · 2 revisions

Control Interface

1.0 Control Interface

The Control Interface comprises various classes and methods to control the different components of the fossbot. Below is a detailed list of the classes along with their corresponding methods:

1.1 class TimerInterface

Handles the timer of the fossbot.

1.1.1 stop_timer()

Stops the timer.

1.1.2 start_timer()

Starts the timer.

1.1.3 elapsed()

Prints the elapsed time from start.

1.1.4 get_elapsed()

Returns (int) the elapsed time in seconds.

1.2 class MotorInterface

Handles the motors of the fossbot.

1.2.1 set_speed(speed)

Set the motor speed immediately within the range of 0 to 100.

  • Param:
    • speed (int): The speed value to be set (0-100).

1.2.2 dir_control(direction)

Change motor direction to input direction.

  • Param:
    • direction (str): The direction to be headed to.

1.2.3 move(direction)

Start moving motor with default speed towards input direction.

  • Param:
    • direction (str): The direction to be headed to. Defaults to "forward".

1.2.4 stop()

Stops the motor.

1.3 class OdometerInterface

Handles the odometer of the fossbot.

1.3.1 count_revolutions()

Increases the total steps by one.

1.3.2 get_steps()

Returns (int) the total number of steps.

1.3.3 get_revolutions()

Returns (float) the total number of revolutions.

1.3.4 get_distance()

Returns (float) the total distance traveled so far (in cm).

1.3.5 reset()

Resets the total traveled distance and revolutions.

1.4 class UltrasonicSensorInterface

Handles the ultrasonic sensor of the fossbot.

1.4.1 get_distance()

Gets the distance to the closest obstacle. Returns (float) the distance to the closest obstacle (in cm).

1.5 class AccelerometerInterface

Handles the accelerometer of the fossbot.

1.5.1 get_acceleration(dimension)

Gets the acceleration for a specific dimension.

  • Param:
    • dimension (str): The dimension requested.
  • Returns (float): The acceleration for the specified dimension.

1.5.2 get_gyro(dimension)

Gets the gyroscope for a specific dimension.

  • Param:
    • dimension (str): The dimension requested.
  • Returns (float): The gyroscope for the specified dimension.

1.6 class AnalogueReadingsInterface

Handles the analogue readings of the fossbot.

1.6.1 get_reading(pin)

Gets the reading of a specific sensor specified by the input pin.

  • Param:
    • pin (int): The pin of the sensor.
  • Returns (float): The reading of the requested sensor.

1.7 class NoiseInterface

Handles the noise detection of the fossbot.

1.7.1 detect_noise()

Returns (bool) True only if noise was detected.

1.8 class GenInputInterface

Handles the general input of the fossbot.

1.8.1 get_state()

Returns (int) the state (0 or 1).

1.9 class GenOutputInterface

Handles the general output of the fossbot.

1.9.1 set_on()

Sets the output pin to High.

1.9.2 set_off()

Sets the output pin to Low.

1.10 class LedRGBInterface

Handles the LED of the fossbot.

1.10.1 set_on(color)

Changes the color of the LED.

  • Param:
    • color (str): The desired color. To turn off the LED, use color == 'closed'.