Skip to content
Yu-Wei Liu edited this page Dec 25, 2021 · 1 revision

Getting Started

Initialization

from interacter import Server
import time

robot = Server(50051, 'zh')

while not self.robot.is_robot_connected:
    time.sleep(1)

print('robot connected: ' + self.robot.robot_type + ':' + self.robot.locale)

Call Methods

api_returns = robot.api_methods(args_1, args_2)

Methods Table

Robot APIs
Methods Description
say( String speech, Boolean listen )

Call this method to make the robot say something.

Arguments: speech (String): The actual sentence you want the robot to say. listen (Boolean): When set to False, the robot will say a sentence and immediately expect the next command. When set to True, after talking the robot will wait for the user to speak, parse the speech and send it back to the server. Returns (String): If listen=True, the users' speech and the file path of voice recording is returned, otherwise it will return None. Notes: TODO: Make the function of voice recording be independent to say.
videoRecord( String value )

Use this method to enable/disable video streaming from the robot.

Arguments: value (String): "start": command the robot to start recording. "stop": command the robot to stop recording. Returns: If value is "stop" and the video is succesfully stored, the robot will return its filename. Videos are stored in the Movies/bgRec directory.
videoStream( String value )
Use this method to enable/disable video streaming from the robot
Arguments:
    value: 
        "start": command the robot to start streaming. 
        "stop": command the robot to stop streaming.
Returns:
    On successful start, returns the port where the video is being streamed.
Notes:
    Video streaming requires a viewfinder to be shown on the robots' screen. This cannot be disabled.
    If the connection to the server is lost (i.e. when the server-side program is interrupted), the stream will stop automatically.
    There are two services that use the camera: videoStream and videoRecord. Only one can be active at a time.
    If you attempt to call any of these while any another is active, an error message will be returned.    
            
( Add New Function Here ) ( Add New Function's Description Here)