mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
GCS Control gadget: invert the sign of pitch which was wrong. Bounding of values to -1/+1 so that it is not possible to put the red dots outside of the picture...
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2261 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
d8edab8371
commit
790637ba00
@ -96,19 +96,19 @@ void GCSControlGadget::manualControlCommandUpdated(UAVObject * obj) {
|
||||
switch (controlsMode) {
|
||||
case 1:
|
||||
// Mode 1: LeftX = Yaw, LeftY = Pitch, RightX = Roll, RightY = Throttle
|
||||
emit sticksChangedRemotely(yaw,pitch,roll,throttle);
|
||||
emit sticksChangedRemotely(yaw,-pitch,roll,throttle);
|
||||
break;
|
||||
case 2:
|
||||
// Mode 2: LeftX = Yaw, LeftY = Throttle, RightX = Roll, RightY = Pitch
|
||||
emit sticksChangedRemotely(yaw,throttle,roll,pitch);
|
||||
emit sticksChangedRemotely(yaw,throttle,roll,-pitch);
|
||||
break;
|
||||
case 3:
|
||||
// Mode 3: LeftX = Roll, LeftY = Pitch, RightX = Yaw, RightY = Throttle
|
||||
emit sticksChangedRemotely(roll,pitch,yaw,throttle);
|
||||
emit sticksChangedRemotely(roll,-pitch,yaw,throttle);
|
||||
break;
|
||||
case 4:
|
||||
// Mode 4: LeftX = Roll, LeftY = Throttle, RightX = Yaw, RightY = Pitch;
|
||||
emit sticksChangedRemotely(roll,throttle,yaw,pitch);
|
||||
emit sticksChangedRemotely(roll,throttle,yaw,-pitch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -133,28 +133,28 @@ void GCSControlGadget::sticksChangedLocally(double leftX, double leftY, double r
|
||||
case 1:
|
||||
// Mode 1: LeftX = Yaw, LeftY = Pitch, RightX = Roll, RightY = Throttle
|
||||
newRoll = rightX;
|
||||
newPitch = leftY;
|
||||
newPitch = -leftY;
|
||||
newYaw = leftX;
|
||||
newThrottle = rightY;
|
||||
break;
|
||||
case 2:
|
||||
// Mode 2: LeftX = Yaw, LeftY = Throttle, RightX = Roll, RightY = Pitch
|
||||
newRoll = rightX;
|
||||
newPitch = rightY;
|
||||
newPitch = -rightY;
|
||||
newYaw = leftX;
|
||||
newThrottle = leftY;
|
||||
break;
|
||||
case 3:
|
||||
// Mode 3: LeftX = Roll, LeftY = Pitch, RightX = Yaw, RightY = Throttle
|
||||
newRoll = leftX;
|
||||
newPitch = leftY;
|
||||
newPitch = -leftY;
|
||||
newYaw = rightX;
|
||||
newThrottle = rightY;
|
||||
break;
|
||||
case 4:
|
||||
// Mode 4: LeftX = Roll, LeftY = Throttle, RightX = Yaw, RightY = Pitch;
|
||||
newRoll = leftX;
|
||||
newPitch = rightY;
|
||||
newPitch = -rightY;
|
||||
newYaw = rightX;
|
||||
newThrottle = leftY;
|
||||
break;
|
||||
|
@ -95,6 +95,11 @@ void JoystickControl::mouseMoveEvent(QMouseEvent *event)
|
||||
|
||||
double Y = - (point.y() / sceneSize.height() - .5) * 2;
|
||||
double X = (point.x() / sceneSize.width() - .5) * 2;
|
||||
if (Y<-1) Y = -1;
|
||||
if (Y> 1) Y = 1;
|
||||
if (X<-1) X = -1;
|
||||
if (X> 1) X = 1;
|
||||
|
||||
emit positionClicked(X, Y);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user