I have the problem with Ardupilot Mega 2.5 + . I have checked and rechecked everything and while compiling it still gives the same message. "The call to realtime_make_rtw_hook, during the after_make hook generated the following error: The build failed with the following message: "C:/MATLAB/Targets/R2012a/arduino-1.0/hardware/tools/avr/bin/avr-gcc" -I"C ..... Anybody please help ?
I am using http://www.mathworks.com/matlabcentral/fileexchange/39037-apm2-simu... for my work.I have followed all the instructions.
You will need embedded coder for this to run successfully. Do you have that in your SImulink/Matlab package. It does not come with standard student Matlab edition.
Do check out my issue with getting it to run here:
Also check that you have either:
1. Arduino target 1 and 2 installed OR
2. Arduino support package from Matlab itself (download from simulink tools, ROTH, install/update support package)
Do let me know if you resolve this issue.
Yes. I have the embedded coder. i bought it. I am able to run it now. But i am still unable to see a real time data, like when you shake the ardupilot it should show all 6 DOF parameters. It just runs for a while and stops. All the parameters are shown zero. I will let you know after i fix them. Did you get yours to work ?
My error was pretty fatal:
So were you able to see (on bottom left on simulink window) - Successfully built and downloaded code onto Arduino Mega 2560? How did you verify that it runs? Also, did you install matlab target 1 and 2 or did you use the ardunio support package from matlab directly?
Please be as specific as possible.I don't quite understand what you're trying to do without looking at your screen. Let the data show on the output scope in Simulink or something else? Where do the parameters show zero? And when you say it runs for a while and it stops, could you clarify that?
yeah i was able to see "compiled and downloaded".
i did "install target hardware". that's it
I used the scope on 6DOF IMU + timer block that comes when you download
i can't get the simulink block run forever like in C++ so that i can take continuous data
try changing the time in center top (next to play /stop button) and enter inf ,infs infinite time.
how do I get to: install target hardware?
I did inf but all the readings are just zero. The sensors must be activating otherwise it should give a compiling error.
In your simulink block page, go to tools, "Run on Target Hardware", if you are running for the first time you have to click on prepare.
after clicking on "Run on Target Hardware", click on "Install Update Support/Package".
When you select Prepare , there are several things you need to set right .
1. Set host COM port: The default is Automatically which never selects the right port. It just chooses port 1 by default which may not be the port you are using. Select manually to your #.
2 .The default baud rate is 9600. Set that to 115200.
3. Solver : ode4, Type : Fixed-step
4. hardware implementation : Device Vendor: Amtel
try discrete time step for the solver type? ode4 is continuous so might not be the best way to run discrete hardware.
and why did you choose 115200? Is it because that's what Mission Planner uses as default baud rate?
another issue that you might want to check is go to mission planner and flash the original firmware, then try to connect through mavlink (top right button that says connect) and see if that is good. My board was burnt after I ran the simulink code and tried to get it to connect, it wouldn't. It just showed "no dataflash inserted". Might want to check that just in case and make sure your dataflash is not faulty somehow and causing that zero problem.
When computer have to solve any differential equations it always uses discrete time. It has to discretize the time using any method.
115200 is the standard baud rate for APM 2.5 +
It works perfect in mission planner