-
Notifications
You must be signed in to change notification settings - Fork 5
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
Adhesion-related fix for hybrid controller (avoiding physics errors) #143
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @stimpfli ! There are some minor style things that I want to change --- i will do it myself.
Overall the new changes are not super clear to me immediately. Maybe once you update the Method subsection it will make more sense to me. I'm going to merge this already since this allows @tkclam and me to rerun head stabilization, fly tracking, path integration, and the RL stuff with your latest change, but would you mind going back to this at some point to add more comments? In my opinion the code (along with its comments) should be self-sustained (ie. the user shouldn't have to read the method section of the paper to understand what the code does.)
print(f"Spawning fly at {obs['fly'][0]} mm") | ||
|
||
obs_list, had_physics_error = run_hybrid_simulation( | ||
obs_list, inf_list, had_physics_error = run_hybrid_simulation( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change inf_list
to info_hist
since (1) inf
means infinity in numpy and (2) I used info_hist
elsewhere.
Similarly, obs_list
-> obs_hist
just for consistency.
@@ -300,7 +335,7 @@ def step(self, action): | |||
) | |||
|
|||
# No adhesion in stumbling or retracted | |||
my_adhesion_onoff *= np.logical_not(is_stumbling or is_retracted) | |||
# my_adhesion_onoff *= np.logical_not(is_stumbling or is_retracted) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove this
@@ -134,37 +161,39 @@ def run_hybrid_simulation(sim, cpg_network, preprogrammed_steps, run_time): | |||
if leg[0] == "R": | |||
net_correction *= right_leg_inversion[i] | |||
|
|||
net_correction *= step_phase_multipler[leg]( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not super clear to me — maybe more comments/docs can help.
Description
The following message is from @stimpfli :
I had to make important changes to the hybrid controller for it not to raise physics error:
Rule activation (stumbling or retraction) does not alter adhesion actuation (adhesion is no longer turned off when one rule is active)
Rule activation trigger step phase dependant action (e.g the leg is now retracted during the swing phase and protracted during the swing phase when a rule is active)
The block height was set back to 0.35 as in the original paper
From the behaviour point of view, when a leg is stuck in a hole when the leg is in stance the fly uses adhesion to push in the hole potentially helping the other legs to overcome the obstacle, when during stance, the leg is pulled more retracted out of the hole.
This works really well as it does not lead to physics error and improved the plot we want to include in the paper (Each dot is the travelled distance divided by the simulation time)
The only drawback of this approach is that the fly is walking slightly less straight. I have tested some turning it seems to be working decently,
Types of changes
Does this address any currently open issues?
[list open issues here]