1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-27 16:54:15 +01:00

Merge branch 'pt/MapEnhancements' of ssh://git.openpilot.org/OpenPilot into pt/MapEnhancements

Conflicts:
	ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/uavitem.cpp
This commit is contained in:
PT_Dreamer 2012-08-18 20:01:32 +01:00
commit c6706ce6b2
21 changed files with 177 additions and 124 deletions

View File

@ -27,13 +27,14 @@
#include "homeitem.h"
namespace mapcontrol
{
HomeItem::HomeItem(MapGraphicItem* map,OPMapWidget* parent):safe(true),map(map),mapwidget(parent),showsafearea(true),safearea(1000),altitude(0),isDragging(false)
HomeItem::HomeItem(MapGraphicItem* map,OPMapWidget* parent):safe(true),map(map),mapwidget(parent),
showsafearea(true),toggleRefresh(true),safearea(1000),altitude(0),isDragging(false)
{
pic.load(QString::fromUtf8(":/markers/images/home2.svg"));
pic=pic.scaled(30,30,Qt::IgnoreAspectRatio);
this->setFlag(QGraphicsItem::ItemIgnoresTransformations,true);
this->setFlag(QGraphicsItem::ItemIsMovable,true);
this->setFlag(QGraphicsItem::ItemIsSelectable,true);
this->setFlag(QGraphicsItem::ItemIsMovable,false);
this->setFlag(QGraphicsItem::ItemIsSelectable,false);
localposition=map->FromLatLngToLocal(mapwidget->CurrentPosition());
this->setPos(localposition.X(),localposition.Y());
this->setZValue(4);
@ -70,7 +71,7 @@ namespace mapcontrol
}
QRectF HomeItem::boundingRect()const
{
if(pic.width()>localsafearea*2)
if(pic.width()>localsafearea*2 && !toggleRefresh)
return QRectF(-pic.width()/2,-pic.height()/2,pic.width(),pic.height());
else
return QRectF(-localsafearea,-localsafearea,localsafearea*2,localsafearea*2);
@ -92,6 +93,9 @@ namespace mapcontrol
RefreshToolTip();
this->update();
toggleRefresh=false;
}
void HomeItem::setOpacitySlot(qreal opacity)

View File

@ -49,6 +49,7 @@ namespace mapcontrol
int type() const;
bool ShowSafeArea()const{return showsafearea;}
void SetShowSafeArea(bool const& value){showsafearea=value;}
void SetToggleRefresh(bool const& value){toggleRefresh=value;}
int SafeArea()const{return safearea;}
void SetSafeArea(int const& value){safearea=value;}
bool safe;
@ -65,6 +66,7 @@ namespace mapcontrol
core::Point localposition;
internals::PointLatLng coord;
bool showsafearea;
bool toggleRefresh;
int safearea;
int localsafearea;
float altitude;

View File

@ -34,7 +34,7 @@ namespace mapcontrol
{
OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config):QGraphicsView(parent),configuration(config),UAV(0),GPS(0),Home(0)
,followmouse(true),compass(0),showuav(false),showhome(false),showDiag(false),diagGraphItem(0),diagTimer(0),overlayOpacity(1)
,followmouse(true),compass(0),showuav(false),showhome(false),diagTimer(0),diagGraphItem(0),showDiag(false),overlayOpacity(1)
{
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
core=new internals::Core;
@ -392,7 +392,7 @@ namespace mapcontrol
}
void OPMapWidget::WPDeleteAll()
{
int x=0;
// int x=0;
foreach(QGraphicsItem* i,map->childItems())
{
WayPointItem* w=qgraphicsitem_cast<WayPointItem*>(i);
@ -419,7 +419,9 @@ namespace mapcontrol
}
}
}
return false;
}
void OPMapWidget::deleteAllOverlays()
{
foreach(QGraphicsItem* i,map->childItems())

View File

@ -33,12 +33,13 @@ namespace mapcontrol
double UAVItem::groundspeed_mps_filt = 0;
UAVItem::UAVItem(MapGraphicItem* map,OPMapWidget* parent,QString uavPic):map(map),mapwidget(parent),showtrail(true),showtrailline(true),trailtime(5),traildistance(50),autosetreached(true)
,autosetdistance(100),altitude(0),showUAVInfo(false),showJustChanged(false)
UAVItem::UAVItem(MapGraphicItem* map,OPMapWidget* parent,QString uavPic):map(map),mapwidget(parent)
,altitude(0),showtrail(true),showtrailline(true),trailtime(5),traildistance(50),autosetreached(true)
,autosetdistance(100),showUAVInfo(false),showJustChanged(false),refreshPaint_flag(true)
{
pic.load(uavPic);
this->setFlag(QGraphicsItem::ItemIsMovable,true);
this->setFlag(QGraphicsItem::ItemIsSelectable,true);
this->setFlag(QGraphicsItem::ItemIsMovable,false);
this->setFlag(QGraphicsItem::ItemIsSelectable,false);
localposition=map->FromLatLngToLocal(mapwidget->CurrentPosition());
this->setPos(localposition.X(),localposition.Y());
this->setZValue(4);
@ -50,6 +51,8 @@ namespace mapcontrol
mapfollowtype=UAVMapFollowType::None;
trailtype=UAVTrailType::ByDistance;
timer.start();
generateArrowhead();
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
connect(map,SIGNAL(childRefreshPosition()),this,SLOT(RefreshPos()));
connect(map,SIGNAL(childSetOpacity(qreal)),this,SLOT(setOpacitySlot(qreal)));
@ -67,7 +70,7 @@ namespace mapcontrol
//Draw plane
painter->drawPixmap(-pic.width()/2,-pic.height()/2,pic);
//Return if context menu switch for UAV info is off
//Return if UAV Info context menu is turned off
if(!showUAVInfo){
showJustChanged=false;
return;
@ -78,40 +81,14 @@ namespace mapcontrol
//Turn on anti-aliasing so the fonts don't look terrible
painter->setRenderHint(QPainter::Antialiasing, true);
qreal arrowSize = 10;
//Set pen attributes
QColor myColor(Qt::red);
myPen.setWidth(3);
myPen.setColor(myColor);
painter->setPen(myPen);
//Create line from (0,0), to (1,1). Later, we'll scale and rotate it
QLineF line(0,0,1.0,1.0);
//Set the starting point to (0,0)
line.setP1(QPointF(0,0));
//Set angle and length
line.setLength(60.0);
line.setAngle(90.0);
//Form arrowhead
double angle = ::acos(line.dx() / line.length());
if (line.dy() <= 0)
angle = (M_PI * 2) - angle;
QPointF arrowP1 = line.pointAt(1) + QPointF(sin(angle + M_PI / 3) * arrowSize,
cos(angle + M_PI / 3) * arrowSize);
QPointF arrowP2 = line.pointAt(1) + QPointF(sin(angle + M_PI - M_PI / 3) * arrowSize,
cos(angle + M_PI - M_PI / 3) * arrowSize);
//Generate arrowhead
arrowHead.clear();
arrowHead << line.pointAt(1) << arrowP1 << arrowP2;
painter->drawPolygon(arrowHead);
painter->setPen(myPen);
painter->drawLine(line);
painter->drawLine(arrowShaft);
//*********** Create trend arc
double radius;
@ -149,9 +126,7 @@ namespace mapcontrol
//*********** Create time rings
double ringTime=10*pow(2,17-map->ZoomTotal()); //Basic ring is 10 seconds wide at zoom level 17
double alpha= .05;
groundspeed_mps_filt= (1-alpha)*groundspeed_mps_filt + alpha*groundspeed_mps;
if(groundspeed_mps > 0){ //Don't clutter the display with rings that are only one pixel wide
if(groundspeed_mps_filt > 0){ //Don't clutter the display with rings that are only one pixel wide
myPen.setWidth(2);
myPen.setColor(QColor(0, 0, 0, 100));
@ -169,56 +144,66 @@ namespace mapcontrol
//***** Text info overlay. The font is a "glow" font, so that it's easier to use on the map
if (refreshPaint_flag==true){
//Define font
QFont borderfont( "Arial", 14, QFont::Normal, false );
//Top left corner of text
int textAnchorX = 20;
int textAnchorY = 20;
//Create text lines
QString uavoInfoStrLine1, uavoInfoStrLine2;
QString uavoInfoStrLine3, uavoInfoStrLine4;
QString uavoInfoStrLine5;
//For whatever reason, Qt does not let QPainterPath have text wrapping. So each line of
//text has to be added to a different line.
uavoInfoStrLine1.append(QString("CAS: %1 kph").arg(CAS_mps));
uavoInfoStrLine2.append(QString("Groundspeed: %1 kph").arg(groundspeed_kph, 0, 'f',1));
uavoInfoStrLine3.append(QString("Lat-Lon: %1, %2").arg(coord.Lat(), 0, 'f',7).arg(coord.Lng(), 0, 'f',7));
uavoInfoStrLine4.append(QString("North-East: %1 m, %2 m").arg(NED[0], 0, 'f',1).arg(NED[1], 0, 'f',1));
uavoInfoStrLine5.append(QString("Altitude: %1 m").arg(-NED[2], 0, 'f',1));
//Add the uavo info text to the path
//NOTE: We must use QPainterPath for the outlined text font. QPaint does not support this.
path = QPainterPath();
path.addText(textAnchorX, textAnchorY+16*0, borderfont, uavoInfoStrLine1);
path.addText(textAnchorX, textAnchorY+16*1, borderfont, uavoInfoStrLine2);
path.addText(textAnchorX, textAnchorY+16*2, borderfont, uavoInfoStrLine3);
path.addText(textAnchorX, textAnchorY+16*3, borderfont, uavoInfoStrLine4);
path.addText(textAnchorX, textAnchorY+16*4, borderfont, uavoInfoStrLine5);
//Add text for time rings.
if(groundspeed_mps > 0){
//Always add the left side...
path.addText(-(groundspeed_mps_filt*ringTime*1*meters2pixels+10), 0, borderfont, QString("%1 s").arg(ringTime,0,'f',0));
path.addText(-(groundspeed_mps_filt*ringTime*2*meters2pixels+10), 0, borderfont, QString("%1 s").arg(ringTime*2,0,'f',0));
path.addText(-(groundspeed_mps_filt*ringTime*4*meters2pixels+10), 0, borderfont, QString("%1 s").arg(ringTime*4,0,'f',0));
//... and add the right side, only if it doesn't interfere with the uav info text
if(groundspeed_mps_filt*ringTime*4*meters2pixels > 200){
if(groundspeed_mps_filt*ringTime*2*meters2pixels > 200){
if(groundspeed_mps_filt*ringTime*1*meters2pixels > 200){
path.addText(groundspeed_mps_filt*ringTime*1*meters2pixels-8, 0, borderfont, QString("%1 s").arg(ringTime,0,'f',0));
}
path.addText(groundspeed_mps_filt*ringTime*2*meters2pixels-8, 0, borderfont, QString("%1 s").arg(ringTime*2,0,'f',0));
}
path.addText(groundspeed_mps_filt*ringTime*4*meters2pixels-8, 0, borderfont, QString("%1 s").arg(ringTime*4,0,'f',0));
}
}
//Last thing to do: set bound rectangle as function of largest object
boundingRectSize=groundspeed_mps_filt*ringTime*4*meters2pixels+20; //Largest object is currently the biggest ring + a little bit of margin for the text
refreshPaint_flag=false;
}
//Rotate the text back to vertical
qreal rot=this->rotation();
painter->rotate(-1*rot);
//Define font
QFont borderfont( "Arial", 14, QFont::Normal, false );
//Top left corner of text
int textAnchorX = 20;
int textAnchorY = 20;
//Create text lines
QString uavoInfoStrLine1, uavoInfoStrLine2;
QString uavoInfoStrLine3, uavoInfoStrLine4;
QString uavoInfoStrLine5;
//For whatever reason, Qt does not let QPainterPath have text wrapping. So each line of
//text has to be added to a different line.
uavoInfoStrLine1.append(QString("CAS: %1 kph").arg(CAS_mps));
uavoInfoStrLine2.append(QString("Groundspeed: %1 kph").arg(groundspeed_kph, 0, 'f',1));
uavoInfoStrLine3.append(QString("Lat-Lon: %1, %2").arg(coord.Lat(), 0, 'f',7).arg(coord.Lng(), 0, 'f',7));
uavoInfoStrLine4.append(QString("North-East: %1 m, %2 m").arg(NED[0], 0, 'f',1).arg(NED[1], 0, 'f',1));
uavoInfoStrLine5.append(QString("Altitude: %1 m").arg(-NED[2], 0, 'f',1));
//Add the uavo info text to the path
//NOTE: We must use QPainterPath for the outlined text font. QPaint does not support this.
QPainterPath path;
path.addText(textAnchorX, textAnchorY+16*0, borderfont, uavoInfoStrLine1);
path.addText(textAnchorX, textAnchorY+16*1, borderfont, uavoInfoStrLine2);
path.addText(textAnchorX, textAnchorY+16*2, borderfont, uavoInfoStrLine3);
path.addText(textAnchorX, textAnchorY+16*3, borderfont, uavoInfoStrLine4);
path.addText(textAnchorX, textAnchorY+16*4, borderfont, uavoInfoStrLine5);
//Add text for time rings.
if(groundspeed_mps > 0){
//Always add the left side...
path.addText(-(groundspeed_mps_filt*ringTime*1*meters2pixels+10), 0, borderfont, QString("%1 s").arg(ringTime,0,'f',0));
path.addText(-(groundspeed_mps_filt*ringTime*2*meters2pixels+10), 0, borderfont, QString("%1 s").arg(ringTime*2,0,'f',0));
path.addText(-(groundspeed_mps_filt*ringTime*4*meters2pixels+10), 0, borderfont, QString("%1 s").arg(ringTime*4,0,'f',0));
//... and add the right side, only if it doesn't interfere with the uav info text
if(groundspeed_mps_filt*ringTime*4*meters2pixels > 200){
if(groundspeed_mps_filt*ringTime*2*meters2pixels > 200){
if(groundspeed_mps_filt*ringTime*1*meters2pixels > 200){
path.addText(groundspeed_mps_filt*ringTime*1*meters2pixels-8, 0, borderfont, QString("%1 s").arg(ringTime,0,'f',0));
}
path.addText(groundspeed_mps_filt*ringTime*2*meters2pixels-8, 0, borderfont, QString("%1 s").arg(ringTime*2,0,'f',0));
}
path.addText(groundspeed_mps_filt*ringTime*4*meters2pixels-8, 0, borderfont, QString("%1 s").arg(ringTime*4,0,'f',0));
}
}
//Now draw the text. First pass is the outline...
myPen.setWidth(4);
@ -234,10 +219,6 @@ namespace mapcontrol
painter->setPen(myPen);
painter->drawPath(path);
//Last thing to do: set bound rectangle as function of largest object
prepareGeometryChange();
boundingRectSize=groundspeed_mps_filt*ringTime*4*meters2pixels+20; //Largest object is currently the biggest ring + a little bit of margin for the text
}
QRectF UAVItem::boundingRect()const
@ -260,6 +241,8 @@ namespace mapcontrol
this->NED[0] = NED[0];
this->NED[1] = NED[1];
this->NED[2] = NED[2];
refreshPaint_flag=true;
}
void UAVItem::SetYawRate(double yawRate_dps){
@ -272,17 +255,35 @@ namespace mapcontrol
this->yawRate_dps=5e-1;
}
refreshPaint_flag=true;
}
void UAVItem::SetCAS(double CAS_mps){
this->CAS_mps=CAS_mps;
refreshPaint_flag=true;
}
void UAVItem::SetGroundspeed(double vNED[3]){
void UAVItem::SetGroundspeed(double vNED[3], int m_maxUpdateRate_ms){
this->vNED[0] = vNED[0];
this->vNED[1] = vNED[1];
this->vNED[2] = vNED[2];
groundspeed_kph=sqrt(vNED[0]*vNED[0] + vNED[1]*vNED[1] + vNED[2]*vNED[2])*3.6;
//On the first pass, set the filtered speed to the reported speed.
static bool firstGroundspeed=true;
if (firstGroundspeed){
groundspeed_mps_filt=groundspeed_kph/3.6;
firstGroundspeed=false;
}
else{
int riseTime_ms=1000;
double alpha= m_maxUpdateRate_ms/(double)(m_maxUpdateRate_ms+riseTime_ms);
groundspeed_mps_filt= alpha*groundspeed_mps_filt + (1-alpha)*(groundspeed_kph/3.6);
}
refreshPaint_flag=true;
}
@ -362,6 +363,8 @@ namespace mapcontrol
}
}
refreshPaint_flag=true;
}
/**
@ -378,6 +381,8 @@ namespace mapcontrol
if (this->rotation() != value)
this->setRotation(value);
}
refreshPaint_flag=true;
}
@ -404,6 +409,7 @@ namespace mapcontrol
ww->setLine(map->FromLatLngToLocal(ww->coord1).X(),map->FromLatLngToLocal(ww->coord1).Y(),map->FromLatLngToLocal(ww->coord2).X(),map->FromLatLngToLocal(ww->coord2).Y());
}
refreshPaint_flag=true;
}
void UAVItem::setOpacitySlot(qreal opacity)
@ -451,4 +457,32 @@ namespace mapcontrol
update();
}
void UAVItem::generateArrowhead(){
qreal arrowSize = 10;
//Create line from (0,0), to (1,1). Later, we'll scale and rotate it
arrowShaft=QLineF(0,0,1.0,1.0);
//Set the starting point to (0,0)
arrowShaft.setP1(QPointF(0,0));
//Set angle and length
arrowShaft.setLength(60.0);
arrowShaft.setAngle(90.0);
//Form arrowhead
double angle = ::acos(arrowShaft.dx() / arrowShaft.length());
if (arrowShaft.dy() <= 0)
angle = (M_PI * 2) - angle;
QPointF arrowP1 = arrowShaft.pointAt(1) + QPointF(sin(angle + M_PI / 3) * arrowSize,
cos(angle + M_PI / 3) * arrowSize);
QPointF arrowP2 = arrowShaft.pointAt(1) + QPointF(sin(angle + M_PI - M_PI / 3) * arrowSize,
cos(angle + M_PI - M_PI / 3) * arrowSize);
//Assemble arrowhead
arrowHead.clear();
arrowHead << arrowShaft.pointAt(1) << arrowP1 << arrowP2;
}
}

View File

@ -69,7 +69,7 @@ namespace mapcontrol
*
* @param NED
*/
void SetGroundspeed(double vNED[3]);
void SetGroundspeed(double vNED[3], int m_maxUpdateRate);
/**
* @brief Sets the UAV Calibrated Airspeed
*
@ -220,8 +220,12 @@ namespace mapcontrol
void SetShowUAVInfo(bool const& value);
private:
void generateArrowhead();
MapGraphicItem* map;
OPMapWidget* mapwidget;
QPolygonF arrowHead;
QLineF arrowShaft;
int altitude;
UAVMapFollowType::Types mapfollowtype;
UAVTrailType::Types trailtype;
@ -234,7 +238,6 @@ namespace mapcontrol
double yawRate_dps;
QPixmap pic;
core::Point localposition;
OPMapWidget* mapwidget;
QGraphicsItemGroup* trail;
QGraphicsItemGroup * trailLine;
internals::PointLatLng lasttrailline;
@ -251,6 +254,11 @@ namespace mapcontrol
float boundingRectSize;
bool showJustChanged;
bool refreshPaint_flag;
QPainterPath path;
public slots:
void RefreshPos();
void setOpacitySlot(qreal opacity);

View File

@ -299,7 +299,7 @@ bool ConfigFixedWingWidget::setupFrameFixedWing(QString airframeType)
int channel;
//disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
for (channel=0; (unsigned int) channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
{
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
@ -386,7 +386,7 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
int channel;
double value;
//disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
for (channel=0; (unsigned int) channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
{
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
@ -471,7 +471,7 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType)
int channel;
double value;
//disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
for (channel=0; (unsigned int) channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
{
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);

View File

@ -239,7 +239,7 @@ QString ConfigGroundVehicleWidget::updateConfigObjectsFromWidgets()
void ConfigGroundVehicleWidget::refreshWidgetsValues(QString frameType)
{
UAVDataObject* obj;
UAVObjectField *field;
// UAVObjectField *field;
GUIConfigDataUnion config = GetConfigData();
@ -314,7 +314,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleMotorcycle(QString airframeTyp
int channel;
//disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) {
for (channel=0; (unsigned int) channel<VehicleConfig::CHANNEL_NUMELEM; channel++) {
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}
@ -376,7 +376,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleDifferential(QString airframeT
int channel;
//disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) {
for (channel=0; (unsigned int) channel<VehicleConfig::CHANNEL_NUMELEM; channel++) {
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}
@ -438,7 +438,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleCar(QString airframeType)
int channel;
//disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) {
for (channel=0; (unsigned int) channel<VehicleConfig::CHANNEL_NUMELEM; channel++) {
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);
}

View File

@ -1041,7 +1041,7 @@ bool ConfigMultiRotorWidget::setupMultiRotorMixer(double mixerFactors[8][3])
Q_ASSERT(mixer);
//disable all
for (int channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
for (unsigned int channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
{
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel);

View File

@ -231,7 +231,7 @@ void ConfigOutputWidget::refreshWidgetsValues(UAVObject * obj)
{
Q_UNUSED(obj);
bool dirty=isDirty();
// bool dirty=isDirty();
// Get Actuator Settings
ActuatorSettings *actuatorSettings = ActuatorSettings::GetInstance(getObjectManager());

View File

@ -68,8 +68,8 @@ public:
ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
ConfigTaskWidget(parent),
collectingData(false),
position(-1),
m_ui(new Ui_RevoSensorsWidget())
m_ui(new Ui_RevoSensorsWidget()),
position(-1)
{
m_ui->setupUi(this);

View File

@ -109,7 +109,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
//Generate lists of mixerTypeNames, mixerVectorNames, channelNames
channelNames << "None";
for (int i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) {
for (unsigned int i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) {
mixerTypes << QString("Mixer%1Type").arg(i+1);
mixerVectors << QString("Mixer%1Vector").arg(i+1);

View File

@ -117,7 +117,7 @@ void TelemetryParser::updateSats( UAVObject* object1) {
UAVObjectField* azimuth = object1->getField(QString("Azimuth"));
UAVObjectField* snr = object1->getField(QString("SNR"));
for (int i=0;i< prn->getNumElements();i++) {
for (unsigned int i=0;i< prn->getNumElements();i++) {
emit satellite(i,prn->getValue(i).toInt(),elevation->getValue(i).toInt(),
azimuth->getValue(i).toInt(), snr->getValue(i).toInt());
}

View File

@ -73,7 +73,7 @@ void IPConnection::onOpenDevice(QString HostName, int Port, bool UseTCP)
{
QAbstractSocket *ipSocket;
const int Timeout = 5 * 1000;
int state;
// int state;
ipConMutex.lock();
if (UseTCP) {

View File

@ -169,6 +169,7 @@ bool flightDataModel::setColumnByIndex(pathPlanData *row,const int index,const
default:
return false;
}
return false;
}
QVariant flightDataModel::getColumnByIndex(const pathPlanData *row,const int index) const
{

View File

@ -104,7 +104,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_map_mode = Normal_MapMode;
m_maxUpdateRate = max_update_rate_list[4]; // 2 seconds
m_maxUpdateRate = max_update_rate_list[4]; // 2 seconds //SHOULDN'T THIS BE LOADED FROM THE USER PREFERENCES?
m_telemetry_connected = false;
@ -166,8 +166,9 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_map->SetShowHome(true); // display the HOME position on the map
m_map->SetShowUAV(true); // display the UAV position on the map
m_map->Home->SetSafeArea(safe_area_radius_list[0]); // set radius (meters)
m_map->Home->SetShowSafeArea(true); // show the safe area
m_map->Home->SetSafeArea(safe_area_radius_list[0]); // set radius (meters) //SHOULDN'T THE DEFAULT BE USER DEFINED?
m_map->Home->SetShowSafeArea(true); // show the safe area //SHOULDN'T THE DEFAULT BE USER DEFINED?
m_map->Home->SetToggleRefresh(true);
if(m_map->Home)
connect(m_map->Home,SIGNAL(homedoubleclick(HomeItem*)),this,SLOT(onHomeDoubleClick(HomeItem*)));
@ -540,8 +541,8 @@ void OPMapGadgetWidget::closeEvent(QCloseEvent *event)
// timer signals
/**
Updates the UAV position on the map. It is called every 200ms
by a timer.
Updates the UAV position on the map. It is called at a user-defined frequency,
as set inside the map widget.
*/
void OPMapGadgetWidget::updatePosition()
{
@ -604,7 +605,7 @@ void OPMapGadgetWidget::updatePosition()
//Set the position and heading estimates in the painter module
m_map->UAV->SetNED(NED);
m_map->UAV->SetCAS(-1); //THIS NEEDS TO BECOME AIRSPEED, ONCE WE SETTLE ON A UAVO
m_map->UAV->SetGroundspeed(vNED);
m_map->UAV->SetGroundspeed(vNED, m_maxUpdateRate);
//Convert angular velocities into a rotationg rate around the world-frame yaw axis. This is found by simply taking the dot product of the angular Euler-rate matrix with the angular rates.
float psiRate_dps=0*gyrosData.z + sin(attitudeActualData.Roll*deg_to_rad)/cos(attitudeActualData.Pitch*deg_to_rad)*gyrosData.y + cos(attitudeActualData.Roll*deg_to_rad)/cos(attitudeActualData.Pitch*deg_to_rad)*gyrosData.z;
@ -1771,7 +1772,7 @@ void OPMapGadgetWidget::onAddWayPointAct_triggered(internals::PointLatLng coord)
if (m_map_mode != Normal_MapMode)
return;
float alt=15;
mapProxy->createWayPoint(coord);
}
@ -1875,6 +1876,7 @@ void OPMapGadgetWidget::onShowSafeAreaAct_toggled(bool show)
return;
m_map->Home->SetShowSafeArea(show); // show the safe area
m_map->Home->SetToggleRefresh(true);
m_map->Home->RefreshPos();
}

