Commit 8c54de4a authored by Thomas Gubler's avatar Thomas Gubler

Flightgear HIL working on Ubuntu

parent 56190d75
...@@ -230,9 +230,9 @@ void QGCFlightGearLink::readBytes() ...@@ -230,9 +230,9 @@ void QGCFlightGearLink::readBytes()
double airspeed; double airspeed;
time = values.at(0).toDouble(); time = values.at(0).toDouble();
lat = values.at(1).toDouble(); lat = values.at(1).toDouble() * 1e7;
lon = values.at(2).toDouble(); lon = values.at(2).toDouble() * 1e7;
alt = values.at(3).toDouble(); alt = values.at(3).toDouble() * 1e3;
roll = values.at(4).toDouble(); roll = values.at(4).toDouble();
pitch = values.at(5).toDouble(); pitch = values.at(5).toDouble();
yaw = values.at(6).toDouble(); yaw = values.at(6).toDouble();
...@@ -244,9 +244,9 @@ void QGCFlightGearLink::readBytes() ...@@ -244,9 +244,9 @@ void QGCFlightGearLink::readBytes()
yacc = values.at(11).toDouble(); yacc = values.at(11).toDouble();
zacc = values.at(12).toDouble(); zacc = values.at(12).toDouble();
vx = values.at(13).toDouble(); vx = values.at(13).toDouble() * 1e2;
vy = values.at(14).toDouble(); vy = values.at(14).toDouble() * 1e2;
vz = values.at(15).toDouble(); vz = values.at(15).toDouble() * 1e2;
airspeed = values.at(16).toDouble(); airspeed = values.at(16).toDouble();
...@@ -322,6 +322,8 @@ bool QGCFlightGearLink::disconnectSimulation() ...@@ -322,6 +322,8 @@ bool QGCFlightGearLink::disconnectSimulation()
**/ **/
bool QGCFlightGearLink::connectSimulation() bool QGCFlightGearLink::connectSimulation()
{ {
qDebug() << "STARTING FLIGHTGEAR LINK";
if (!mav) return false; if (!mav) return false;
socket = new QUdpSocket(this); socket = new QUdpSocket(this);
connectState = socket->bind(host, port); connectState = socket->bind(host, port);
...@@ -377,9 +379,9 @@ bool QGCFlightGearLink::connectSimulation() ...@@ -377,9 +379,9 @@ bool QGCFlightGearLink::connectSimulation()
#endif #endif
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
processFgfs = "fgfs"; processFgfs = "/usr/games/fgfs";
fgRoot = "/usr/share/flightgear/data"; fgRoot = "/usr/share/games/flightgear";
fgScenery = "/usr/share/flightgear/data/Scenery-Terrasync"; fgScenery = "/usr/share/games/flightgear/Scenery";
#endif #endif
// Sanity checks // Sanity checks
...@@ -451,7 +453,8 @@ bool QGCFlightGearLink::connectSimulation() ...@@ -451,7 +453,8 @@ bool QGCFlightGearLink::connectSimulation()
//processCall << "--disable-horizon-effect"; //processCall << "--disable-horizon-effect";
processCall << "--disable-clouds"; processCall << "--disable-clouds";
processCall << "--fdm=jsb"; processCall << "--fdm=jsb";
processCall << "--units-meters"; processCall << "--units-meters"; //XXX: check: the protocol xml has already a conversion from feet to m?
processCall << "--notrim";
if (mav->getSystemType() == MAV_TYPE_QUADROTOR) if (mav->getSystemType() == MAV_TYPE_QUADROTOR)
{ {
// Start all engines of the quad // Start all engines of the quad
......
...@@ -97,7 +97,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), ...@@ -97,7 +97,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
paramManager(NULL), paramManager(NULL),
attitudeStamped(false), attitudeStamped(false),
lastAttitude(0), lastAttitude(0),
simulation(new QGCXPlaneLink(this)), simulation(new QGCFlightGearLink(this)),
isLocalPositionKnown(false), isLocalPositionKnown(false),
isGlobalPositionKnown(false), isGlobalPositionKnown(false),
systemIsArmed(false), systemIsArmed(false),
......
...@@ -82,7 +82,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : ...@@ -82,7 +82,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
hilAction->setCheckable(true); hilAction->setCheckable(true);
// Flightgear is not ready for prime time // Flightgear is not ready for prime time
hilAction->setEnabled(false); //hilAction->setEnabled(false);
hilXAction->setCheckable(true); hilXAction->setCheckable(true);
m_ui->setupUi(this); m_ui->setupUi(this);
...@@ -503,6 +503,7 @@ void UASView::contextMenuEvent (QContextMenuEvent* event) ...@@ -503,6 +503,7 @@ void UASView::contextMenuEvent (QContextMenuEvent* event)
{ {
menu.addAction(removeAction); menu.addAction(removeAction);
} }
menu.addAction(hilAction);
menu.addAction(hilXAction); menu.addAction(hilXAction);
// XXX Re-enable later menu.addAction(hilXAction); // XXX Re-enable later menu.addAction(hilXAction);
menu.addAction(selectAirframeAction); menu.addAction(selectAirframeAction);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment