hi, beim Bewegungsfeld des Kontrollers handelt es sich um ein Achteck https://de.wikipedia.org/wiki/Achteck dem entsprechend kann man es nicht einfach berechnen.
meine versuche
//prozentuale ansteuerung Roemisch I
if (py>=0 && px>0){
if (py-px >= 0) {
linksP = px*w21+py;
rechtsP = 100-px*w2;
//Serial.print("Roemis I O-1");
}
if (py-px < 0) {
if (py > 0){
linksP = py*w21+px;
rechtsP = -100+py*w2;
}
//Serial.print("Roemis I O-2");
}
}
//prozentuale ansteuerung Roemisch II
if (py<0 && px>=0){
if (py+px >= 0) {
linksP = 100+py*w2;
rechtsP = py*w21-px;
//Serial.print("Roemis II O-3");
}
if (py+px < 0) {
linksP = -100+px*w2;
rechtsP = -px*w21+py;
//Serial.print("Roemis II O-4");
}
}
//prozentuale ansteuerung Roemisch III
if (py<=0 && px<0){
if (py-px < 0) {
linksP = +px*w21+py;
rechtsP = -100-px*w2;
//Serial.print("Roemis III O-5");
}
if (py-px >= 0) {
linksP = +py*w21+px;
rechtsP = 100+py*w2;
//Serial.print("Roemis III O-6");
}
}
//prozentuale ansteuerung Roemisch IV
if (py>0 && px<=0){
if (py+px < 0) {
linksP = -100+py*w2;
rechtsP = py*w21-px;
//Serial.print("Roemis IV O-7");
}
if (py+px >= 0) {
linksP = 100+px*w2;
rechtsP = -px*w21+py;
//Serial.print("Roemis IV O-8");
}
}
Lesezeichen