Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Definition of Unmanned Aerial Vehicle object
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*/
#ifndef _UAS_H_
#define _UAS_H_
#include "UASInterface.h"
#include <MAVLinkProtocol.h>
#include <QVector3D>
#include "QGCMAVLink.h"
#include "QGCHilLink.h"
#include "QGCFlightGearLink.h"
Lorenz Meier
committed
#include "QGCJSBSimLink.h"
#include "QGCXPlaneLink.h"
#include "QGCUASParamManager.h"
/**
* @brief A generic MAVLINK-connected MAV/UAV
*
* This class represents one vehicle. It can be used like the real vehicle, e.g. a call to halt()
* will automatically send the appropriate messages to the vehicle. The vehicle state will also be
* automatically updated by the comm architecture, so when writing code to e.g. control the vehicle
* no knowledge of the communication infrastructure is needed.
*/
class UAS : public UASInterface
{
Q_OBJECT
public:
UAS(MAVLinkProtocol* protocol, int id = 0);
~UAS();
float lipoFull; ///< 100% charged voltage
float lipoEmpty; ///< Discharged voltage
/* MANAGEMENT */
/** @brief The name of the robot */
QString getUASName(void) const;
/** @brief Get short state */
const QString& getShortState() const;
/** @brief Get short mode */
const QString& getShortMode() const;
/** @brief Translate from mode id to text */
static QString getShortModeTextFor(uint8_t base_mode, uint32_t custom_mode, int autopilot);
/** @brief Translate from mode id to audio text */
static QString getAudioModeTextFor(int id);
/** @brief Get the unique system id */
int getUASID() const;
/** @brief Get the airframe */
int getAirframe() const
{
return airframe;
}
/** @brief Get the components */
QMap<int, QString> getComponents();
/** @brief The time interval the robot is switched on */
quint64 getUptime() const;
/** @brief Get the status flag for the communication */
int getCommunicationStatus() const;
/** @brief Add one measurement and get low-passed voltage */
float filterVoltage(float value) const;
/** @brief Get the links associated with this robot */
QList<LinkInterface*>* getLinks();
Michael Carpenter
committed
Q_PROPERTY(double localX READ getLocalX WRITE setLocalX NOTIFY localXChanged)
Q_PROPERTY(double localY READ getLocalY WRITE setLocalY NOTIFY localYChanged)
Q_PROPERTY(double localZ READ getLocalZ WRITE setLocalZ NOTIFY localZChanged)
Q_PROPERTY(double latitude READ getLatitude WRITE setLatitude NOTIFY latitudeChanged)
Q_PROPERTY(double longitude READ getLongitude WRITE setLongitude NOTIFY longitudeChanged)
Michael Carpenter
committed
Q_PROPERTY(double satelliteCount READ getSatelliteCount WRITE setSatelliteCount NOTIFY satelliteCountChanged)
Michael Carpenter
committed
Q_PROPERTY(bool isLocalPositionKnown READ localPositionKnown)
Q_PROPERTY(bool isGlobalPositionKnown READ globalPositionKnown)
Michael Carpenter
committed
Q_PROPERTY(double roll READ getRoll WRITE setRoll NOTIFY rollChanged)
Q_PROPERTY(double pitch READ getPitch WRITE setPitch NOTIFY pitchChanged)
Q_PROPERTY(double yaw READ getYaw WRITE setYaw NOTIFY yawChanged)
Michael Carpenter
committed
Q_PROPERTY(double distToWaypoint READ getDistToWaypoint WRITE setDistToWaypoint NOTIFY distToWaypointChanged)
Anton Babushkin
committed
Q_PROPERTY(double airSpeed READ getGroundSpeed WRITE setGroundSpeed NOTIFY airSpeedChanged)
Q_PROPERTY(double groundSpeed READ getGroundSpeed WRITE setGroundSpeed NOTIFY groundSpeedChanged)
Anton Babushkin
committed
Q_PROPERTY(double bearingToWaypoint READ getBearingToWaypoint WRITE setBearingToWaypoint NOTIFY bearingToWaypointChanged)
Q_PROPERTY(double altitudeAMSL READ getAltitudeAMSL WRITE setAltitudeAMSL NOTIFY altitudeAMSLChanged)
Q_PROPERTY(double altitudeRelative READ getAltitudeRelative WRITE setAltitudeRelative NOTIFY altitudeRelativeChanged)
void setGroundSpeed(double val)
{
groundSpeed = val;
emit groundSpeedChanged(val,"groundSpeed");
emit valueChanged(this->uasId,"groundSpeed","m/s",QVariant(val),getUnixTime());
}
double getGroundSpeed() const
{
return groundSpeed;
}
Anton Babushkin
committed
void setAirSpeed(double val)
{
airSpeed = val;
emit airSpeedChanged(val,"airSpeed");
emit valueChanged(this->uasId,"airSpeed","m/s",QVariant(val),getUnixTime());
}
double getAirSpeed() const
{
return airSpeed;
}
Michael Carpenter
committed
void setLocalX(double val)
{
localX = val;
emit localXChanged(val,"localX");
Anton Babushkin
committed
emit valueChanged(this->uasId,"localX","m",QVariant(val),getUnixTime());
Michael Carpenter
committed
}
double getLocalX() const
{
return localX;
}
Michael Carpenter
committed
void setLocalY(double val)
{
localY = val;
emit localYChanged(val,"localY");
Anton Babushkin
committed
emit valueChanged(this->uasId,"localY","m",QVariant(val),getUnixTime());
Michael Carpenter
committed
}
double getLocalY() const
{
return localY;
}
Michael Carpenter
committed
void setLocalZ(double val)
{
localZ = val;
emit localZChanged(val,"localZ");
Anton Babushkin
committed
emit valueChanged(this->uasId,"localZ","m",QVariant(val),getUnixTime());
Michael Carpenter
committed
}
double getLocalZ() const
{
return localZ;
}
Michael Carpenter
committed
void setLatitude(double val)
{
latitude = val;
emit latitudeChanged(val,"latitude");
Michael Carpenter
committed
emit valueChanged(this->uasId,"latitude","deg",QVariant(val),getUnixTime());
Michael Carpenter
committed
}
double getLatitude() const
{
return latitude;
}
Michael Carpenter
committed
void setLongitude(double val)
{
longitude = val;
emit longitudeChanged(val,"longitude");
Michael Carpenter
committed
emit valueChanged(this->uasId,"longitude","deg",QVariant(val),getUnixTime());
Michael Carpenter
committed
}
double getLongitude() const
{
return longitude;
}
Michael Carpenter
committed
Anton Babushkin
committed
void setAltitudeAMSL(double val)
Michael Carpenter
committed
{
Anton Babushkin
committed
altitudeAMSL = val;
emit altitudeAMSLChanged(val, "altitudeAMSL");
emit valueChanged(this->uasId,"altitudeAMSL","m",QVariant(val),getUnixTime());
Loading
Loading full blame...