Class AvaComponent

java.lang.Object
edu.tufts.hrilab.diarc.DiarcComponent
edu.tufts.hrilab.ava.AvaComponent
All Implemented Interfaces:
AvaInterface, LidarInterface, MoveBaseInterface
Direct Known Subclasses:
FakeMockAvaComponent

public class AvaComponent extends DiarcComponent implements AvaInterface
Represents the Ava robot navigation functionality.
  • Constructor Details

    • AvaComponent

      public AvaComponent()
  • Method Details

    • additionalUsageInfo

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

      protected void parseArgs(org.apache.commons.cli.CommandLine cmdLine)
      Description copied from class: DiarcComponent
      Override this method to parse command line args in the sub-class. Called directly after construction to pass runtime values that will override default values. This should parse all the options that additionalUsageInfo provides.
      Overrides:
      parseArgs in class DiarcComponent
    • init

      protected void init()
      Description copied from class: DiarcComponent
      Perform any component initialization. This should not be used for setting local fields to default values as was the case in DIARC. This method is called after the constructor, and after parseArgs. Setting default values should be done in field declaration or in the constructor.
      Overrides:
      init in class DiarcComponent
    • registerForAvaStatisticsNotifications

      public void registerForAvaStatisticsNotifications(ai.thinkingrobots.trade.TRADEServiceInfo callback)
    • unregisterForAvaStatisticsNotifications

      public void unregisterForAvaStatisticsNotifications(ai.thinkingrobots.trade.TRADEServiceInfo callback)
    • setAtPrimaryDock

      public void setAtPrimaryDock()
    • setAtSecondaryDock

      public void setAtSecondaryDock()
    • getDockRefId

      public Symbol getDockRefId()
      Specified by:
      getDockRefId in interface AvaInterface
    • displayRobot

      public void displayRobot(ai.thinkingrobots.trade.TRADEServiceInfo displayService)
      Calls the displayRobot TRADE service on the AvaDisplayComponent if available.
      Specified by:
      displayRobot in interface AvaInterface
    • getPosition

      public javax.vecmath.Point3d getPosition()
      Used to updated Firebase GUI TODO: is this method needed?
      Returns:
      Point3d of robot position
    • setPose

      public void setPose(javax.vecmath.Point3d location, javax.vecmath.Quat4d orientation)
      Deprecated. Cannot set pose of Ava robot without moving to location.
      Parameters:
      location - robot location
      orientation - robot orientation
    • setPoseGlobal

      public void setPoseGlobal(double x, double y, double z)
      Specified by:
      setPoseGlobal in interface MoveBaseInterface
    • getPoseGlobalQuat

      public double[] getPoseGlobalQuat()
      Specified by:
      getPoseGlobalQuat in interface MoveBaseInterface
    • getPose

      public org.apache.commons.lang3.tuple.Pair<javax.vecmath.Point3d,javax.vecmath.Quat4d> getPose()
    • getPoseGlobalMatrix4d

      public javax.vecmath.Matrix4d getPoseGlobalMatrix4d()
      Retrieves the current robot position and rotation and returns a converted Matrix4d.
      Returns:
      robot pose as Matrix4d
    • goToLocation

      public Justification goToLocation(Symbol location, boolean wait)
      Go to a known location in the world.
      Specified by:
      goToLocation in interface MoveBaseInterface
      Parameters:
      location - a known location.
      wait - should wait until movement is complete
    • goToLocation

      public Justification goToLocation(Symbol location)
      Description copied from interface: MoveBaseInterface
      go to the location and then move forward until certain distance from object in front
      Specified by:
      goToLocation in interface MoveBaseInterface
      Parameters:
      location - name of the desired location to navigate to
      Returns:
      justification specifying if the robot navigated to the location
    • goToLocation

      public Justification goToLocation(Symbol desiredLocation, Symbol initialLocation)
      Description copied from interface: MoveBaseInterface
      go to the location and then move forward until certain distance from object in front
      Specified by:
      goToLocation in interface MoveBaseInterface
      Parameters:
      desiredLocation - name of the desired location to navigate to
      initialLocation - name of the initial location to navigate from -- used for conditions and effects
      Returns:
      justification specifying if the robot navigated to the location
    • goToLocation

      public Justification goToLocation(javax.vecmath.Point3d location, javax.vecmath.Quat4d orientation, boolean wait)
    • goToLocation

      public Justification goToLocation(double xdest, double ydest, double quat_x, double quat_y, double quat_z, double quat_w, boolean wait)
      Description copied from interface: MoveBaseInterface
      go to the point and orientation
      Specified by:
      goToLocation in interface MoveBaseInterface
      Parameters:
      xdest - x point
      ydest - y point
      quat_x - x quaternion value
      quat_y - y quaternion value
      quat_z - z quaternion value
      quat_w - w quaternion value
      wait - should robot wait until reached desired point and orientation
      Returns:
      justification if the robot reach the desired point and orientation
    • approachLocation

      public Justification approachLocation(Symbol desiredLocation)
      Description copied from interface: MoveBaseInterface
      go to the location and then move forward until certain distance from object in front
      Specified by:
      approachLocation in interface MoveBaseInterface
      Parameters:
      desiredLocation - name of the desired location to navigate to
      Returns:
      justification specifying if the robot navigated to the location
    • approachLocation

      public Justification approachLocation(Symbol desiredLocation, Symbol initialLocation)
      Description copied from interface: MoveBaseInterface
      go to the location and then move forward until certain distance from object in front
      Specified by:
      approachLocation in interface MoveBaseInterface
      Parameters:
      desiredLocation - name of the desired location to navigate to
      initialLocation - name of the initial location to navigate from -- used for conditions and effects
      Returns:
      justification specifying if the robot navigated to the location
    • stop

      public Justification stop()
      Stop the robot by interrupting a goToLocation or goToArbitrary action.
      Specified by:
      stop in interface MoveBaseInterface
      Returns:
      true
    • isMoving

      public Justification isMoving()
      Return whether or not robot is in motion.
      Specified by:
      isMoving in interface MoveBaseInterface
      Returns:
      Justification true if moving
    • checkAt

      public List<Map<Variable,Symbol>> checkAt(Term locationTerm)
      Checks to see if the robot is within atOffset distance from goal pose
      Specified by:
      checkAt in interface MoveBaseInterface
      Parameters:
      locationTerm - the predicate to observe at(?actor, ?location)
      Returns:
      list of argument bindings empty list is failure to observe list with empty hashmap means actor is within atOffset of goal pose
    • followPath

      protected Justification followPath(List<PathAction> path)
    • goToDock

      public Justification goToDock()
      Send the Ava robot to dock. Automatically determines which dock is closer and forces localization to that dock after docking completes.
      Specified by:
      goToDock in interface AvaInterface
    • dock

      public Justification dock(Symbol dockRefId)
      Dock to a specific dock by reference ID.
      Parameters:
      dockRefId - the Symbol reference for the target dock (dockLocation or altDockLocation)
      Returns:
      justification of success/failure
    • getMapImages

      public List<byte[]> getMapImages()
    • getMapMetadatas

      public List<RMSMapMetadataResponse> getMapMetadatas()
    • goHomePrimitive

      public Justification goHomePrimitive()
      Description copied from interface: AvaInterface
      Send the robot dock location and then dock it.
      Specified by:
      goHomePrimitive in interface AvaInterface
      Returns:
      success or error
    • endSession

      public Justification endSession()
      Description copied from interface: AvaInterface
      Close an RMS session with the robot.
      Specified by:
      endSession in interface AvaInterface
      Returns:
      Justification true if successful
    • getBatteryLevel

      public double getBatteryLevel()
      Description copied from interface: AvaInterface
      Get the battery level of the Ava robot in percentage.
      Specified by:
      getBatteryLevel in interface AvaInterface
      Returns:
      double 0-100
    • getZLift

      public double getZLift()
      Description copied from interface: AvaInterface
      Get the current Z lift position of the robot.
      Specified by:
      getZLift in interface AvaInterface
      Returns:
      double percentage of lift 0-100
    • setZLift

      public Justification setZLift(double lift)
      Description copied from interface: AvaInterface
      Set the Z lift of the robot.
      Specified by:
      setZLift in interface AvaInterface
      Parameters:
      lift - percentage to set z lift to 0-100
    • getCameraTilt

      public double getCameraTilt()
      Description copied from interface: AvaInterface
      Get the current camera tilt position of the robot.
      Specified by:
      getCameraTilt in interface AvaInterface
      Returns:
      double percentage of tilt 0-100
    • setCameraTilt

      public Justification setCameraTilt(double tilt)
      Description copied from interface: AvaInterface
      Set the Z lift of the robot.
      Specified by:
      setCameraTilt in interface AvaInterface
      Parameters:
      tilt - percentage to set z lift to 0-100
    • setRotation

      public Justification setRotation(javax.vecmath.Quat4d orientation)
      Set the rotation of the robot.
      Parameters:
      orientation - Quat4d representing goal robot rotation
    • setRotation

      public Justification setRotation(double theta)
      Set the rotation of the robot.
      Parameters:
      theta - goal Z rotation of the robot
    • getRuntime

      public double getRuntime()
      Description copied from interface: AvaInterface
      Get the estimated remaining runtime of the robot in seconds.
      Specified by:
      getRuntime in interface AvaInterface
      Returns:
      runtime seconds
    • getLaserScan

      public float[] getLaserScan()
      Get the ranges of the laser scan.
      Specified by:
      getLaserScan in interface LidarInterface
      Returns:
      float array of laser scans in meters
    • getLaserAngleIncrement

      public float getLaserAngleIncrement()
      Get the angle increment between scans. Uses difference between the first two.
      Specified by:
      getLaserAngleIncrement in interface LidarInterface
      Returns:
      angle increment as float
    • getDynamicObstacles

      public List<Obstacle> getDynamicObstacles()
      Description copied from interface: AvaInterface
      Get a list of dynamic obstacles that the robot detects.
      Specified by:
      getDynamicObstacles in interface AvaInterface
      Returns:
      Object containing obstacles list
    • isDocked

      public boolean isDocked()
      Description copied from interface: AvaInterface
      Return true if robot is docked
      Specified by:
      isDocked in interface AvaInterface
      Returns:
      boolean
    • lookAtObstacle

      public Justification lookAtObstacle(Obstacle obs)
      Specified by:
      lookAtObstacle in interface AvaInterface
    • lookAt

      public Justification lookAt(double x, double y, double duration)
      Description copied from interface: AvaInterface
      Look at a vector.
      Specified by:
      lookAt in interface AvaInterface
      Parameters:
      x - position x
      y - position y
      duration - length of look at event
    • saveLocationTag

      public Justification saveLocationTag(Symbol location)
    • stopFollowing

      public Justification stopFollowing()
      Specified by:
      stopFollowing in interface AvaInterface
    • avaFollow

      public Justification avaFollow()
      Specified by:
      avaFollow in interface AvaInterface
    • moveForward

      public Justification moveForward(double distance)
      Description copied from interface: AvaInterface
      Drive straight forward along the robot's current heading using direct velocity commands until odometry shows the requested distance has been covered.
      Specified by:
      moveForward in interface AvaInterface
      Parameters:
      distance - meters to travel forward
    • parseTime

      public Symbol parseTime(Symbol input, Symbol amOrPm)
      Specified by:
      parseTime in interface AvaInterface
    • getWifiSignalStrength

      public Integer getWifiSignalStrength()
      Specified by:
      getWifiSignalStrength in interface AvaInterface
    • measureWifiRssi

      public Integer measureWifiRssi()
      Specified by:
      measureWifiRssi in interface AvaInterface
    • locationRefToName

      public String locationRefToName(Symbol ref)
      Specified by:
      locationRefToName in interface AvaInterface
    • rssiQualityLabel

      public String rssiQualityLabel(Symbol rssi)
      Specified by:
      rssiQualityLabel in interface AvaInterface
    • measureTemperatureDegrees

      public Integer measureTemperatureDegrees()
      Specified by:
      measureTemperatureDegrees in interface AvaInterface
    • blockToCharge

      public void blockToCharge()
      Specified by:
      blockToCharge in interface AvaInterface
    • interruptChargingBlock

      public void interruptChargingBlock()
      Specified by:
      interruptChargingBlock in interface AvaInterface
    • disableMicrophone

      public void disableMicrophone()
    • enableMicrophone

      public void enableMicrophone()
    • triggerWW

      public void triggerWW()
    • playAudioFile

      public void playAudioFile(String fileName)
    • playAudioClip

      public void playAudioClip(String fileName)
    • interruptListenForWWandASR

      public void interruptListenForWWandASR()
      Specified by:
      interruptListenForWWandASR in interface AvaInterface
    • listenForWWandASR

      public void listenForWWandASR()
      Specified by:
      listenForWWandASR in interface AvaInterface
    • waitForReadyAck

      public void waitForReadyAck()
      Specified by:
      waitForReadyAck in interface AvaInterface
    • interruptWaitForReadyAck

      public void interruptWaitForReadyAck()
      Specified by:
      interruptWaitForReadyAck in interface AvaInterface
    • interruptWaitForLearningGoalSubmissionOrQuestionAnswer

      public void interruptWaitForLearningGoalSubmissionOrQuestionAnswer(Symbol agent, Predicate learnedActionPredicate)
    • waitForLearningGoalSubmissionOrQuestionAnswer

      public Map<Variable,Symbol> waitForLearningGoalSubmissionOrQuestionAnswer(Symbol agent, String questionString, List<Term> responseForms, Predicate learnedActionPredicate)
    • waitForDuration

      public void waitForDuration(long seconds)
      Specified by:
      waitForDuration in interface AvaInterface
    • interruptWaitForDuration

      public void interruptWaitForDuration()
      Specified by:
      interruptWaitForDuration in interface AvaInterface
    • enableAdminMode

      public void enableAdminMode()
      Specified by:
      enableAdminMode in interface AvaInterface
    • disableAdminMode

      public void disableAdminMode()
      Specified by:
      disableAdminMode in interface AvaInterface
    • switchDisplayToTRACS

      public void switchDisplayToTRACS()
    • switchDisplayToTelepresencePrimitive

      public void switchDisplayToTelepresencePrimitive()