When I run the "ext_mode_intro.slx" of PSP examples in external mode, Build button does not work but PX4 PSP: upload code to Px4FMU upload something succesfully, PX4_SIMULINK = None and there are some errors. What is wrong?

7 views (last 30 days)
Hi,
I am trying to run the "ext_mode_intro.slx" of PSP examples in external mode, but I will get an error that I do not know its reason to fix it. The error is:
Could not execute target data map file 'ext_mode_intro_ert_rtw/ext_mode_intro_targ_data_map' or it does not exist.
Stop the target, delete the ext_mode_intro executable, rebuild the code, and try again. Note that execution of external mode requires the build directory to be present
FYI:
- I am using the student version of MATLAB R2016b on Ubuntu.
- I am using serial connection (Pixhawk's Serial port 5 pins to PC USB port), so I have ttyS5 connected to a USB connector which is ttyUSB0.
- I am following the instruction given in PSP v 2.1 tutoril pdf file for running an external code (page 62).
What I do is:
1- Modifying the rc.txt file and copying to the SD-card directory /etc.
2 - Setting
MEX-file arguments: 1 '/dev/ttyUSB0' 57600 5
Data Exchange Serial Port: ttyUSB0
3 - Pressing the build button (ctrl+B) to generate code, BUT IT DOES NOT WORK and this error appears:
MATLAB Coder, Simulink Coder and Embedded Coder products are required to generate code for this hardware board. Install the required products.
However, when I select the Code > PX4 PSP: upload code to Px4FMU it starts to uploading to pixhawk, and I am not sure if its building the firmware or not. I see following in MATLAB command window.
Loaded firmware for 9,0, size: 867092 bytes, waiting for the bootloader...
If the board does not respond within 1-2 seconds, unplug and re-plug the USB connector.
PX4_SIMULINK = None
4- I plug in the Pixhawk to USB port and it starts to uploading the a firmware:
Erase : [ ] 0.0%
Erase : [= ] 5.6%
Erase : [== ] 11.1%
Erase : [=== ] 16.7%
Erase : [==== ] 22.3%
Erase : [===== ] 27.8%
Erase : [====== ] 33.4%
Erase : [======= ] 38.9%
Erase : [======== ] 44.5%
Erase : [========== ] 50.1%
Erase : [=========== ] 55.6%
Erase : [============ ] 61.2%
Erase : [============= ] 66.8%
Erase : [============== ] 72.3%
Erase : [=============== ] 77.9%
Erase : [================ ] 83.5%
Erase : [====================] 100.0%
Program: [= ] 7.4%
Program: [== ] 14.9%
Program: [==== ] 22.3%
Program: [===== ] 29.8%
Program: [======= ] 37.2%
Program: [======== ] 44.6%
Program: [========== ] 52.1%
Program: [=========== ] 59.5%
Program: [============= ] 67.0%
Program: [============== ] 74.4%
Program: [================ ] 81.8%
Program: [================= ] 89.3%
Program: [=================== ] 96.7%
Program: [====================] 100.0%
Verify : [ ] 1.0%
Verify : [====================] 100.0%
Rebooting.
5- I open nsh shell screen and type px4_simulink_app, but nothing happens.
6- Then I press "Connect to target" button, and the mentioned error pops up.
Could not execute target data map file 'ext_mode_intro_ert_rtw/ext_mode_intro_targ_data_map' or it does not exist.
Stop the target, delete the ext_mode_intro executable, rebuild the code, and try again. Note that execution of external mode requires the build directory to be present.
Please let me know what is happening. Why am I getting "PX4_SIMULINK = None" in step 3? Is it because of the student version of Matlab that doesn't support Simulink Coder and Embedded Coder, and it should be able to build by pressing 'Build' button first and then use PX4 PSP: upload code to Px4FMU to upload the firmware? PLEASE LET ME KNOW OF YOUR COMMENTS.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!