我开始在 IntelliJ IDEA 中编写NAO机器人,我在这两个方面都是新手,我创建了一些使NAO移动或说话的功能,每次看到发生了什么我都必须运行项目。现在我想在 KeyPress 上执行一些功能。你能给我举个例子吗。
如何更改此代码,以允许NAO站立、蹲伏或坐在某些按键上(例如:q-> Stand、w-> Crouch、e-> Sit)
package test;
import com.aldebaran.qi.Application;
import com.aldebaran.qi.helper.proxies.ALMotion;
import com.aldebaran.qi.helper.proxies.ALRobotPosture;
import com.aldebaran.qi.helper.proxies.ALTextToSpeech;
public class StandNao {
private static ALMotion motion;
public static void main(String[] args) throws Exception {
Application application = new NaoSettings().NaoConnect(args);
application.start();
motion = new ALMotion(application.session());
// Create an ALTextToSpeech object and link it to your current session
ALTextToSpeech tts = new ALTextToSpeech(application.session());
// Make your robot say something
tts.say("MAC Start Stand");
motion.killAll();
ALRobotPosture posture = new ALRobotPosture(application.session());
posture.getPostureList();
posture.goToPosture("Stand", 1.0f);
Thread.sleep(10000);
posture.goToPosture("Crouch", 1.0f);
Thread.sleep(10000);
posture.goToPosture("Sit", 1.0f);
}
}