Firmware Version: 2.71
Attached Files: Modified ArduPlane.pde
I've been working on modifying the ArduPlane's firmware so that it outputs a stream of data describing the plane's location, altitude, and attitude over Serial2 (uartC).
I made sure to disable the gcs3 initialization in the init_ardupilot() function so that the uartC port is available. To output the stream of data, I am simply using:
Where "data" is the specific variable I want to output. To output the GPS location and altitude data, added this line of code to the update_alt() and update_GPS() functions. The data is only outputted when valid new information is recieved from the GPS / barometer.
To output the attitude information, I added the above line of code to case 3 of the medium loop. This is the case dealing with telemetry so I guessed it might have slightly less of a load on it and I decided to add my code there. This is also after the euler angles have been updated, which are what I am sending out as the attitude data.
Here is the problem. This method of output works perfectly well most of the time. All my tests through HIL (hil_attitude) simulation were successful. Some of my tests in the air tests were successful as well, but others weren't. I am using a Gumstix Overo COM to record the ArduPlane output from uartC. I am pretty sure the Overo is not malfunctioning. Do any of the developers here have any other idea of what might be the cause of the inconsistencies in air?
One thing I considered is the possibility of the ArduPilot scheduler getting in the way. I have briefly looked at the scheduler but don't exactly understand how it works. Does ArduPilot schedule an maximum time per function that can't be exceeded. This could explain why my code sometime fires and sometimes doesn't.
Once again, attached to this email is the modified ArduPlane.pde.