View File

@ -315,7 +315,7 @@ int pjrc_rawhid::send(int num, void *buf, int len, int timeout)
QString pjrc_rawhid::getserial(int num) {
hid_t *hid;
char buf[128];
// char buf[128];
hid = get_hid(num);

View File

@ -45,8 +45,8 @@ static bool HID_GetStrProperty(IOHIDDeviceRef dev, CFStringRef property, QString
*/
USBMonitor::USBMonitor(QObject *parent): QThread(parent) {
hid_manager=NULL;
CFMutableDictionaryRef dict;
CFNumberRef num;
// CFMutableDictionaryRef dict;
// CFNumberRef num;
IOReturn ret;
m_instance = this;
@ -131,7 +131,7 @@ void USBMonitor::attach_callback(void *context, IOReturn r, void *hid_mgr, IOHID
{
bool got_properties = true;
CFTypeRef prop;
// CFTypeRef prop;
USBPortInfo deviceInfo;
deviceInfo.dev_handle = dev;

View File

@ -276,7 +276,7 @@ QByteArray UAVObjectUtilManager::getBoardCPUSerial()
QByteArray cpuSerial;
FirmwareIAPObj::DataFields firmwareIapData = getFirmwareIap();
for (int i = 0; i < FirmwareIAPObj::CPUSERIAL_NUMELEM; i++)
for (unsigned int i = 0; i < FirmwareIAPObj::CPUSERIAL_NUMELEM; i++)
cpuSerial.append(firmwareIapData.CPUSerial[i]);
return cpuSerial;
@ -296,7 +296,7 @@ QByteArray UAVObjectUtilManager::getBoardDescription()
QByteArray ret;
FirmwareIAPObj::DataFields firmwareIapData = getFirmwareIap();
for (int i = 0; i < FirmwareIAPObj::DESCRIPTION_NUMELEM; i++)
for (unsigned int i = 0; i < FirmwareIAPObj::DESCRIPTION_NUMELEM; i++)
ret.append(firmwareIapData.Description[i]);
return ret;

View File

@ -32,7 +32,7 @@
/**
* Constructor
*/
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnected(false),smartsave(NULL),dirty(false),outOfLimitsStyle("background-color: rgb(255, 0, 0);"),timeOut(NULL),allowWidgetUpdates(true)
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnected(false),allowWidgetUpdates(true),smartsave(NULL),dirty(false),outOfLimitsStyle("background-color: rgb(255, 0, 0);"),timeOut(NULL)
{
pm = ExtensionSystem::PluginManager::instance();
objManager = pm->getObject<UAVObjectManager>();

View File

@ -449,7 +449,7 @@ bool UAVTalk::processInputByte(quint8 rxbyte)
default:
rxState = STATE_SYNC;
stats.rxErrors++;
UAVTALK_QXTLOG_DEBUG("UAVTalk: ???->Sync");
UAVTALK_QXTLOG_DEBUG("UAVTalk: \?\?\?->Sync"); //Use the escape character for '?' so that the tripgraph isn't triggered.
}
// Done

View File

@ -43,7 +43,7 @@ public:
uint8_t maxRetryCount; // max. times to try to transmit the 'send' packet
uint16_t max_retry; // Maximum number of retrys for a single transmit.
int32_t timeoutLen; // how long to wait for each retry to succeed
int32_t timeout; // current timeout. when 'time' reaches this point we have timed out
uint32_t timeout; // current timeout. when 'time' reaches this point we have timed out
uint8_t txSeqNo; // current 'send' packet sequence number
uint16_t rxBufPos; // current buffer position in the receive packet
uint16_t rxBufLen; // number of 'data' bytes in the buffer