Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Compilation errors:

    • Had trouble with extern C functions being called from the sensor fusion c++ file. This was just fixed by moving these functions into the sensor fusion file and it seemed to work. (Still not fully sure what the issue was).

  • Simulink runtime errors:

    • Had issues running the Simulink model with the block imported using the Code importer wizard, but now works fine when importing the code using a c function block.

    • “’Sensor_Fusion_ZP.sldd’ was not found” error on running Simulink model. This can occur when opening the project for the first time or when reopening it, and can be fixed by relinking the Sensor Fusion data dictionary file (’Sensor_Fusion_ZP.sldd’).

    This can be done through the model explorer, which can be accessed from the bottom left corner of the Simulink window (picture of the symbol attached below).

Testing

Initial Testing

...

Will document testing procedure and how it goes here.- Making sure it runs as expected

To check that the sensor fusion code was imported into Simulink correctly, constant values were used as inputs (representing inputs from the different sensors), then the output was compared to the inputs to be matched.
This was then paired with the sensor simulation blocks in SIMULINK, from the Sensor Fusion Blockset. This included the IMU and the GPS blocks. They take in inputs and output noisy measurements, based on their configuration. Images below show these blocks.

...

Notice, that data types had to be converted in some cases to ensure they fit into the Data Busses that represent the different structs in the SF code. There are also transpose blocks to correct the vector dimensions.

To verify the outputs (and can also be used to check the inputs) scope blocks were added to view the measurements. This was also paired with a visual representation of a drone to get a visual representation of some of the output data.

...

Notice that the latitude is varying a lot, while others to seem smoother. That actually isn’t the case. Taking a closer look at other data values such as the latitude or longitude, it is clear they too vary. Check the example below.

...

How to create a C Function Block

...