Class MockNaoComponent

java.lang.Object
edu.tufts.hrilab.diarc.DiarcComponent
edu.tufts.hrilab.nao.MockNaoComponent
All Implemented Interfaces:
SpeechProductionInterface, VelocityInterface, MockNaoInterface, NaoInterface

public class MockNaoComponent extends DiarcComponent implements MockNaoInterface
  • Constructor Details

    • MockNaoComponent

      public MockNaoComponent()
  • Method Details

    • additionalUsageInfo

      protected List<org.apache.commons.cli.Option> additionalUsageInfo()
      Description copied from class: DiarcComponent
      Command line options available in sub-class. This should be paired with a parseArgs implementation.
      Overrides:
      additionalUsageInfo in class DiarcComponent
      Returns:
    • parseArgs

      public void parseArgs(org.apache.commons.cli.CommandLine cmdLine)
      Description copied from class: DiarcComponent
      Called directly after construction to pass runtime values that will override default values. This should parse all the options that additionalUsageInfo provides.zs
      Overrides:
      parseArgs in class DiarcComponent
    • isMoving

      public boolean isMoving()
      Description copied from interface: NaoInterface
      Query whether or not robot is moving.
      Specified by:
      isMoving in interface NaoInterface
      Returns:
    • goToPosture

      public boolean goToPosture(String targetPosture)
      Description copied from interface: NaoInterface
      Move into specified posture.
      Specified by:
      goToPosture in interface NaoInterface
      Returns:
    • moveTo

      public boolean moveTo(float x, float y, float theta)
      Description copied from interface: NaoInterface
      Makes the robot move to the given pose in the ground plane, relative to FRAME_ROBOT. This is a not a blocking call. TODO: this needs to be generalized into a DIARC interface so that it's not specific to the nao component.
      Specified by:
      moveTo in interface NaoInterface
      Parameters:
      x - Distance along the X axis in meters.
      y - Distance along the Y axis in meters.
      theta - Rotation around the Z axis in radians [-3.1415 to 3.1415].
      Returns:
    • moveToBlocking

      public boolean moveToBlocking(float x, float y, float theta)
      Description copied from interface: NaoInterface
      Makes the robot move to the given pose in the ground plane, relative to FRAME_ROBOT. This is a blocking call. TODO: this needs to be generalized into a DIARC interface so that it's not specific to the nao component.
      Specified by:
      moveToBlocking in interface NaoInterface
      Parameters:
      x - Distance along the X axis in meters.
      y - Distance along the Y axis in meters.
      theta - Rotation around the Z axis in radians [-3.1415 to 3.1415].
      Returns:
    • pointTo

      public boolean pointTo(float x, float y, float z)
      Description copied from interface: NaoInterface
      Points to the (x,y,z) location in the robot's base coordinate frame. Units are in meters.
      Specified by:
      pointTo in interface NaoInterface
      Returns:
    • pointHeadTo

      public boolean pointHeadTo(float x, float y, float z)
      Description copied from interface: NaoInterface
      Points head to the (x,y,z) location in the robot's base coordinate frame. Units are in meters.
      Specified by:
      pointHeadTo in interface NaoInterface
      Returns:
    • checkFloorSupport

      public boolean checkFloorSupport()
      Description copied from interface: NaoInterface
      Checks if there is floor support in front of the robot. TODO: this needs to be generalized into a DIARC interface so that it's not specific to the nao component.
      Specified by:
      checkFloorSupport in interface NaoInterface
      Returns:
      true if it's safe to move forward, false otherwise
    • checkObstacle

      public boolean checkObstacle()
      Description copied from interface: NaoInterface
      Checks if there is an obstacle in front of the robot. TODO: this needs to be generalized into a DIARC interface so that it's not specific to the nao component.
      Specified by:
      checkObstacle in interface NaoInterface
      Returns:
      true if it's safe to move forward, false otherwise
    • setFloorSupport

      public void setFloorSupport(boolean value)
      Description copied from interface: MockNaoInterface
      To set if there's floor support. Allows mocking the sensor checks done from the real robot.
      Specified by:
      setFloorSupport in interface MockNaoInterface
    • setObstacle

      public void setObstacle(boolean value)
      Description copied from interface: MockNaoInterface
      To set if there's an obstacle. Allows mocking the sensor checks done from the real robot.
      Specified by:
      setObstacle in interface MockNaoInterface
    • getPosture

      public String getPosture()
      Description copied from interface: NaoInterface
      Get current posture.
      Specified by:
      getPosture in interface NaoInterface
      Returns:
    • getPostureList

      public List<String> getPostureList()
      Description copied from interface: NaoInterface
      Get list of all possible postures.
      Specified by:
      getPostureList in interface NaoInterface
      Returns:
    • playFile

      public void playFile(String fileName)
      Description copied from interface: NaoInterface
      Play the specified audio file
      Specified by:
      playFile in interface NaoInterface
      Parameters:
      fileName - : the path of the file to play
    • angleInterpolation

      public void angleInterpolation(String name, float angle, float time, boolean isAbsolute)
      Description copied from interface: NaoInterface
      Move NAO joint to a particular angle.
      Specified by:
      angleInterpolation in interface NaoInterface
      Parameters:
      name - - joint name to move
      angle - -
      time - - how long to take to move to desired joint angle
    • angleInterpolation

      public void angleInterpolation(List<String> names, List<Float> angles, float time, boolean isAbsolute)
      Description copied from interface: NaoInterface
      Move NAO joints to a particular angle. A single time value is used for all joints.
      Specified by:
      angleInterpolation in interface NaoInterface
      Parameters:
      names - - joint name to move
      angles - - angles for joints
      time - - how long to take to move to desired joint angles
    • angleInterpolation

      public void angleInterpolation(List<String> names, List<Float> angles, List<Float> times, boolean isAbsolute)
      Description copied from interface: NaoInterface
      Move NAO joints to a particular angle. A different time values can be used for each joint.
      Specified by:
      angleInterpolation in interface NaoInterface
      Parameters:
      names - - joint name to move
      angles - - angles for joints
      times - - how long to take to move to desired joint angles
    • getAngle

      public float getAngle(String name)
      Description copied from interface: NaoInterface
      Get NAO joint angle.
      Specified by:
      getAngle in interface NaoInterface
      Parameters:
      name - - joint name
      Returns:
    • setVels

      public boolean setVels(double tv, double rv)
      Description copied from interface: VelocityInterface
      Set both velocities.
      Specified by:
      setVels in interface VelocityInterface
      Parameters:
      tv - the new TV (m/sec)
      rv - the new RV (rad/sec)
      Returns:
      true if there's nothing in front of the robot, false otherwise.
    • setRV

      public boolean setRV(double rv)
      Description copied from interface: VelocityInterface
      Set rotational velocity.
      Specified by:
      setRV in interface VelocityInterface
      Parameters:
      rv - the new RV (rad/sec)
      Returns:
      true if there's nothing on that side, false otherwise.
    • setTV

      public boolean setTV(double tv)
      Description copied from interface: VelocityInterface
      Set translational velocity.
      Specified by:
      setTV in interface VelocityInterface
      Parameters:
      tv - the new TV (m/sec)
      Returns:
      true if there's nothing in front of the robot, false otherwise.
    • getDefaultVels

      public double[] getDefaultVels()
      Description copied from interface: VelocityInterface
      Get the default velocities used by VelocityComponent functions.
      Specified by:
      getDefaultVels in interface VelocityInterface
      Returns:
      the default velocities (m/sec and rad/sec).
    • getVels

      public double[] getVels()
      Description copied from interface: VelocityInterface
      Get translational and rotational velocity.
      Specified by:
      getVels in interface VelocityInterface
      Returns:
      the most recent velocity readings (m/sec and rad/sec).
    • getRV

      public double getRV()
      Description copied from interface: VelocityInterface
      Get rotational velocity.
      Specified by:
      getRV in interface VelocityInterface
      Returns:
      the most recent RV reading (rad/sec).
    • getTV

      public double getTV()
      Description copied from interface: VelocityInterface
      Get translational velocity.
      Specified by:
      getTV in interface VelocityInterface
      Returns:
      the most recent TV reading (m/sec).
    • stop

      public void stop()
      Description copied from interface: VelocityInterface
      Stop.
      Specified by:
      stop in interface VelocityInterface
    • restLeftArm

      public boolean restLeftArm()
      Description copied from interface: NaoInterface
      Rests robot's left/right arm by placing thr hands on its lap and turning the motors off. Takes 1500ms to complete (blocking). Also disables hip motors!!!
      Specified by:
      restLeftArm in interface NaoInterface
      Returns:
    • restRightArm

      public boolean restRightArm()
      Specified by:
      restRightArm in interface NaoInterface
    • setStiffness

      public boolean setStiffness(String name, float stiffness)
      Description copied from interface: NaoInterface
      Sets joint/actuator stiffness
      Specified by:
      setStiffness in interface NaoInterface
      Parameters:
      name - Name of joint/actuator. See nao doc.
      stiffness - Value between 0 and 1
      Returns:
    • rest

      public boolean rest()
      Description copied from interface: NaoInterface
      Puts the nao in the rest position, relaxing all motors.
      Specified by:
      rest in interface NaoInterface
      Returns:
    • welcome

      public boolean welcome()
      Specified by:
      welcome in interface NaoInterface
    • openHand

      public boolean openHand(String name)
      Description copied from interface: NaoInterface
      Opens the hand
      Specified by:
      openHand in interface NaoInterface
      Parameters:
      name - Name of joint/actuator (LHand or RHand).
      Returns:
    • closeHand

      public boolean closeHand(String name)
      Description copied from interface: NaoInterface
      Closes the hand
      Specified by:
      closeHand in interface NaoInterface
      Parameters:
      name - Name of joint/actuator (LHand or RHand).
      Returns:
    • getPixelPositionInRobotFrame

      public javax.vecmath.Point3d getPixelPositionInRobotFrame(int pX, int pY, int width, int height, int camID)
      Description copied from interface: NaoInterface
      Computes position of pixel in robot frame.
      Specified by:
      getPixelPositionInRobotFrame in interface NaoInterface
      Parameters:
      pX - x position of pixel
      pY - y position of pixel
      width - Width of image
      height - Height of image
      camID - Camera ID (0 [top], 1 [bottom])
      Returns:
      Position of pixel projected on floor/table.
    • sayAnimated

      public boolean sayAnimated(String annotatedText)
      Specified by:
      sayAnimated in interface NaoInterface
    • setBreathEnabled

      public boolean setBreathEnabled(String par, boolean enable)
      Specified by:
      setBreathEnabled in interface NaoInterface
    • ledOn

      public boolean ledOn(String name)
      Specified by:
      ledOn in interface NaoInterface
    • ledOff

      public boolean ledOff(String name)
      Specified by:
      ledOff in interface NaoInterface
    • blink

      public boolean blink()
      Specified by:
      blink in interface NaoInterface
    • sayText

      public boolean sayText(String text)
      Description copied from interface: NaoInterface
      Perform text-to-speech on input text.
      Specified by:
      sayText in interface NaoInterface
      Specified by:
      sayText in interface SpeechProductionInterface
      Parameters:
      text - the text to be spoken
    • sayText

      public boolean sayText(String text, boolean wait)
      Description copied from interface: SpeechProductionInterface
      Speaks appropriate text
      Specified by:
      sayText in interface SpeechProductionInterface
      Parameters:
      text - the text to be spoken
      wait - whether or not to block until speaking call returns
    • sayToFile

      public boolean sayToFile(String text, String filename)
      Description copied from interface: NaoInterface
      To save tts output to file instead of saying it outloud.
      Specified by:
      sayToFile in interface NaoInterface
      Returns:
    • isSpeaking

      public boolean isSpeaking()
      Description copied from interface: SpeechProductionInterface
      Checks if speech is being produced.
      Specified by:
      isSpeaking in interface SpeechProductionInterface
      Returns:
      true if speech is being produced, false otherwise
    • stopUtterance

      public boolean stopUtterance()
      Description copied from interface: SpeechProductionInterface
      Stops an ongoing utterance.
      Specified by:
      stopUtterance in interface SpeechProductionInterface
      Returns:
      true if speech is interrupted, false otherwise.