tud-airlab / mppi-isaac

Model Predictive Path Integral Control using isaacgym for rollouts, gpu-accelerated
166 stars 19 forks source link

Runtime env actor asset changes #10

Closed c-salmi closed 1 year ago

c-salmi commented 1 year ago

Because Isaacgym doesn't allow the creation or deletion of actors, I've implemented a workaround which restarts the simulator.

We keep track of the current environment config in the class IsaacGymWrapper in the dict self.env_cfg. Then every call to compute_action in MPPIisaacPlanner we check if the observations contain any relevant changes and update self.env_cfg and restart the simulator if required.

I've also posted on the isaacgym forum here, to see if there is a better workaround.

Additionally this PR changes the way MPPIisaacPlanner and MPPIplanner interact. Instead of using class inheritence MPPIplanner is now simply a property of MPPIisaacPlanner because this prevents the abuse of accessing self in unexpected situations.

Edit: Also I changed the expected signature of the objective class method a bit. It now receives the instance of IsaacGymWrapper and can thus access all the simulation states to compute it's objective. The old version for instance could not access contact forces because they aren't in the root_states, dof_states, or rigid_body_states