Commit 870ad6de authored by Mariano Lizarraga's avatar Mariano Lizarraga

First semi-usable version with new menu layout based on autopilot. Still very...

First semi-usable version with new menu layout based on autopilot. Still very experimental. Current Bug: Linecharts do not work. Need to find out why
parent 8591b855
......@@ -162,10 +162,6 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
uas = new UAS(this, message.sysid);
// Set the autopilot type
uas->setAutopilotType((int)heartbeat.autopilot);
// Connect this robot to the UAS object
connect(this, SIGNAL(messageReceived(LinkInterface*, mavlink_message_t)), uas, SLOT(receiveMessage(LinkInterface*, mavlink_message_t)));
break;
......@@ -173,10 +169,6 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
{
// Fixme differentiate between quadrotor and coaxial here
PxQuadMAV* mav = new PxQuadMAV(this, message.sysid);
// Set the autopilot type
//mav->setAutopilotType((int)heartbeat.autopilot);
// Connect this robot to the UAS object
// it is IMPORTANT here to use the right object type,
// else the slot of the parent object is called (and thus the special
......@@ -188,10 +180,6 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
case MAV_AUTOPILOT_SLUGS:
{
SlugsMAV* mav = new SlugsMAV(this, message.sysid);
// Set the autopilot type
mav->setAutopilotType((int)heartbeat.autopilot);
// Connect this robot to the UAS object
// it is IMPORTANT here to use the right object type,
// else the slot of the parent object is called (and thus the special
......@@ -203,10 +191,6 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
case MAV_AUTOPILOT_ARDUPILOTMEGA:
{
ArduPilotMegaMAV* mav = new ArduPilotMegaMAV(this, message.sysid);
// Set the autopilot type
mav->setAutopilotType((int)heartbeat.autopilot);
// Connect this robot to the UAS object
// it is IMPORTANT here to use the right object type,
// else the slot of the parent object is called (and thus the special
......@@ -229,12 +213,6 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
// Now add UAS to "official" list, which makes the whole application aware of it
UASManager::instance()->addUAS(uas);
qDebug() << "++===============================";
qDebug() << uas->getAutopilotType();
qDebug() << "++===============================";
}
// Only count message if UAS exists for this message
......
......@@ -837,9 +837,9 @@ void MAVLinkSimulationLink::writeBytes(const char* data, qint64 size)
}
unsigned char v=data[i];
fprintf(stderr,"%02x ", v);
//fprintf(stderr,"%02x ", v);
}
fprintf(stderr,"\n");
//fprintf(stderr,"\n");
readyBufferMutex.lock();
for (int i = 0; i < streampointer; i++)
......
......@@ -170,7 +170,7 @@ void SerialLink::writeBytes(const char* data, qint64 size)
{
unsigned char v=data[i];
fprintf(stderr,"%02x ", v);
//fprintf(stderr,"%02x ", v);
}
}
}
......
This diff is collapsed.
......@@ -119,20 +119,9 @@ public slots:
void loadEngineerView();
/** @brief Load view for operator */
void loadOperatorView();
/** @brief Load 3D view */
void load3DView();
/** @brief Load 3D Google Earth view */
void loadGoogleEarthView();
/** @brief Load 3D map view */
void load3DMapView();
/** @brief Load view with all widgets */
void loadAllView();
/** @brief Load MAVLink XML generator view */
void loadMAVLinkView();
/** @brief Load data view, allowing to plot flight data */
void loadDataView();
/** @brief Load data view, allowing to plot flight data */
void loadDataView(QString fileName);
/** @brief Show the online help for users */
void showHelp();
/** @brief Show the authors / credits */
......@@ -140,22 +129,63 @@ public slots:
/** @brief Show the project roadmap */
void showRoadMap();
// Fixme find a nicer solution that scales to more AP types
void loadSlugsView();
void loadPixhawkEngineerView();
void loadSlugsEngineerView();
/** @brief Shows the widgets based on configuration and current view and autopilot */
void presentView();
/** @brief Reload the CSS style sheet */
void reloadStylesheet();
/*
==========================================================
Potentially Deprecated
==========================================================
*/
void loadPixhawkEngineerView();
/** @brief Load view with all widgets */
void loadAllView();
void loadWidgets();
/** @brief Load data view, allowing to plot flight data */
void loadDataView();
/** @brief Load data view, allowing to plot flight data */
void loadDataView(QString fileName);
/** @brief Load 3D map view */
void load3DMapView();
/** @brief Load 3D Google Earth view */
void loadGoogleEarthView();
/** @brief Load 3D view */
void load3DView();
/**
* @brief Shows a Docked Widget based on the action sender
*
* This slot is written to be used in conjunction with the addToToolsMenu function
* It shows the QDockedWidget based on the action sender
*
*/
void showToolWidget();
/**
* @brief Shows a Widget from the center stack based on the action sender
*
* This slot is written to be used in conjunction with the addToCentralWidgetsMenu function
* It shows the Widget based on the action sender
*
*/
void showCentralWidget();
/** @brief Updates a QDockWidget's checked status based on its visibility */
void updateVisibilitySettings (bool vis);
/** @brief Updates a QDockWidget's location */
void updateLocationSettings (Qt::DockWidgetArea location);
protected:
// These defines are used to save the settings when selecting with
......@@ -182,15 +212,17 @@ protected:
MENU_SLUGS_PID,
MENU_SLUGS_HIL,
MENU_SLUGS_CAMERA,
CENTRAL_LINECHART = 255, // do not change
CENTRAL_SEPARATOR= 255, // do not change
CENTRAL_LINECHART,
CENTRAL_PROTOCOL,
CENTRAL_MAP,
CENTRAL_3D_LOCAL,
CENTRAL_3D_MAP,
CENTRAL_OSGEARTH,
CENTRAL_GOOGLE_EARTH,
CENTRAL_HUD,
CENTRAL_DATA_PLOT,
CENTRAL_SEPARATOR,
}TOOLS_WIDGET_NAMES;
typedef enum _SETTINGS_SECTIONS {
......@@ -211,19 +243,65 @@ protected:
QHash<int, QWidget*> dockWidgets; // Holds ptr to the Actual Dock widget
QHash<int, Qt::DockWidgetArea> dockWidgetLocations; // Holds the location
/**
* @brief Adds an already instantiated QDockedWidget to the Tools Menu
*
* This function does all the hosekeeping to have a QDockedWidget added to the
* tools menu and connects the QMenuAction to a slot that shows the widget and
* checks/unchecks the tools menu item
*
* @param widget The QDockedWidget being added
* @param title The entry that will appear in the Menu and in the QDockedWidget title bar
* @param slotName The slot to which the triggered() signal of the menu action will be connected.
* @param tool The ENUM defined in MainWindow.h that is associated to the widget
* @param location The default location for the QDockedWidget in case there is no previous key in the settings
*/
void addToToolsMenu (QWidget* widget, const QString title, const char * slotName, TOOLS_WIDGET_NAMES tool, Qt::DockWidgetArea location);
/**
* @brief Determines if a QDockWidget needs to be show and if so, shows it
*
* Based on the the autopilot and the current view it queries the settings and shows the
* widget if necessary
*
* @param widget The QDockWidget requested to be shown
* @param view The view for which the QDockWidget is requested
*/
void showTheWidget (TOOLS_WIDGET_NAMES widget, VIEW_SECTIONS view = VIEW_MAVLINK);
void showCentralWidget (TOOLS_WIDGET_NAMES centralWidget, VIEW_SECTIONS view);
/**
* @brief Adds an already instantiated QWidget to the center stack
*
* This function does all the hosekeeping to have a QWidget added to the tools menu
* tools menu and connects the QMenuAction to a slot that shows the widget and
* checks/unchecks the tools menu item. This is used for all the central widgets (those in
* the center stack.
*
* @param widget The QWidget being added
* @param title The entry that will appear in the Menu
* @param slotName The slot to which the triggered() signal of the menu action will be connected.
* @param centralWidget The ENUM defined in MainWindow.h that is associated to the widget
*/
void addToCentralWidgetsMenu ( QWidget* widget, const QString title,const char * slotName, TOOLS_WIDGET_NAMES centralWidget);
/**
* @brief Determines if a QWidget needs to be show and if so, shows it
*
* Based on the the autopilot and the current view it queries the settings and shows the
* widget if necessary
*
* @param centralWidget The QWidget requested to be shown
* @param view The view for which the QWidget is requested
*/
void showTheCentralWidget (TOOLS_WIDGET_NAMES centralWidget, VIEW_SECTIONS view);
/** @brief Keeps track of the current view */
VIEW_SECTIONS currentView;
int aboutToQuit;
//QHash<int, QString> settingsSections;
QStatusBar* statusBar;
QStatusBar* createStatusBar();
void loadWidgets();
void clearView();
......
......@@ -562,6 +562,7 @@ void MapWidget::updateGlobalPosition(UASInterface* uas, double lat, double lon,
// Icon
QPen* pointpen = new QPen(uasColor);
qDebug() << uas->getUASName();
MAV2DIcon* p = new MAV2DIcon(lat, lon, 20, uas->getUASName(), qmapcontrol::Point::Middle, pointpen);
uasIcons.insert(uas->getUASID(), p);
geomLayer->addGeometry(p);
......
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