// Camera real-time image transmissionCsjRobot.getInstance().registerCameraListener(newOnCameraListener() {
@OverridePublicvoidresponse(Bitmapbitmap) {
}
});
Registered robot integrated human detection event
// Comprehensive human detectionCsjRobot.getInstance().registerDetectPersonListener(newOnDetectPersonListener() {
@OverridePublicvoidresponse(inti) {
If(i == 0){ // no oneLog.d("TAG","registerDetectPersonListener: no one");
}elseif(i == 1){ // SomeoneLog.d("TAG","registerDetectPersonListener: someone");
}
}
});
Register face information event
// face informationCsjRobot.getInstance().registerFaceListener(newOnFaceListener() {
@OverridePublicvoidpersonInfo(Strings) {
// Member information recognized by the face (the face will continue to trigger)Log.d("TAG","registerFaceListener:s:"+s);
}
@OverridePublicvoidpersonNear(booleanb) {
If(b){// people face closeLog.d("TAG","registerFaceListener: face close");
}else{// face disappearsLog.d("TAG","registerFaceListener: face disappears");
}
}
});
Registered robot head sensor event (Xiaoxue)
// Robot head sensor (small snow)CsjRobot.getInstance().registerHeadTouchListener(newOnHeadTouchListener() {
@OverridePublicvoidresponse() {
Log.d("TAG","registerHeadTouchListener: Head Sensor Trigger");
}
});
Robot action
// robot actionActionaction = CsjRobot.getInstance().getAction();
// action resetAction.reset();
// Limb movement (bodyPart: limb part, action: corresponding action)Action.action(2,6);// bow// Start swinging around (intervalTime: interval)action.startWaveHands(1000);
// stop swinging left and rightaction.stopWaveHands();
// start dancingaction.startDance();
// stop dancingaction.stopDance();
/ / Getthecurrentrobot's location information
action.getPosition(newOnPositionListener() {
@OverridePublicvoidpositionInfo(Strings) {
// return json/*{ "msg_id": "NAVI_GET_CURPOS_RSP", "x": "0", "y": "0", "z": "0", "rotation": "0", "error_code": 0 }*/
}
});
/ / Movemethod (direction: direction0: before1: after2: left3: right)
// shorter moving distanceAction.move(0);
// navigation method (the robot navigates to a point)Stringjson = "";
/*{ "x": 2, "y": 1, "z": 0, "rotation": 30 }*/Action.navi(json, newOnNaviListener() {
@OverridePublicvoidmoveResult(Strings) {
// notification after arrival
}
@OverridePublicvoidmessageSendResult(Strings) {
// Notification after the navigation message is successfully sent
}
@OverridePublicvoidcancelResult(Strings) {
}
@OverridePublicvoidgoHome() {
}
});
// The robot cancels the current navigationaction.cancelNavi(newOnNaviListener() {
@OverridePublicvoidmoveResult(Strings) {
}
@OverridePublicvoidmessageSendResult(Strings) {
}
@OverridePublicvoidcancelResult(Strings) {
// Robot cancels navigation notification
}
@OverridePublicvoidgoHome() {
}
});
// Go to a specific angle ()action.goAngle(180);
// Step angle (Rotation>0: turn left, Rotation<0: turn right)action.moveAngle(180, newOnGoRotationListener() {
@OverridePublicvoidresponse(inti) {
// arrival angle notification
}
});
// Go back to chargingaction.goHome(newOnNaviListener() {
@OverridePublicvoidmoveResult(Strings) {
}
@OverridePublicvoidmessageSendResult(Strings) {
}
@OverridePublicvoidcancelResult(Strings) {
}
@OverridePublicvoidgoHome() {
// charging notification
}
});
// save the map information of the current robotaction.saveMap();
/ / Loadthesavedrobotmapinformationaction.loadMap();
// Robot speed setting (0.1-0.7, default 0.5)action.setSpeed(0.6f);
// Navigation status queryAction.search(newOnNaviSearchListener() {
@OverridePublicvoidsearchResult(Strings) {
/*{ "msg_id": "NAVI_GET_STATUS_RSP", "state": 0, "error_code": 0 }*/// state: 0 is idle, 1: is navigating
}
});
// Nodding actionaction.nodAction();
// Xiao Xue’s right arm swingsaction.snowRightArm();
// Xiaoxue left arm swingaction.snowLeftArm();
// Small snow arms swingingaction.snowDoubleArm();
// Alice looks upaction.AliceHeadUp();
// Alice heads downaction.AliceHeadDown();
// Alice head resetaction.AliceHeadHReset();
// Alice lifts her left armaction.AliceLeftArmUp();
// Alice puts her left arm downaction.AliceLeftArmDown();
// Alice lifts her right armaction.AliceRightArmUp();
// Alice puts her right arm downaction.AliceRightArmDown();
// Xiaoxue left arm swing timesaction.SnowLeftArmSwing(20);
// Xiaoxue right arm swing timesaction.SnowRightArmSwing(20);
// Small snow arms swingsaction.SnowDoubleArmSwing(20);
// turn leftaction.turnLeft(newOnGoRotationListener() {
@OverridePublicvoidresponse(inti) {
// complete the notification
}
});
// turn rightaction.turnRight(newOnGoRotationListener() {
@OverridePublicvoidresponse(inti) {
// complete the notification
}
});
// move to the leftaction.moveLeft();
// move to the rightaction.moveRight();
// go aheadaction.moveForward();
// backaction.moveBack();
TTS (speech synthesis)
// Robot TTSISpeechSpeakspeak = CsjRobot.getInstance().getTts();
// start speakingspeak.startSpeaking("Hello!", newOnSpeakListener() {
@OverridePublicvoidonSpeakBegin() {
// Before you speak
}
@OverridePublicvoidonCompleted(SpeechErrorspeechError) {
// speak is complete
}
});
// Stop talkingspeak.stopSpeaking();
// pause talkingspeak.pauseSpeaking();
// Re-talkspeak.resumeSpeaking();
// Is it talking?speak.isSpeaking();
// You can also use your own implementation of TTS (inherited from ISpeechSpeak interface)CsjRobot.getInstance().setTts(null);
Speech Recognition
// robot voiceSpeechspeech = CsjRobot.getInstance().getSpeech();
// Turn on the SMS service (it is enabled by default, no need to operate)speech.startSpeechService();
// Close the Xunfei voice servicespeech.closeSpeechService();
// turn on multiple recognitionsspeech.startIsr();
// turn off multiple recognitionspeech.stopIsr();
// Turn on single recognitionspeech.startOnceIsr();
/ / Turnoffsinglerecognitionspeech.stopOnceIsr();
// Manually wake up the robotspeech.openMicro();
// Manually get the answer to the questionspeech.getResult("What is your name?", newOnSpeechGetResultListener() {
@OverridePublicvoidresponse(Strings) {
}
});
Face recognition information
// Robot face recognitionFaceface = CsjRobot.getInstance().getFace();
// Turn on the camera (turn on video streaming by default)face.openVideo();
// turn off the cameraface.closeVideo();
// Start face recognition service (default is enabled)face.startFaceService();
// Close the face recognition serviceface.closeFaceService();
// camera photoFace.snapshot(newOnSnapshotoListener() {
@OverridePublicvoidresponse(Strings) {
/* * { "error_code": 0, "face_position": 0, "msg_id":"FACE_SNAPSHOT_RESULT_RSP" } */// erro_code : 0 means someone face, other means no face
}
});
// Face registration (save the face of the current photo)face.saveFace("张三", newOnFaceSaveListener() {
@OverridePublicvoidresponse(Strings) {
/* * { "msg_id": "FACE_SAVE_RSP", "person_id": "personx20170107161021mRJOVw", "error_code": 0 }*/// error_cdoe : 0 success, 40002 face is registered, 40003 face name format is wrong
}
});
// face information deletionface.faceDel("faceId");
// Face information bulk deletionface.faceDelList("faceIdsJson");
// Get all face databasesface.getFaceDatabase(newOnGetAllFaceListener() {
@OverridePublicvoidpersonList(Strings) {
// s
}
});
Robot Status
// Robot statusStatestate = CsjRobot.getInstance().getState();
// The connection status of the robotstate.isConnect();
// The power value of the robotstate.getElectricity();
// The current state of charge of the robotstate.getChargeState();
// Robot shuts downState.shutdown();
// Robot restartState.reboot();
// Get robot battery informationstate.getBattery(newOnRobotStateListener() {
@OverridePublicvoidgetBattery(inti) {
// returned power value
}
@OverridePublicvoidgetCharge(inti) {
}
});
/ / Gettherobot's state of charge
state.getCharge(newOnRobotStateListener() {
@OverridePublicvoidgetBattery(inti) {
}
@OverridePublicvoidgetCharge(inti) {
// returned state of charge
}
});
// Robot check informationstate.checkSelf(newOnWarningCheckSelfListener() {
@OverridePublicvoidresponse(Strings) {
/ / Returntotherobot's inspection information
}
});
/ / Manuallyobtaincomprehensivehumandetectioninformationstate.getPerson(newOnDetectPersonListener() {
@OverridePublicvoidresponse(inti) {
// returned status// i==0 no one i==1 someone
}
});
// Get the SN information of the robotstate.getSN(newOnSNListener() {
@OverridePublicvoidresponse(Strings) {
// returned SN information
}
});
// Robot version informationVersionversion = CsjRobot.getInstance().getVersion();
/ / Getrobotversioninformationversion.getVersion(newOnGetVersionListener() {
@OverridePublicvoidresponse(Strings) {
// returned version information
}
});
// The underlying software checkversion.softwareCheck(newOnUpgradeListener() {
@OverridePublicvoidcheckRsp(inti) {
If (i == 60002) {// is the latest version
} elseif (i == 60001) {//No version information is obtained, please check the network
} elseif (i == 0) {//Normal update
}
}
@OverridePublicvoidupgradeRsp(inti) {
}
@OverridePublicvoidupgradeProgress(inti) {
}
});
// Underlying software updateversion.softwareUpgrade(newOnUpgradeListener() {
@OverridePublicvoidcheckRsp(inti) {
}
@OverridePublicvoidupgradeRsp(inti) {
}
@OverridePublicvoidupgradeProgress(inti) {
// update progress
}
});
Other functions
// Other functionsExtraextra = CsjRobot.getInstance().getExtra();
// Get the list of hot words for the robotextra.getHotWords(newOnHotWordsListener() {
@OverridePublicvoidhotWords(List<String> list) {
// list of hot words returned
}
});
/ / Setthehotwordfunctionextra.setHotWords(null);
// resetextra.resetRobot();