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

Adhesion-related fix for hybrid controller (avoiding physics errors) #143

Merged
merged 7 commits into from Apr 17, 2024

Conversation

sibocw
Copy link
Contributor

@sibocw sibocw commented Apr 16, 2024

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

  • Bugfix
  • New feature
  • Refactor / Code style update (no logical changes)
  • Build / CI changes
  • Documentation Update
  • Other (explain)

Does this address any currently open issues?

[list open issues here]

@sibocw sibocw changed the title make adhesion continuous, bound actuator force Adhesion-related fix for hybrid controller (avoiding physics errors) Apr 16, 2024
@stimpfli stimpfli marked this pull request as ready for review April 17, 2024 13:30
Copy link
Contributor Author

@sibocw sibocw left a 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(
Copy link
Contributor Author

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)
Copy link
Contributor Author

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](
Copy link
Contributor Author

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.

@sibocw sibocw merged commit cde1b78 into dev-v1.0.0 Apr 17, 2024
9 checks passed
@sibocw sibocw deleted the dev_fix_hybrid_physics branch April 29, 2024 15:12
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

Successfully merging this pull request may close these issues.

None yet

2 participants