Class Robi2

  • All Implemented Interfaces:
    Ippc32, Actionable

    public class Robi2
    extends Task
    This driver is used for the Robi2. Robi2 is controlled by a MPC555 processor.
    • Method Detail

      • action

        public void action()
        Background Task.

        Do not call this method!

        Specified by:
        action in interface Actionable
        Overrides:
        action in class Task
      • activatePosLEDs

        public static void activatePosLEDs()
        Enable all three position LEDs (white)
      • deactivatePosLEDs

        public static void deactivatePosLEDs()
        Disable all three position LEDs (white)
      • setPosLEDs

        public static void setPosLEDs​(boolean state)
        Set the state for all three position LEDs (the white ones). This method is useful for toggling the positions LEDs.
        Parameters:
        state - the state of the LED (true = on, false = off)
      • setHeadPosLED

        public static void setHeadPosLED​(boolean state)
        Set the state of head position LED (LED16).
        Parameters:
        state - the state of LED16 (true = on, false = off)
      • getHeadPosLED

        public static boolean getHeadPosLED()
        Get the state of head position LED (LED16).
        Returns:
        the state of LED16 (true = on, false = off)
      • setLeftPosLED

        public static void setLeftPosLED​(boolean state)
        Set the state of the rear left position LED (LED17).
        Parameters:
        state - the state of LED17 (true = on, false = off)
      • getLeftPosLED

        public static boolean getLeftPosLED()
        Get the state of the rear left position LED (LED17).
        Returns:
        the state of LED17. (true = on, false = off)
      • setRightPosLED

        public static void setRightPosLED​(boolean state)
        Set the state of the rear right position LED (LED18).
        Parameters:
        state - the state of LED18 (true = on, false = off)
      • getRightPosLED

        public static boolean getRightPosLED()
        Get the state of the rear right position LED (LED18).
        Returns:
        the state of LED18 (true = off, false = on)
      • setPatternLED

        public static void setPatternLED​(int r,
                                         int c,
                                         boolean state)
        Set the state of the chosen pattern LED. Pattern LEDs are the red ones. Examples:
        • setPatternLED(0,0,true) turns LED11 on
        • setPatternLED(3,2,false) turns LED13 off
        Parameters:
        r - row of the LED(range 0..3);
        c - column of the LED (range 0..2)
        state - the state of the LED (true = on, false = off)
      • getPatternLED

        public static boolean getPatternLED​(int r,
                                            int c)
        Set the state of the chosen pattern LED. Pattern LEDs are the red ones. Examples:
        • getPatternLED(0,0) gets the state of LED11
        • getPatternLED(3,2) gets the state of LED13
        Parameters:
        r - row of the LED (range 0..3);
        c - column of the LED (range 0..2)
        Returns:
        the state of the LED (true = on, false = off)
      • setCenterLED

        public static void setCenterLED​(boolean state)
        Set the state of the center LED (the blue one).
        Parameters:
        state - the state of the blue center LED (true = on, false = off)
      • getCenterLED

        public static boolean getCenterLED()
        Get the state of the center LED (the blue one).
        Returns:
        the state of the blue center LED (true = on, false = off)
      • enableAllLEDs

        public static void enableAllLEDs()
      • disableAllLEDs

        public static void disableAllLEDs()
        Turn all LEDs off.
      • getSwitchValue

        public static int getSwitchValue()
        Reads the position of the HEX-switch.
        Returns:
        the position/value of the HEX-switch
      • getDistSensorValue

        public static int getDistSensorValue​(int sensor)
        Read the converted value of a chosen distance sensor.
        Parameters:
        sensor - the sensor which should be read (range 0..15)
        Returns:
        converted value (range 0..1023), -1 = failed.
      • getPosX

        public static float getPosX()
        Returns the x position of the Robi2 referenced to the point of origin.
        The point of origin is set, where the Robi2 stood at the start time of the program or resetPos has been called.
        Returns:
        the difference of the x-coordinate to the point of origin
      • getPosY

        public static float getPosY()
        Returns the x position of the Robi2 referenced to the point of origin.
        The point of origin is set, where the Robi2 stood at the start time of the program or resetPos has been called.
        Returns:
        the difference of the y-coordinate to the point of origin
      • getOrientation

        public static float getOrientation()
        Returns the orientation of the Robi2 referenced to the orientation of the point of origin.
        The point of origin is set, where the Robi2 stood at the start time of the program or resetPos has been called.
        Returns:
        the difference of the orientation to the point of origin
      • getSpeedX

        public static float getSpeedX()
        Returns the current speed of the Robi2 in X-direction.
        Returns:
        speed
      • getSpeedY

        public static float getSpeedY()
        Returns the current speed of the Robi2 in Y-direction.
        Returns:
        speed
      • getRobiSpeed

        public static float getRobiSpeed()
        Returns the current speed of the Robi in his drive direction. The given value is in meter per second [m/s].
        Returns:
        speed in meter per second [m/s]
      • resetPos

        public static void resetPos()
        Reset the position.
        The current position is the new point of origin.
      • setLeftDriveSpeed

        public static void setLeftDriveSpeed​(int speed)
        Sets the speed of the left drive in percent.
        The sign define the direction. A negative value for backwards and a positive value for forward.
        Parameters:
        speed - range: -100..100
      • setLeftDriveSpeed

        public static void setLeftDriveSpeed​(float speed)
        Sets the speed of the left drive in meter per second [m/s].
        The sign define the direction. A negative value for backwards and a positive value for forward.
        Parameters:
        speed - range: -v_max...v_max
      • setRightDriveSpeed

        public static void setRightDriveSpeed​(int speed)
        Sets the speed of the right drive in percent.
        The sign define the direction. A negative value for backwards and a positive value for forward.
        Parameters:
        speed - range -100..100
      • setRightDriveSpeed

        public static void setRightDriveSpeed​(float speed)
        Sets the speed of the right drive in meter per second [m/s].
        The sign define the direction. A negative value for backwards and a positive value for forward.
        Parameters:
        speed - range: -v_max...v_max
      • drive

        public static void drive​(int speed)
        Set the speed and direction of both drives so that they rotates in the same direction.
        The sign define the direction. A negative value for backwards and a positive value for forward.
        Parameters:
        speed - range: -100..100
      • setDriveSpeedEqual

        public static void setDriveSpeedEqual​(int speed)
        Deprecated.
        Set the speed and direction of both drives so that they rotates in the same direction. The sign define the direction. A negative value for backwards and a positive value for forward.
        Parameters:
        speed - range: -100..100
      • turn

        public static void turn​(int speed)
        Set the speed and direction of both drives so that they rotates antidormic.
        The sign define the direction of the rotation of the Robi2.
        A positive value turns clockwise, a negative value turns counterclockwise.
        Parameters:
        speed - range: -100..100
      • setDrivesSpeedAntidormic

        public static void setDrivesSpeedAntidormic​(int speed)
        Deprecated.
        Set the speed and direction of both drives so that they rotates antidormic. The sign define the direction of the rotation of the Robi2. A positive value turns clockwise, a negative value turns counterclockwise.
        Parameters:
        speed - range: -100..100
      • stop

        public static void stop()
        Stop both drives
      • getBatteryVoltage

        public static float getBatteryVoltage()
        Returns the voltage of the battery
        Returns:
        voltage