i´m trying to do a quadplane SITL Simulation with the ardupilot firmware and an own matlab physics model.
(I updated the firmware from github last on the 01. Feb. 2021)
Right now i´m debugging my model because the simulation doesn´t fully work yet. Still i was wondering if my SITL startup/set up is correct.
To start the simulation i run matlab and start MAVProxy in cygwin via:
cd ~/ardupilot/ArduCopter
…/Tools/autotest/sim_vehicle.py -v ArduCopter -f JSON:127.0.0.1 --map --console (-w if i want to reset params)
In the MAVProxy command i load default and parameters with:
param load …/Tools/autotest/default_params/plane.parm (don´t know if that is really needed)
param load …/Tools/autotest/default_params/quadplane.parm
param load …/Tools/autotest/default_params/myParameter.parm
Down under is what´s inside myParameter.parm.
I set the servos for my control surfaces and my motors. There are four lift motors and one pusher motor.
When i start i get the errors:
APM: Skipping INS calibration (doesn´t appear when i leave matlab running and restart MAVProxy)
When i try to arm the aircraft i get APM: PreArm: EKF2 Roll/Pitch inconsistent by 179 deg. Even though Roll and Pitch are zero in my model before arming. I added ARMING_CHECK 65518 to stop this error and with this i can takeoff in quadrocopter mode without a problem. The only thing is that the Heading in the console “spins” around without the aircraft actually turning. When i set a waypoint (after the takeoff and when the set height is reached) the airplane crashes, which is my problem right now.
These errors may result because my model isn´t correct but i was still wondering if the SITL set up is correct.
I would guess there are some issues with your physics model, does the quad example model work for you? Are you re-using the forces and moments code from that example?
How do you know its not actually turning? I would guess you have some servos reversed or the tune is just wrong, maybe you can share your model somewhere?
I’ve had problems with my phsysics model. Some general mistakes but i also have to switch between different models for the different flight phases, one for the plane flight and one for the quadrocopter flight. That fixed my problems but i’m still looking for a smooth way to switch between models. In the LOG file i´ve found a parameter called Tm (Transition state). But i haven’t found this parameter in the complete parameter list for plane. Is it possible to send this parameter, or another one which gives information about the start and the end of the transition, via the JSON format when the UAV is flying in auto mode? I´ve read that it is possible to extend the JSON format.
I´ve followed the instructions on the website for the installation on windows. But i had to do additional things to make it work. I want to do the setup again to write down which additional steps i needed to make it work on my PC. I can post this here when I´ve done it. I guess I´ll be doing it in the next 2 or 3 weeks.
For the Matlab Modell I´m using the basic structure of the ardupilot example. I haven´t touched the SITLconnector function, I´ve done my own physic modell to calculate the forces and moments which the updateDynamics function uses to calculate the dynamics for the JSON format. There I´ve done my own function to calculate the euler angles. Don´t know if the rotateDCM function is wrong but I didn’t fully understand it why i did it myself.
I can´t post my Matlab modell here bc i need it for my thesis. But i did the most mistakes by calculating AoA, SS-Angle and the euler angles. And i had to make sure that every calculation is done in the correct coordinate system. Another problem was that i have to switch between models for different flight phases bc i´m simulating a quadplane. In your case i think you don´t necessarily need different models.
These where the things i had to check. Or do you have a specific problem? Or for which specific setup are you looking?
Another question i have: Is there a paramter to set the climb speed somehow? I´ve scanned the complete parameter list and mav.parm but i haven´t found anything useful. Does someone have an idea?
Thank you in advance for your answers and best regards!