ich ein NAO Roboter in IntelliJ IDEA und ich bin neu in beide, habe ich einige Funktionen, die macht NAO zu programmieren begann jedes Mal, sich zu bewegen oder zu sprechen, um zu sehen, was geschieht Ich muss ein Projekt ausführen. Jetzt möchte ich einige Funktionen auf KeyPress ausführen. Können Sie mir ein Beispiel geben?Steuerroboter in JAVA mit Tastatur
Wie diesen Code ändern, ermöglichen NAO stehen, Crouch oder Setzen Sie sich auf einige KeyPress (ex: 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);
}
}
Es ist keine gute Idee, Java zu schreiben, um etwas so Komplexes wie einen Roboter zu steuern, außer man weiß, wie man in Java gut programmiert. Kein gutes "Hallo Welt" -Problem. – duffymo