Common API¶
- mini.mini_sdk.set_log_level(level: int, save_file: Optional[str] = None)[source]¶
Set the sdk log level
- Parameters
level – logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR
save_file – Need to save to a file, fill in the log file path
- class mini.mini_sdk.RobotType(value)[source]¶
Bases:
enum.Enum
Robot Product Type
- DEDU = 1¶
AlphaMini China Education Edition
- MINI = 2¶
AlphaMini China Standard Edition
- EDU = 3¶
AlphaMini Oversea Education Edition
- KOR = 4¶
AlphaMini Korea Edition
- OTOC = 5¶
AlphaMini Oversea ToC Edition
- mini.mini_sdk.set_robot_type(robot: mini.mini_sdk.RobotType)[source]¶
Set the robot product type to be linked
- Parameters
robot – Value is: RobotType.EDU, RobotType.KOR, RobotType.MINI or RobotType.DEDU
- async mini.mini_sdk.get_device_by_name(name: str, timeout: int) Optional[mini.dns.dns_browser.WiFiDevice] [source]¶
Get the robot device information with the specified name in the current LAN
- Parameters
name – device serial number
timeout – scan timeout
- Returns
Optional[WiFiDevice]
- async mini.mini_sdk.get_device_list(timeout: int) tuple [source]¶
Get all the robot device information in the current LAN
- Parameters
timeout – timeout
- Returns
Optional[WiFiDevice]
- async mini.mini_sdk.connect(device: mini.dns.dns_browser.WiFiDevice) bool [source]¶
Connect robot equipment
- Parameters
device (WiFiDevice) – Specify the robot device object
- Returns
Whether the device is connected successfully
- Return type
bool
- async mini.mini_sdk.enter_program() bool [source]¶
Enter programming mode api
Robot enters programming mode
- Returns
bool
- async mini.mini_sdk.quit_program() bool [source]¶
Exit programming mode api
Robot exits programming mode
- Returns
bool
- async mini.mini_sdk.play_action(action_name: Optional[str] = None) bool [source]¶
Execute built-in action api
The robot performs a built-in action with a specified name
The action name can be obtained with get_action_list
- Parameters
action_name (str) – action name
- Returns
bool
- async mini.mini_sdk.stop_action() bool [source]¶
Stop action
If the action is an uninterruptible action, stop_action returns False
- Returns
bool
- async mini.mini_sdk.play_custom_action(action_name: Optional[str] = None) bool [source]¶
Execute custom action api
Let the robot perform a custom action with a specified name and wait for the result
The action name can be obtained by get_custom_action_list
- Parameters
action_name (str) – custom action name
- Returns
bool
- async mini.mini_sdk.stop_custom_action() bool [source]¶
Stop custom action
If the action is an uninterruptible action, stop_action returns False
- Returns
bool
- async mini.mini_sdk.move(direction: mini.apis.api_action.MoveRobotDirection = MoveRobotDirection.FORWARD, step: int = 1) bool [source]¶
Control robot movement
Control the robot to move 10 steps to the left (LEFTWARD) and wait for the execution result
- Parameters
direction (MoveRobotDirection) – direction
step (int) – number of steps
- Returns
bool
- async mini.mini_sdk.get_action_list() list [source]¶
Get action list
Get the list of actions built into the robot system, and wait for the reply result
- Returns
Action list
- Return type
[]
- async mini.mini_sdk.get_custom_action_list() list [source]¶
Get a list of custom actions
Get the action list under the robot/sdcard/customize/actions and wait for the reply result
- Returns
Custom action list
- Return type
[]
- async mini.mini_sdk.wiki(query: str) bool [source]¶
Query encyclopedia demo
Query encyclopedia, for example: query content “you must choose”, and wait for the result, the robot broadcasts the
query result
- Parameters
query (str) – query keyword
- Returns
bool
- async mini.mini_sdk.translate(query: str, from_lan: Optional[mini.apis.api_config.LanType] = None, to_lan: Optional[mini.apis.api_config.LanType] = None, platform: mini.apis.api_config.ServicePlatform = ServicePlatform.BAIDU) bool [source]¶
translation
For example: Use Baidu Translate to translate “张学友” from Chinese to English, and wait for the result,
the robot broadcasts the translation result:
translate(query=”张学友”,from_lan=CN,to_lan=EN,platform=GOOGLE)
- Args:
query (str): keyword from_lan (LanType): source language to_lan (LanType): target language platform (ServicePlatform): GOOGLE, Only Support Google
- Returns
bool
- async mini.mini_sdk.play_expression(express_name: str) bool [source]¶
Do an Expression
Let the robot play a built-in expression of express_name and wait for the reply result
- Parameters
express_name (str) – emoticon file name, such as: “codemao1”
- Returns
bool
- async mini.mini_sdk.play_behavior(behavior_name: str) bool [source]¶
Do a dance
Let the robot start to dance a dance named behavior_name and wait for the response result
- Parameters
behavior_name (str) – e.g. “dance_0004”
- Returns
bool
- async mini.mini_sdk.set_MouthLamp_NormalMode(color: mini.apis.api_expression.MouthLampColor = MouthLampColor.RED, duration: int = 1000) bool [source]¶
Set mouth light always on mode and wait for the result
- Parameters
color (MouthLampColor) – Mouth lamp color, default RED
duration (int) – unit ms, duration
- Returns
bool
- async mini.mini_sdk.set_MouthLamp_BreathMode(breath_duration: int = 1000, color: mini.apis.api_expression.MouthLampColor = MouthLampColor.RED, duration: int = 1000) bool [source]¶
Set mouth light breathing mode and wait for the result
- Parameters
breath_duration (int) – unit ms, the duration of one breath
color (MouthLampColor) – Mouth lamp color, default RED
duration (int) – unit ms, duration
- Returns
bool
- async mini.mini_sdk.switch_MouthLamp(is_open: bool = True) bool [source]¶
Switch mouth light
Turn on and off the robot’s mouth light and wait for the result
- Parameters
is_open – bool
- Returns
bool
- async mini.mini_sdk.play_tts(text: str) bool [source]¶
Play tts
Make the robot start playing a period of tts and wait for the result
- Parameters
text – str, for example: “Hello, I am Wukong, la la la”,
- Returns
bool
- async mini.mini_sdk.stop_tts() bool [source]¶
Stop speech synthesis broadcast, and wait for the result
- Returns
bool
- async mini.mini_sdk.play_online_audio(url: str) bool [source]¶
Play online sound effects
Make the robot play an online sound effect,
And wait for the result
- Parameters
url – str, for example: http://yun.lnpan.com/music/download/ring/000/075/5653bae83917a892589b372782175dd8.amr Supported formats are mp3, amr, wav, etc.
- Returns
bool
- async mini.mini_sdk.play_local_audio(local_file: str) bool [source]¶
Play local sound effects
Make the robot play a local built-in sound effect, the sound effect name is “read_016”, and wait for the result
- Parameters
local_file –
- Returns
bool
- async mini.mini_sdk.stop_audio() bool [source]¶
Stop all audio that is playing
Stop all sound effects and wait for the result
- Returns
bool
- async mini.mini_sdk.get_system_audio_list() codemao_getaudiolist_pb2.GetAudioListResponse [source]¶
Get a list of sound effects
Get the list of sound effects built into the robot and wait for the result
#GetAudioListResponse.audio ([Audio]): audio effect list
#Audio.name: Audio effect name
#Audio.suffix: audio suffix
#GetAudioListResponse.isSuccess: Is it successful, True or False
#GetAudioListResponse.resultCode: Result code
- Returns
GetAudioListResponse
- async mini.mini_sdk.get_custom_audio_list() codemao_getaudiolist_pb2.GetAudioListResponse [source]¶
Get a list of sound effects
Get the list of sound effects placed by the robot developer under /sdcard/customize/music/, and wait for the result
#GetAudioListResponse.audio ([Audio]): Audio effect list
#Audio.name: Audio effect name
#Audio.suffix: audio suffix
#GetAudioListResponse.isSuccess: Is it successful, True or False
#GetAudioListResponse.resultCode: Result code
- Returns
GetAudioListResponse
- async mini.mini_sdk.change_volume(volume: float = 0.5) bool [source]¶
Adjust the robot volume demo
Set the robot volume to 0~1 and wait for the reply result
- Parameters
volume – float default 0.5
- Returns
bool
- async mini.mini_sdk.face_detect() codemao_facedetect_pb2.FaceDetectResponse [source]¶
Face count detection
Do a face count detection and wait for the reply result
#FaceDetectResponse.count: the number of faces
#FaceDetectResponse.isSuccess: Is it successful, True or False
#FaceDetectResponse.resultCode: Return code
- Returns
FaceDetectResponse
- async mini.mini_sdk.face_analysis() codemao_faceanalyze_pb2.FaceAnalyzeResponse [source]¶
Face analysis (gender)
Do a face information (gender, age) detection, and wait for the reply result
When multiple people are in front of the camera, return the face information that accounts for the
largest proportion of the screen.
Return value: Example {“age”: 24, “gender”: 99, “height”: 238, “width”: 238}
age: age
gender: [1, 100], females less than 50 are females, males greater than 50
height: the height of the face in the camera image
width: the width of the face in the camera image
#FaceAnalyzeResponse.faceInfos: face information array [FaceInfoResponse]
#FaceInfoResponse.gender (int) :[1,100], females less than 50, males greater than 50
#FaceInfoResponse.age: age
#FaceInfoResponse.width: The width of the face in the camera screen
#FaceInfoResponse.height: The height of the face in the camera screen
#FaceAnalyzeResponse.isSuccess: Is it successful, True or False
#FaceAnalyzeResponse.resultCode: Return code
- Returns
FaceAnalyzeResponse
- async mini.mini_sdk.face_recognise() codemao_facerecognise_pb2.FaceRecogniseResponse [source]¶
Face recognition
Do a face recognition test and wait for the result
#FaceRecogniseResponse.faceInfos: [FaceInfoResponse] face information array
#FaceInfoResponse.id: face id
#FaceInfoResponse.name: name, if it is a stranger, the default name is “stranger”
#FaceInfoResponse.gender: gender
#FaceInfoResponse.age: age
#FaceRecogniseResponse.isSuccess: Is it successful, True or False
#FaceRecogniseResponse.resultCode: Return code
- Returns
RecogniseObjectResponse
- async mini.mini_sdk.flower_recognise() codemao_recogniseobject_pb2.RecogniseObjectResponse [source]¶
Flower and grass recognition
Let the robot do a flower and grass recognition (you need to manually place the flower or flower photo in front of the robot),
and wait for the result.
#RecogniseObjectResponse.objects: Recognition result array [str]
#RecogniseObjectResponse.isSuccess: Is it successful, True or False
#RecogniseObjectResponse.resultCode: Return code
- Returns
RecogniseObjectResponse
- async mini.mini_sdk.fruit_recognise() codemao_recogniseobject_pb2.RecogniseObjectResponse [source]¶
Fruit recognition
Let the robot do a fruit recognition (you need to manually put the fruit or fruit photo in front of the robot),
and wait for the result.
#RecogniseObjectResponse.objects: Recognition result array [str]
#RecogniseObjectResponse.isSuccess: Is it successful
#RecogniseObjectResponse.resultCode: Return code
- Returns
RecogniseObjectResponse
- async mini.mini_sdk.gesture_recognise() codemao_recogniseobject_pb2.RecogniseObjectResponse [source]¶
Gesture Recognition
Let the robot do a user gesture recognition, (need to make a gesture in front of the robot), and wait for the result
#RecogniseObjectResponse.objects: Recognition result array [str]
#RecogniseObjectResponse.isSuccess: Is it successful
#RecogniseObjectResponse.resultCode: Return code
- Returns
RecogniseObjectResponse
- async mini.mini_sdk.take_picture_immediately() codemao_takepicture_pb2.TakePictureResponse [source]¶
Take pictures
Let the robot take a photo immediately and wait for the result
#TakePictureResponse.isSuccess: Is it successful, True or False
#TakePictureResponse.code: Return code
#TakePictureResponse.picPath: The storage path of the photo in the robot
- Returns
TakePictureResponse
- async mini.mini_sdk.take_picture() codemao_takepicture_pb2.TakePictureResponse [source]¶
Take pictures
Let the robot find the face before taking a picture and wait for the result
#TakePictureResponse.isSuccess: Is it successful, True or False
#TakePictureResponse.code: Return code
#TakePictureResponse.picPath: The storage path of the photo in the robot
- Returns
TakePictureResponse
- async mini.mini_sdk.get_register_faces() codemao_getregisterfaces_pb2.GetRegisterFacesResponse [source]¶
Get registered face information
Get all the face information registered in the robot and wait for the result
#GetRegisterFacesResponse.faceInfos: [FaceInfoResponse] face information array
#FaceInfoResponse.id: face id
#FaceInfoResponse.name: name
#FaceInfoResponse.gender: gender
#FaceInfoResponse.age: age
#GetRegisterFacesResponse.isSuccess: Is it successful, True or False
#GetRegisterFacesResponse.resultCode: Return code
- Returns
GetRegisterFacesResponse
- async mini.mini_sdk.get_infrared_distance() codemao_getinfrareddistance_pb2.GetInfraredDistanceResponse [source]¶
Infrared distance detection
Get the infrared distance detected by the current robot and wait for the result
#GetInfraredDistanceResponse.distance: Infrared distance
- Returns
GetInfraredDistanceResponse