Added first simple GPS implementation

This commit is contained in:
dario
2023-12-14 23:29:09 +01:00
parent 751887e6d8
commit 33e5eba3a6
3 changed files with 57 additions and 11 deletions

View File

@@ -88,12 +88,16 @@
"source": [
"from spatz.sensors.imu.wsen_isds import WSEN_ISDS_ACC, WSEN_ISDS_GYRO\n",
"from spatz.sensors.pressure.ms5611_01ba03 import MS5611_01BA03\n",
"from spatz.sensors.gps.erinome1 import Erinome_I\n",
"\n",
"press_sensor = simulation.add_sensor(MS5611_01BA03)\n",
"\n",
"# Use the offset argument to change the position of the imu in relation to the rocket's center of gravity.\n",
"accelerometer = simulation.add_sensor(WSEN_ISDS_ACC, offset=0)\n",
"gyro = simulation.add_sensor(WSEN_ISDS_GYRO, offset=0)"
"gyro = simulation.add_sensor(WSEN_ISDS_GYRO, offset=0)\n",
"\n",
"# Add a GPS module to the simulation which returns the following data: [latitude, longitude, altitude (km)]\n",
"gps_module = simulation.add_sensor(Erinome_I)"
]
},
{
@@ -171,10 +175,6 @@
}
],
"source": [
"from spatz.metrics import Metric\n",
"\n",
"metric = Metric()\n",
"\n",
"logger = simulation.get_logger()\n",
"\n",
"# Set verbose to False to disable the progress bar\n",
@@ -183,16 +183,12 @@
" press = press_sensor()\n",
" acc = accelerometer()\n",
" rot_rate = gyro()\n",
" gps = gps_module()\n",
"\n",
" # Get the correct altitude data.\n",
" alt = altitude()\n",
"\n",
" pred_alt = ...\n",
" metric(alt, pred_alt)\n",
"\n",
" # TODO: Add your computation here.\n",
"\n",
"print('Score was:', metric.get_score())"
" # TODO: Add your computation here."
]
},
{