1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Ground: Modified GCS control gadget to actually take over the manual control object and also swapped the signs of the axis as well as bounding the range.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1326 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2010-08-18 15:24:47 +00:00 committed by peabody124
parent cfd20922cd
commit 5e7dff0481
2 changed files with 9 additions and 4 deletions

View File

@ -85,6 +85,10 @@ void GCSControlGadgetWidget::gcsControlToggle(int state)
{
mdata.flightAccess = UAVObject::ACCESS_READWRITE;
}
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
mdata.gcsTelemetryAcked = false;
mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
mdata.gcsTelemetryUpdatePeriod = 100;
getMCC()->setMetadata(mdata);
}

View File

@ -90,14 +90,14 @@ void JoystickControl::mccChanged(UAVObject*)
{
ManualControlCommand::DataFields data = getMCC()->getData();
double x = (data.Yaw + 1) / 2 * scene()->sceneRect().width();
double y = (data.Pitch + 1) / 2 * scene()->sceneRect().height();
double y = (-data.Pitch + 1) / 2 * scene()->sceneRect().height();
m_joystickEnd->setPos(x-m_joystickEnd->boundingRect().width()/2,y-m_joystickEnd->boundingRect().height()/2);
}
else if( this->objectName() == QString("widgetRightStick"))
{
ManualControlCommand::DataFields data = getMCC()->getData();
double x = (data.Roll + 1) / 2 * scene()->sceneRect().width();
double y = (data.Throttle + 1) / 2 * scene()->sceneRect().height();
double y = (-data.Throttle + 1) / 2 * scene()->sceneRect().height();
m_joystickEnd->setPos(x-m_joystickEnd->boundingRect().width()/2,y-m_joystickEnd->boundingRect().height()/2);
}
@ -161,8 +161,9 @@ void JoystickControl::updateMCC(QPointF point)
QRectF sceneSize = scene()->sceneRect();
double x = 2 * ( point.x() / sceneSize.width() - .5 );
double y = 2 * ( point.y() / sceneSize.height() - .5);
double y = -2 * ( point.y() / sceneSize.height() - .5);
x = qBound( (double) -1, x, (double) 1);
y = qBound( (double) -1, y, (double) 1);
if( this->objectName() == QString("widgetLeftStick"))
{