uf-mil / SubjuGator

SubjuGator 8 on-board software
31 stars 43 forks source link

Program for calculating the linear drag coefficient in all 6 directions #394

Open JackGonzo11 opened 5 years ago

jnez71 commented 5 years ago

As @jpanikulam mentioned, the right way to do this is to formulate it as a statistical regression problem. Not only would you get better results with less painstaking experiments, you'd also become an omnipotent god of estimation theory in the process.

However, MIL is 50% about doing things right, and 50% about doing things right enough. So in the style of your approach here, might I suggest the following:

It sounds like the real goal is to get a simplified drag model that can help compute a feedforward term in your controller. I.e. your PD controller will output some wrench based on feedback, plus the drag coefficients you found here times the current twist, in hopes of cancelling the effect of drag on the sub.

So, just skip ahead and add that term to your controller right now with a wild guess at the drag coefficients (all zero is a fine guess). Then, instead of commanding wrenches for experimenting (which wont stop the sub from moving along axes it shouldn't for the current test), you should command twists through your controller. So if you're testing the sub's forward motion, command a twist that is only nonzero for forward linear velocity.

As usual, you'll see a nice controlled straight line motion that rejects most bobbing and other disturbances... but also as usual, the velocity that the sub achieves won't be the exact velocity you commanded! It will be off by some amount, because your feedforward term has the wrong drag coefficient. Tweak the drag coefficient until the sub's velocity matches what you commanded. Repeat for each axis.

If tweaking by hand seems tedious, code up your tweaking process so it happens automatically. Congratulations, you made an adaptive controller.

Anyway, nice work so far!

JackGonzo11 commented 5 years ago

I added the new program along with a readme file to my forked repo. Let me know if I need to change anything before it gets merged!

JackGonzo11 commented 5 years ago

I made the ReadMe file correction. I also addressed the problem about nothing being published to wrench. Apparently a newly declared publisher has to wait a small amount of time so the topic can connect before it sends a message

kev-the-dev commented 5 years ago

Most of the problems in my latest review still seem present.