Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Muscle activation should be set only by the Python class #129

Closed
pgleeson opened this issue Oct 19, 2017 · 6 comments
Closed

Muscle activation should be set only by the Python class #129

pgleeson opened this issue Oct 19, 2017 · 6 comments

Comments

@pgleeson
Copy link
Member

pgleeson commented Oct 19, 2017

There is currently some hard coding of the activation signals at https://github.com/openworm/sibernetic/blob/development/src/owPhysicsFluidSimulator.cpp#L417.

The muscle signals coming in should be only set by the python class supplied to drive the muscles, either MuscleSimulation or C302NRNSimulation.

See commit below for fix. PR soon...

pgleeson added a commit to pgleeson/sibernetic that referenced this issue Oct 19, 2017
Moving plot_positions to root for now...
Allows setting logstep in sibernetic_c302.py
Updates sibernetic version to 0.0.6
Addresses openworm#129, uses pure muscle activation signal from Python class
Removes some use of "Pyramidal"
@pgleeson
Copy link
Member Author

FYI @a-palyanov I've added the "smooth start" to the MuscleSimulation Python class here:
pgleeson@e7e1748#diff-1ae43b765dbe328a71a4d401b9f30771R79

Can be plotted with: python main_sim.py

selection_390

@a-palyanov
Copy link
Member

a-palyanov commented Oct 21, 2017

Yes, there is actually some hard coding to achieve more realistic shapes of the body while swimming and crawling. There are two transformations of the signal, one after another: 1) sin(...)+1 --> (sin(...)+1)^2 to reduce the number of worm body segments at which both left and right muscles contract simultaneously, causing body shortening, and 2) attenuation of the signal for the muscles which are close to the tail (the closer the stronger), which somehow compensates the fact that muscle cells near the head are shorter then those at the tail, which in turn causes worm body shapes not very close to real worm's. Interestingly, the real C. elegans should possess some internal mechanisms allowing it to solve the same problems.
And the smooth start, which you've mentioned, as well.
I'll remove all this from the code, but in this case something like this should be inserted into main_sim.py

@a-palyanov
Copy link
Member

Fixed in the recent update (of development branch).

a-palyanov added a commit that referenced this issue Oct 23, 2017
Issues fixed within this update:
#129
#124

Physical parameters allow quite good crawling, but not very good swimming - additional tuning of some parameters is still necessary.
@pgleeson
Copy link
Member Author

pgleeson commented Nov 3, 2017

@a-palyanov Can you confirm that it was intended to change the behaviour of the sine wave input to swimming -> crawling?

selection_429

This is fine if you're mainly testing/tuning swimming behaviour at the moment, but when the worm_alone is run, it quickly bends to a C shape.

It should be quite straight forward to have multiple Python classes in main_sim.py for injecting sinusoidal (or any other) activation patterns, and these could be set at the command line (as c302 is, see https://github.com/pgleeson/sibernetic/blob/development/inc/owConfigProperty.h#L219), or specified in the configuration file. It would be much easier for others to test/plot/add them then.

@pgleeson pgleeson reopened this Nov 3, 2017
@a-palyanov
Copy link
Member

@pgleeson Both swimming and crawling look more natural when I use not a pure sin signal, but rather a (sin(...)+1)^2. Additionally, different environments require different maximal muscle contraction force, and the real C. elegans is able to adjust it if necessary. Worm_alone for sure requires noticeably lower maximal muscle contraction force, so when it is used with muscle activating signals for swimming it causes the body to bend to a C chape.
I agree that to have multiple Python classes for different locomotion types is a good idea and hope that there will be an opportunity to implement it in some near future.

@slarson
Copy link
Member

slarson commented Feb 11, 2018

I think this got incorporated; re-open if not...

@slarson slarson closed this as completed Feb 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants