Hi, my name is Craig Cobabe. Some of you may have seen Chris Pitt's discussion in this group. I have joined Chris in a design project for school in which we are going to implement a Fuzzy Controller in ArduCopter. 

I've been developing a fuzzy controller library to be compatible with APM and we have even replaced the PI controller for pitch and had very promising results in HIL. 

I've hit a sort of road block that I'm not sure how to resolve. Currently there is no way to handle the fuzzy parameters from APM Planner. So I've been trying to fit our fuzzy parameters into the global variable list. 

so far I've added the following:

In Parameters.h, a key index for eeprom in the enum:

// 260: Fuzzy Logic Controllers
//
k_param_fl_stabilize_pitch = 260,

as well as to the initializer list:

fl_stabilize_pitch (STB_PIT_FZY_CNTR, STB_PIT_FZY_SPC, STB_PIT_RULE_CNT, 0.0, 0),

currently not using this, so it can be added to global list:

//fl_stabilize_pitch (k_param_fl_stabilize_pitch, PSTR("STB_PIT_FZY_"), STB_PIT_FZY_CNTR, //STB_PIT_FZY_SPC, STB_PIT_RULE_CNT, 0.0, 0),

we then added this to Attitude.pde:

// convert to desired Rate:
//rate = g.pi_stabilize_pitch.get_pi(error, G_Dt);
rate = g.fl_stabilize_pitch.DOF(error);

This all worked fine. But after digging into the code I found that if we want to modify the controller parameters real time then we have to add the controller to the global variable list since mavlink uses the linked list to send params.

This brings be to my question. Say i have 3 fuzzy rules. The fuzzy library contains an array of FuzzyRule objects. Each has it's own variables to add to the global variable list. Can I make groups nested under the fl_stabilize_pitch group?

In other words, can a group contain a list of groups which contain the parameters?

Whether I can or not, is there a better way to accomplish sending my parameters over serial? Sending/Receiving without using the global list? 

Thanks,

Craig

PS. Hopefully I haven't been too cryptic, let me know what questions you have.

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Developer

    Craig,

         You can actually modify all parameters through the mission planner's Configuration / Parameter List screen (see screenshot below).  Unless you have a really large number of parameters (>40) I think you should be able to fit them into the current architecture and modify them through the planner.  This is something we often do - add parameter during the dev cycle and then ask Michael O to add proper support through a custom screen just before official release.

         First thing is you need to keep the parameter number under 254 (254 and 255 are reserved) so instead of using 260, how about 240?

         I think the last thing you're missing is you need to add a GGROUP or GOBJECT line at the bottom of the Parameters.pde file's var_info definition.  You'll need a line for each FuzzyRule object.  It'll be something like:

    GOBJECT(<instance name>, <prefix>, <class_name>)

    GGROUP(<instance name>,<prefix>,<class_name>)

        To be honest, I'm not sure why sometimes we use GBOJECT and sometimes we use GGROUP.  Maybe it depends if there's further nesting?

         Anyway, once you've done this, voila! it should appear and you can modify it through the MP's parameters list.

         What you're doing sounds interesting, good luck.

    -Randy

    3692462480?profile=original

This reply was deleted.