diff --git a/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp b/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp index 4700bdb5c..0b2f4954d 100644 --- a/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp +++ b/ground/openpilotgcs/src/libs/utils/homelocationutil.cpp @@ -44,7 +44,7 @@ HomeLocationUtil::HomeLocationUtil() } /* - /*Get world magnetic model + /*Get local magnetic field * input params: LLA * output params: Be */ diff --git a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp index 9cb7a7cc6..19a2a0426 100644 --- a/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/opmap/opmapgadgetwidget.cpp @@ -919,7 +919,7 @@ void OPMapGadgetWidget::setHome(QPointF pos) /** Sets the home position on the map widget */ -void OPMapGadgetWidget::setHome(internals::PointLatLng pos_lat_lon,double altitude) +void OPMapGadgetWidget::setHome(internals::PointLatLng pos_lat_lon, double altitude) { if (!m_widget || !m_map) return; @@ -941,13 +941,13 @@ void OPMapGadgetWidget::setHome(internals::PointLatLng pos_lat_lon,double altitu if (longitude > 180) longitude = 180; else if (longitude < -180) longitude = -180; - else if(altitude != altitude) altitude=0; // ********* - m_home_position.coord = internals::PointLatLng(latitude, longitude); + m_home_position.coord = internals::PointLatLng(latitude, longitude); + m_home_position.altitude = altitude; - m_map->Home->SetCoord(m_home_position.coord); + m_map->Home->SetCoord(m_home_position.coord); m_map->Home->SetAltitude(altitude); m_map->Home->RefreshPos(); @@ -1659,7 +1659,15 @@ void OPMapGadgetWidget::onSetHomeAct_triggered() if (!m_widget || !m_map) return; - setHome(m_context_menu_lat_lon,0); + float altitude=0; + bool ok; + + //Get desired HomeLocation altitude from dialog box. + //TODO: Populate box with altitude already in HomeLocation UAVO + altitude = QInputDialog::getDouble(this, tr("Set home altitude"), + tr("In [m], referenced to WGS84:"), altitude, -100, 100000, 2, &ok); + + setHome(m_context_menu_lat_lon, altitude); setHomeLocationObject(); // update the HomeLocation UAVObject } diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp index 70e766823..63bf6e8d4 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp @@ -323,7 +323,7 @@ int UAVObjectUtilManager::setHomeLocation(double LLA[3], bool save_to_sdcard) HomeLocation::DataFields homeLocationData = homeLocation->getData(); homeLocationData.Latitude = LLA[0] * 1e7; homeLocationData.Longitude = LLA[1] * 1e7; - homeLocationData.Altitude = LLA[2] * 1e7; + homeLocationData.Altitude = LLA[2]; homeLocationData.Be[0] = Be[0]; homeLocationData.Be[1] = Be[1];