I am attempting to create a HIL simulation with arducopter, but the X-plane arducopter model is not recognized by X-plane. I am using the QRO_X model to simulate arducopter, but when I try to open the aircraft in X-plane I receive the error:
I tried to open the following plane, but could not. This smacks of a corrupted airplane file, or a file that is not really an airplane file, or a missing airplane file altogether.
I followed the instructions here: http://code.google.com/p/ardupilot-mega/wiki/Xplane, except for I tried to use the arducopter model instead of the plane model. I was also planning on using the parameter file for x-plane arducopter instead of the plane parameter file on the wiki.
What could be causing this error? The arducopter model is supposed to open, right?
I have now updated to x-plane 9.70, and the arducopter model appears. I can't seem to get the arducopter off the ground though. I am uploading the quad HIL firmware from arduino by changing the APMconfig.h file to only include #define HIL_MODE HIL_MODE_ATTITUDE (everything else is commented out). After uploading the firmware to the arducopter through arduino, I started x-plane and selected the QRO_X aircraft. Then I changed the x-plane settings to match the settings here: http://code.google.com/p/ardupilot-mega/wiki/Xplane. After changing the x-plane settings, I connected to the APM via mission planner, and started the sim link through the simulation tab. I also uploaded the config file for the model arducopter in the configuration tab. If I turn on my transmitter and plug in my LiPo, the ardupilot outputs in the simulation tab in mission planner change when I move the transmitter sticks. There are other readings such as Plane GPS, Plane IMU, and autopilot status that also change once I start the simulation. Moving the throttle stick will not get the arducopter model off the ground in x-plane, but the model in x-plane will tilt accordingly when I move the transmitter sticks. What can I do to get the copter off the ground? Am I missing a step of configuration? Do I need to change the PID settings?
You need to "arm" the motors. The APM doesn't know that it is in simulation. Hold the yaw stick hard right. Be sure to read the entire manual, it has lots of goodies hidden inside like arming/disarming the motors.
That is my first/best guess about what you are faced with.
I'm assuming you followed the manual and did the setup, calibrated the radio, set the quad orientation (+ or x) and setup your transmitter to support six modes, and then set and saved the modes, as discussed in the manual?
I followed the instructions in the manual, and did the setup in the mission planner. In the simulation tab in mission planner under ardupilot output, the throttle value changes after arming motors and pushing the throttle stick up, but the copter still doesn't move. The copter does move for pitch and roll though, but stays on the ground.
Are the motors supposed to be plugged in to the APM? I have tried having them plugged in and unplugged but that doesn't effect the copter's upward movement. When the motors are plugged into the APM, they spin after arming and pushing the throttle stick up.
Thanks for your help!
In the manual, it says that I should see 'AAA' printed out in the terminal. I don't see that. I see lots of letters and brackets, but not 'AAA'. In the manual, it says that this means that the HIL firmware is wrong. I uploaded the firmware through arduino, and adjusted it for HIL.
What is the HIL firmware supposed to look like for arducopter?
Is there an APM_config.h file that is updated for HIL somewhere in the arducopter software download from the wiki?
I am having the same throttle problems with X-plane as this thread: http://diydrones.com/forum/topics/help-using-xplane10-demo-with-ard...
If I increase the throttle gain, I can lift off, but because the minimum throttle has also been raised with the gain, I can't seem to land.
Any ideas on where to start to tune the throttle for the sim?
The throttle range as shown in mission planner is 1076 to 1912.
Also, does the channel 5 switch (for modes) work in the arducopter HIL simulation? I have set the modes in the mission planner setup, but the only mode that works in the sim is stabilize/manual with the RC. If I set an action in the mission planner under the flight data tab, the simulated copter will immediately do the action (for example- auto mode will work when I set the action to SET_AUTO and click Do Action)
Thank you again for your help!
I have everything working now! The throttle gain is set to 3300 and I can get off the ground and land with that gain. I did not have the modes set right, but after noticing that mode is displayed in autopilot status under the simulation tab, I figured out the modes right away.
Thank you so much for helping me figure this out!
The altitude error is displayed in autopilot status under the simulation tab in the mission planner, and it is always +-10 for the missions I have flown so far in X-plane. Will this error be smaller during actual flight with sonar enabled?
lol. Jill, I was just loading up X-plane, having reloaded this APM for Quad HiL, and was about to test.
To answer you question about modes, yes, the APM works in HiL just like it does in real life. In fact, it is the same code base, there are only some hooks to pull in sensor data from outside the APM rather than onboard, and there are some control statements that skip updating the outputs so you don't actually move real servos/throttle (in case you have them attached.) I have talked some people through removing some of these conditional statements so that their control surfaces actually move while in HiL for purposes of demonstrating to students who want to see how the plane works (on screen and with a live model.)