Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
7c0a836c
Commit
7c0a836c
authored
Oct 29, 2015
by
Don Gagne
Browse files
Remove unused code
parent
1d843f21
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/HomePositionManager.cc
View file @
7c0a836c
...
...
@@ -117,62 +117,7 @@ void HomePositionManager::_loadSettings(void)
if
(
_homePositions
.
count
()
==
0
)
{
_homePositions
.
append
(
new
HomePosition
(
"ETH Campus"
,
QGeoCoordinate
(
47.3769
,
8.549444
,
470.0
),
this
));
}
// Deprecated settings for old editor
settings
.
beginGroup
(
"QGC_UASMANAGER"
);
bool
changed
=
setHomePosition
(
settings
.
value
(
"HOMELAT"
,
homeLat
).
toDouble
(),
settings
.
value
(
"HOMELON"
,
homeLon
).
toDouble
(),
settings
.
value
(
"HOMEALT"
,
homeAlt
).
toDouble
());
// Make sure to fire the change - this will
// make sure widgets get the signal once
if
(
!
changed
)
{
emit
homePositionChanged
(
homeLat
,
homeLon
,
homeAlt
);
}
settings
.
endGroup
();
}
bool
HomePositionManager
::
setHomePosition
(
double
lat
,
double
lon
,
double
alt
)
{
// Checking for NaN and infitiny
// and checking for borders
bool
changed
=
false
;
if
(
!
isnan
(
lat
)
&&
!
isnan
(
lon
)
&&
!
isnan
(
alt
)
&&
!
isinf
(
lat
)
&&
!
isinf
(
lon
)
&&
!
isinf
(
alt
)
&&
lat
<=
90.0
&&
lat
>=
-
90.0
&&
lon
<=
180.0
&&
lon
>=
-
180.0
)
{
if
(
fabs
(
homeLat
-
lat
)
>
1e-7
)
changed
=
true
;
if
(
fabs
(
homeLon
-
lon
)
>
1e-7
)
changed
=
true
;
if
(
fabs
(
homeAlt
-
alt
)
>
0.5
f
)
changed
=
true
;
if
(
changed
)
{
homeLat
=
lat
;
homeLon
=
lon
;
homeAlt
=
alt
;
emit
homePositionChanged
(
homeLat
,
homeLon
,
homeAlt
);
}
}
return
changed
;
}
bool
HomePositionManager
::
setHomePositionAndNotify
(
double
lat
,
double
lon
,
double
alt
)
{
// Checking for NaN and infitiny
// and checking for borders
bool
changed
=
setHomePosition
(
lat
,
lon
,
alt
);
if
(
changed
)
{
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
setHomePositionForAllVehicles
(
homeLat
,
homeLon
,
homeAlt
);
}
return
changed
;
}
}
void
HomePositionManager
::
updateHomePosition
(
const
QString
&
name
,
const
QGeoCoordinate
&
coordinate
)
...
...
src/HomePositionManager.h
View file @
7c0a836c
...
...
@@ -112,21 +112,6 @@ public:
return
homeAlt
;
}
public
slots
:
// Deprecated methods
/** @brief Set the current home position, but do not change it on the UAVs */
bool
setHomePosition
(
double
lat
,
double
lon
,
double
alt
);
/** @brief Set the current home position on all UAVs*/
bool
setHomePositionAndNotify
(
double
lat
,
double
lon
,
double
alt
);
signals:
/** @brief Current home position changed */
void
homePositionChanged
(
double
lat
,
double
lon
,
double
alt
);
protected:
double
homeLat
;
double
homeLon
;
...
...
src/Vehicle/MultiVehicleManager.cc
View file @
7c0a836c
...
...
@@ -212,13 +212,6 @@ void MultiVehicleManager::_autopilotParametersReadyChanged(bool parametersReady)
}
}
void
MultiVehicleManager
::
setHomePositionForAllVehicles
(
double
lat
,
double
lon
,
double
alt
)
{
for
(
int
i
=
0
;
i
<
_vehicles
.
count
();
i
++
)
{
qobject_cast
<
Vehicle
*>
(
_vehicles
[
i
])
->
uas
()
->
setHomePosition
(
lat
,
lon
,
alt
);
}
}
void
MultiVehicleManager
::
saveSetting
(
const
QString
&
name
,
const
QString
&
value
)
{
QSettings
settings
;
...
...
src/Vehicle/MultiVehicleManager.h
View file @
7c0a836c
...
...
@@ -65,8 +65,6 @@ public:
Q_INVOKABLE
Vehicle
*
getVehicleById
(
int
vehicleId
);
void
setHomePositionForAllVehicles
(
double
lat
,
double
lon
,
double
alt
);
UAS
*
activeUas
(
void
)
{
return
_activeVehicle
?
_activeVehicle
->
uas
()
:
NULL
;
}
QList
<
Vehicle
*>
vehicles
(
void
);
...
...
src/uas/UAS.cc
View file @
7c0a836c
...
...
@@ -1010,42 +1010,6 @@ void UAS::receiveMessage(mavlink_message_t message)
}
}
/**
* Set the home position of the UAS.
* @param lat The latitude fo the home position
* @param lon The longitude of the home position
* @param alt The altitude of the home position
*/
void
UAS
::
setHomePosition
(
double
lat
,
double
lon
,
double
alt
)
{
if
(
!
_vehicle
||
blockHomePositionChanges
)
return
;
QMessageBox
::
StandardButton
button
=
QGCMessageBox
::
question
(
tr
(
"Set a new home position for vehicle %1"
).
arg
(
getUASID
()),
tr
(
"Do you want to set a new origin? Waypoints defined in the local frame will be shifted in their physical location"
),
QMessageBox
::
Yes
|
QMessageBox
::
Cancel
,
QMessageBox
::
Cancel
);
if
(
button
==
QMessageBox
::
Yes
)
{
mavlink_message_t
msg
;
mavlink_msg_command_long_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
this
->
getUASID
(),
0
,
MAV_CMD_DO_SET_HOME
,
1
,
0
,
0
,
0
,
0
,
lat
,
lon
,
alt
);
// Send message twice to increase chance that it reaches its goal
_vehicle
->
sendMessage
(
msg
);
// Send new home position to UAS
mavlink_set_gps_global_origin_t
home
;
home
.
target_system
=
uasId
;
home
.
latitude
=
lat
*
1E7
;
home
.
longitude
=
lon
*
1E7
;
home
.
altitude
=
alt
*
1000
;
qDebug
()
<<
"lat:"
<<
home
.
latitude
<<
" lon:"
<<
home
.
longitude
;
mavlink_msg_set_gps_global_origin_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
home
);
_vehicle
->
sendMessage
(
msg
);
}
else
{
blockHomePositionChanges
=
true
;
}
}
void
UAS
::
startCalibration
(
UASInterface
::
StartCalibrationType
calType
)
{
if
(
!
_vehicle
)
{
...
...
src/uas/UAS.h
View file @
7c0a836c
...
...
@@ -570,9 +570,6 @@ public slots:
/** @brief Update the system state */
void
updateState
();
/** @brief Set world frame origin / home position at this GPS position */
void
setHomePosition
(
double
lat
,
double
lon
,
double
alt
);
void
startCalibration
(
StartCalibrationType
calType
);
void
stopCalibration
(
void
);
...
...
src/uas/UASInterface.h
View file @
7c0a836c
...
...
@@ -119,9 +119,6 @@ public:
return
color
;
}
static
const
unsigned
int
WAYPOINT_RADIUS_DEFAULT_FIXED_WING
=
25
;
static
const
unsigned
int
WAYPOINT_RADIUS_DEFAULT_ROTARY_WING
=
5
;
enum
StartCalibrationType
{
StartCalibrationRadio
,
StartCalibrationGyro
,
...
...
@@ -158,8 +155,6 @@ public slots:
/** @brief Order the robot to pair its receiver **/
virtual
void
pairRX
(
int
rxType
,
int
rxSubType
)
=
0
;
virtual
void
setHomePosition
(
double
lat
,
double
lon
,
double
alt
)
=
0
;
/** @brief Send the full HIL state to the MAV */
#ifndef __mobile__
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment