ArduPilot 2.6 + ArduIMU V2 in Telemaster Electro

  • Modified ArduPilot2.6 and ArduIMU to do interprocessor communications via TWI to free up USART for full-duplex serial comm's between ArduPilot and GCS; can upload PID coefficients in flight. IPC code example:
  • Test flown in manual and stabilize modes, IMU appears to be consistently and accurately reporting attitude.
  • Stabilize mode is solid with no oscillations using default PID coeff's, but need a way to trim pitch; taildragger isn't at cruise pitch attitude when IMU is initialized.
  • Using SUP500 GPS module from SparkFun; altitude values off by up to 100 meters (field elevation 1800m). GPS frequently reports altitude of 1700m at pattern height (0-20m AGL). Also seeing huge intermittent (1 second duration) errors in lat,lon on the order of +/- 2 degrees. I don't think I screwed up the NMEA parser...
  • Also switched to a Serial library which performs buffered transmits. This seemed to solve some problems caused by the standard library's blocking writes.

Views: 617

3D Robotics
Comment by Chris Anderson on August 7, 2010 at 8:49am
Sparkfun says the SUP500 is a disaster and they're trying to get rid of them. Here's Nathan's post on the subject:

"I'm not sure if the modules are lousy or buggy or what? Whatever it is, fresh SUP500 modules have been know to not get locks, stop getting locks all of a sudden, start up and get a lock exceptionally slowly, etc.

I've just stopped suggesting people buy them all together. We have a graveyard of SUP500 modules sitting here at SparkFun. We tried to get them taken off the website. It was concluded that some but not all can get them working so we continue to sell them. Really they are like a tease; 33mA draw at a update rate of 10Hz, 30 sec cold start plus 65 Channels all for the low low price of $59.95, how could you go wrong??!!"
Comment by Mark Whitehorn on August 7, 2010 at 9:02am
My luck with GPS modules has been pretty bad. I bought the SUP500 because my EM406 failed (still responds to serial commands, just never sees any satellites) and SparkFun had just posted a rave review, calling it their new favorite. A week later the MTK was in stock at the DIYdrones store for $35

Now that you mention it, the SUP500 is much slower to achieve lock than the EM406 was.

Comment by Jason Short on August 7, 2010 at 10:37am
Mike, I've been investigating Serial alternatives. Can you post your code and information about which Serial Library you went with?
Comment by Mark Whitehorn on August 7, 2010 at 11:22am
Hi Jason,

I uploaded my HardwareSerial library (link above in last bullet). It's code written by Kiril Zyapkov (). I was able to size the TX buffer at 256 bytes since using Flash memory for print strings freed up so much RAM, but it only needs to be as large as your largest message (32 or 64 should be enough). I added a "blockingWrite" method and state variable to control whether writes block when the buffer is full. The Flash library is at . It makes declaring a flash string as simple as F("string"), but I think it also depends on the Streaming library also at Arduiniana.

Comment by AVS on August 7, 2010 at 2:45pm
Great work. Would you mind posting your modified imu and ap code. I am keen to see the twi implmentation, thanks v much
Comment by Mark Whitehorn on August 8, 2010 at 8:22am
Uploaded zip file containing ArduPilot and ArduIMU TWI routines. Link is above in first bullet.

Does anyone know why hyperlinks and file attachments don't work for me in comments? I've tried Google Chrome and Internet Explorer; links seem to appear as correct HTML but don't show up in comment.
Comment by AVS on August 8, 2010 at 11:08am
oh damn, sorry i just saw the hardwareSerial attachment. Thanks very much
Comment by Mark Whitehorn on August 8, 2010 at 12:55pm
You didn't miss anything; I just uploaded the TWI code today.

I also forgot to mention that there is (at least) one other change needed to use TWI. This code in setup() of Ardupilot_2_6.pde is required for initialization:

Wire.begin(ARDUPILOT_ADDR); // join i2c bus
Wire.onReceive(twiRcvEvent); // register slave device event handler

and of course it looks like this in arduimu.pde:

Wire.begin(ARDUIMU_ADDR); // join i2c bus
Wire.onReceive(twiRcvEvent); // register slave device event handler

Also keep in mind that while the ArduIMU to ArduPilot connection has been tested in flight, this was only using manual and stabilize modes. It will be at least a week before I begin to test FBW and higher modes.
Comment by AVS on August 8, 2010 at 12:58pm
Thanks, what a star you are. It's worth a post on the arduino site at some point. There are many people who would like to free up a uart! I look forward to your post with other modes :)
Comment by Alex on August 9, 2010 at 7:23pm
I have to give a quick <3 to the red-monokote covered telemaster :-)
We (NC State University Aerial Robotics) love our (modified) red 8' telemasters.
*goes back to lurking*


You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service