|
4 | 4 | "cell_type": "markdown", |
5 | 5 | "metadata": {}, |
6 | 6 | "source": [ |
7 | | - "# Global coordinate conversions" |
| 7 | + "# Global Coordinate Conversions" |
8 | 8 | ] |
9 | 9 | }, |
10 | 10 | { |
|
45 | 45 | "cell_type": "markdown", |
46 | 46 | "metadata": {}, |
47 | 47 | "source": [ |
48 | | - "# Local NED frame conversions" |
| 48 | + "# Local NED Frame Conversions" |
49 | 49 | ] |
50 | 50 | }, |
51 | 51 | { |
|
122 | 122 | "print('The converted free vector in NED is ')\n", |
123 | 123 | "print(v_ecef)" |
124 | 124 | ] |
| 125 | + }, |
| 126 | + { |
| 127 | + "cell_type": "markdown", |
| 128 | + "metadata": {}, |
| 129 | + "source": [ |
| 130 | + "# Elevation and Aziumth from ECEF Positions" |
| 131 | + ] |
| 132 | + }, |
| 133 | + { |
| 134 | + "cell_type": "markdown", |
| 135 | + "metadata": {}, |
| 136 | + "source": [ |
| 137 | + "Find elevation and azimuth angle from receiver and satellite ECEF positions." |
| 138 | + ] |
| 139 | + }, |
| 140 | + { |
| 141 | + "cell_type": "code", |
| 142 | + "execution_count": null, |
| 143 | + "metadata": {}, |
| 144 | + "outputs": [], |
| 145 | + "source": [ |
| 146 | + "from gnss_lib_py.utils.coordinates import ecef_to_el_az\n", |
| 147 | + "from gnss_lib_py.parsers.android import AndroidDerived2022\n", |
| 148 | + "\n", |
| 149 | + "# load Android Google Challenge data\n", |
| 150 | + "!wget https://raw.githubusercontent.com/Stanford-NavLab/gnss_lib_py/main/data/unit_test/android_2022/device_gnss.csv --quiet -O \"device_gnss.csv\"\n", |
| 151 | + "navdata = AndroidDerived2022(\"device_gnss.csv\")\n", |
| 152 | + "navdata_subset = navdata.where(\"gps_millis\",navdata[\"gps_millis\",0]) # only use data from first timestep" |
| 153 | + ] |
| 154 | + }, |
| 155 | + { |
| 156 | + "cell_type": "markdown", |
| 157 | + "metadata": {}, |
| 158 | + "source": [ |
| 159 | + "To calculate the elevation and azimuth, pass in the receiver and satellites' ECEF positions." |
| 160 | + ] |
| 161 | + }, |
| 162 | + { |
| 163 | + "cell_type": "code", |
| 164 | + "execution_count": null, |
| 165 | + "metadata": {}, |
| 166 | + "outputs": [], |
| 167 | + "source": [ |
| 168 | + "pos_sv_m = navdata_subset[[\"x_sv_m\",\"y_sv_m\",\"z_sv_m\"]].T\n", |
| 169 | + "pos_rx_m = navdata_subset[[\"WlsPositionXEcefMeters\",\n", |
| 170 | + " \"WlsPositionYEcefMeters\",\n", |
| 171 | + " \"WlsPositionZEcefMeters\"],0].reshape(1,-1)\n", |
| 172 | + "\n", |
| 173 | + "calculated_el_az = ecef_to_el_az(pos_rx_m,pos_sv_m)\n", |
| 174 | + "truth_el_az = navdata_subset[[\"el_sv_deg\",\"az_sv_deg\"]].T" |
| 175 | + ] |
| 176 | + }, |
| 177 | + { |
| 178 | + "cell_type": "markdown", |
| 179 | + "metadata": {}, |
| 180 | + "source": [ |
| 181 | + "We can now compare the calculated elevation and azimuth with their respective \"truth\" values included in the Google Decimeter Challenge 2022 dataset." |
| 182 | + ] |
| 183 | + }, |
| 184 | + { |
| 185 | + "cell_type": "code", |
| 186 | + "execution_count": null, |
| 187 | + "metadata": {}, |
| 188 | + "outputs": [], |
| 189 | + "source": [ |
| 190 | + "for sat_idx in range(3):\n", |
| 191 | + " print(f\"SV ID: {int(navdata_subset['sv_id',sat_idx])}\")\n", |
| 192 | + " print(f\"Calculated elevation: {calculated_el_az[sat_idx,0]}, Truth elevation: {truth_el_az[sat_idx,0]}\")\n", |
| 193 | + " print(f\"Calculated azimuth: {calculated_el_az[sat_idx,1]}, Truth azimuth: {truth_el_az[sat_idx,1]}\")" |
| 194 | + ] |
125 | 195 | } |
126 | 196 | ], |
127 | 197 | "metadata": { |
|
0 commit comments