I'm working on altering some elements of the Arducopter code to add support for 4-servo, 90 degree CCPM and could use some help from developers with experience with the code base.

It seems that the only files that need changing are in AP_MotorsHeli (.cpp and the header file) but perhaps I'm wrong in that assumption. I've tried some preliminary changes but upon uploading it to the APM through the Arduino IDE I noticed no alteration in the behavior of the system.

I suppose the problem can be broken down into two parts: re-purposing one of the auxiliary channels (presumably either channel 6 or 7) to drive the fourth servo, and altering the CCPM to apply roll and pitch discretely to the two pairs of servos.

You can view the alterations I've made over at my Github repository. Please bear in mind that these changes don't preserve the regular 3-servo CCPM setup; I wasn't expecting to have this work integrated into the official release.

Views: 2395

Reply to This

Replies to This Discussion

Christopher,

     You're very close.  I think the only thing you've missed is updating the new servo in the move_swash call.  Considering all the other changes you've made which look good, I don't think you'll have any problems with this last bit.  nice!

Ah, wait, I see you've done that too.  It looks pretty good to me actually.  There's no change in behaviour at all?

Are you building the code on windows with arduino?  In any case there are a few different ways to build the code described here.  If the options to configure the swash plate didn't appear then I would have thought that somehow you uploaded the multicopter software.  I guess you remembered to change the FRAME_CONFIG in APM_Config.h?  If you missed that step I'd expect the servos to go crazy however instead of simply acting like the old code.

Hi Christopher,

What is the project you're working on?  Seems it's for an Airstar AT-6100 helicopter?  That's a big heli!  Care to share any more about the project?

Couple things:

On Issue #4, you should change the metadata for Servo 4.  Minor problem here, probably no effect. 

Did you set the swashplate type to CCPM instead of H1?  I notice that you didn't do the roll, pitch and collective factors for the H1 swashplate, so if you left that parameter as H1, then you probably won't get the output on Ch6. (look at the ELSE on lines 375 and 451).

It's also possible that somewhere else in the code, Ch6 is being reset to something else. This could be happening in Mount, for example. Unfortunately, the output channel handling on APM is not very robust.  It's entirely possible for a function somewhere else to clobber your flight control output.  I don't mean this would happen in a random fashion.  But if you set it up that way using parameters or code hacking, it could happen.  

Also, I just noticed that line 458 of Arducopter.pde, you have not modified the call to AP_MotorsHeli to include the pointer for the parameters for the new servo.  Then I also noticed, that you also have not created the new servo parameter objects in Parameters.h (line 105ish and 357). Or Parameters.pde line 450ish.  

I'm surprised it even compiles...  Also, be aware that if you are compiling using Arduino IDE, you're probably going to run out of RAM.  It says maximum of 256k, but it won't actually take more than 241k, it won't upload properly.  So you're going to have to turn off some functions (Optflow, Mount, maybe CLI).

This issue with 4-servo CCPM swashplates has come up before, and I'd like to support it in the main code, but I'm not sure which is the best way to go about it.  Do we make it a special feature of the existing motorsheli code file? Or should we make AP_MotorsHeli3Servo and AP_MotorsHeli4Servo files?

Glad to hear that you are going to be starting with a 450!

It's easy to turn the extraneous functions off in APM_Config.  Oh, wait, I see that you're on 3.1 rc1.  If you update to rc4, you'll find a new section in APM_Config where it's obvious how to disable them.

Note that 3.1 has not been tested on helicopters by me at all.  I'm running on 3.0.1 with my own changes on top of that.  I'm waiting for my changes to be merged into trunk before I begin test flying on 3.1 with Heli.

Randy and I will have to figure out how to do this 4-servo swash.  It could be easily done as a parameter, but I hate to compile in that extra servo when 99.9999% of helis won't use it.

I'm not positive, but look at Parameters.h line 415ish.  You'll need to add the constructor in there for the extra channel.

Try adding these two lines to APM Config and see what you get:

#define OPTFLOW DISABLED

#define MOUNT DISABLED

I can't see why that would be.  That's odd.

I wonder if something isn't uploading properly.  If it's compiling over 241-242, you should be getting an error when it tries to upload.  Something about a memory location not matching.

I'll keep thinking about it, but I honestly have no idea what's going on now.

Have you tried this hack yet?  If it works, that might help troubleshoot.

So when you reused them, you just flipped them? (ie: negative?)

Ok, well that helps narrow down the problem actually. 

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service