Skip to content

Latest commit

 

History

History
executable file
·
97 lines (92 loc) · 8 KB

action-functions.md

File metadata and controls

executable file
·
97 lines (92 loc) · 8 KB

Home | Action Functions | Listener Functions | UI Components

Action functions

  • rwcActionSetPoseRelative
    • Arguments: x, y, z, quaternion = {x: 0, y: 0, z: 0, w: 1}
    • Description: Tells the robot to move to a new pose relative to its current pose.
    • Example: rwcActionSetPoseRelative(1, 0, 0);
      • Tells the robot to move forward 1m.
  • rwcActionSetPoseMap
    • Arguments: x, y, z, quaternion = {x: 0, y: 0, z: 0, w: 1}
    • Description: Tells the robot to move to a new pose relative to the origin of its map.
    • Example: rwcActionSetPoseMap(5, 5, 0);
      • Tells the robot to move to x: 5, y: 5 in its metric map.
  • rwcActionGoToNode
    • Arguments: node_name, no_orientation = false
    • Description: Tells the robot to move the topological node 'node_name'.
    • Example: rwcActionGoToNode("WayPoint32");
      • Tells the robot to move to the topological node 'WayPoint32'.
  • rwcActionVolumePercentChange
    • Arguments: percentage_change
    • Description: Changes the master audio volume of the robot's speaker by percentage_change percent. Depends on the audio-volume ROS package.
    • Example: rwcActionVolumePercentChange(20);
      • Changes the master audio volume of the robot's speaker by +20%.
    • Example: rwcActionVolumePercentChange(-100);
      • Changes the master audio volume of the robot's speaker by -100%, effectively muting the speaker.
  • rwcActionVolumePercentSet
    • Arguments: percentage
    • Description: Set the master audio volume of the robot's speaker to percentage percent. Depends on the audio-volume ROS package.
    • Example: rwcActionVolumePercentSet(20);
      • Sets the master audio volume of the robot's speaker at 20%.
    • Example: rwcActionVolumePercentSet(0);
      • Sets the master audio volume of the robot's speaker at 0%, effectively muting the speaker.
  • rwcActionSay
    • Arguments: phrase
    • Description: Asks the robot to speak the given phrase using TTS (Text To Speech). By default this library uses MaryTTS, but you can specify an ActionServer name and goal message type for your own TTS ActionServer in rwc-config.json under "actions" > "actionServers" > "speak".
    • Example: rwcActionSay("Hello world!");
      • Tells the robot to speak the phrase "Hello world!" using TTS.
  • rwcActionYesNoModal
    • Arguments: text
    • Description: Displays a prompt with text at its head, and two buttons for the user's reply: 'No' and 'Yes'. The user's choice is published on the topic /interface/buttonPressed, as either "modalNo" or "modalYes". The prompt will persist until the user has chosen their response, and the rest of the interface will be dimmed and disabled while it is displayed.
    • Example: rwcActionYesNoModal("What will you choose?");
      • Displays a prompt with the text "What will you choose, and two buttons for the user's reply: 'No' and 'Yes'.

        alt text

Action function callbacks

Each action function returns a ROSLIB.Goal object. By using the jQuery .on method, you can define a callback function to be executed when the goal is completed (sucessfully or otherwise). For example, you can define a callback function for the completion of the goal sent by rwcActionGoToNode("WayPoint2") with the following code:

rwcActionGoToNode("WayPoint2").on('result', function(){
    console.log("Navigation to waypoint 2 ended!");
});

If you want to access the goal's status to see for example if the goal completed sucessfully, it's best to assign the goal returned by an action function to variable, then define the callback, within which you can access the goal's status as so:

var myAction = rwcActionGoToNode("WayPoint2");
myAction.on('result', function(){console.log(myAction.status.status)});

This status is a number which corresponds to a particular string describing the status of the goal, as seen in the documentation of actionlib_msgs/GoalStatus Message. This library provides a global array of these strings indexed according to their ID, so that you can quickly find the meaning of a goal's status. Using this to display the status of a goal upon its completion can be done as follows:

var myAction = rwcActionGoToNode("WayPoint2");
myAction.on('result', function(){console.log(goalStatusNames[myActionSay.status.status])});

ROS topic functions

  • /rwc/load_page
    • Fields: data
    • Description: Prompts the interface to load the page given as a String in the data field.
    • Example: rostopic pub /rwc/load_page std_msgs/String "data: 'map-page.html'"
      • Redirects the interface to the page map-page.html.

Lindsey action functions

  • rwcActionGazeAtPosition
    • Arguments: x, y, z, secs
    • Description: Tells the robot to gaze at the given position for secs seconds. This function relies on the ROS package strands_gazing, and is intended for use with STRANDS project robots.
    • Example: rwcActionGazeAtPosition(1, 2, 0, 60)
      • Tells the robot to gaze at the co-ordinates x: 1, y: 2, z: 0 on its metric map for 60 seconds.
  • rwcActionDescribeExhibit
    • Arguments: name_or_key, duration=60*5
    • Description: Tells Lindsey to describe the exhibit corresponding to the given name or key, taking up to a maximum of duration seconds to complete this task. Names and keys of exhibits can be obtained with the listener functions rwcListenerGetExhibitNames, rwcListenerGetExhibitKeys, and rwcListenerGetExhibitKeysAndNames.
    • Example: rwcActionDescribeExhibit("Claudia Crysis tombstone");
      • Tells Lindsey to describe the exhibit titled 'Claudia Crysis tombstone'.
    • Example: rwcActionDescribeExhibit(1.2);
      • Tells Lindsey to describe the exhibit with the key '1.2'.
  • rwcActionGoToAndDescribeExhibit
    • Arguments: name_or_key, duration=60*30
    • Description: Tells Lindsey to navigate to and describe the exhibit corresponding to the given name or key, taking up to a maximum of duration seconds to complete this task. While doing so Lindsey will ask nearby people to follow her to the exhibit, and when at exhibit will ask if people wan't to know more via a speech and touchscreen prompt. Names and keys of exhibits can be obtained with the listener functions rwcListenerGetExhibitNames, rwcListenerGetExhibitKeys, and rwcListenerGetExhibitKeysAndNames.
    • Example: rwcActionGoToAndDescribeExhibit("Claudia Crysis tombstone");
      • Tells Lindsey to navigate to and describe the exhibit titled 'Claudia Crysis tombstone'.
    • Example: rwcActionGoToAndDescribeExhibit(1.2);
      • Tells Lindsey to navigate to and describe the exhibit with the key '1.2'.
  • rwcActionStartTour
    • Arguments: name_or_key, duration=60*60
    • Description: Tells Lindsey to start the tour corresponding to the given name or key, taking up to a maximum of duration seconds to complete this task. Names and keys of exhibits can be obtained with the listener functions rwcListenerGetTourNames, rwcListenerGetTourKeys, and rwcListenerGetTourKeysAndNames.
    • Example: rwcActionStartTour("Death and Burial tour");
      • Tells Lindsey to start the tour titled 'Death and Burial tour'.
    • Example: rwcActionStartTour("religion");
      • Tells Lindsey to start the tour with the key 'religion'.