OmniDrones icon indicating copy to clipboard operation
OmniDrones copied to clipboard

[Refactor] Better controller interface.

Open btx0424 opened this issue 1 year ago • 0 comments

The current implementation of controllers as Transform, though a good abstraction on top of MDPs, can be somehow inflexible in many cases. We would like to

  1. Make controllers as choices of action spaces.
  2. Manage controllers and parameters for different drone models through a registry/factory.

It would be something like:

from omni_drones.control import Controller

class MultirotorBase(RobotBase):
  def __init__(.self, cfg):
    ...
    self.controller = Controller.make(self, cfg)
    self.action_spec = ... # define action_spec accordingly

  def apply_action(self, actions):
    actions = self.controller(self.state, actions)
    ...

This way, we will be able to use substeps:


class SomeEnv(IsaacEnv):
  ...
  def _step(self, tensordict: TensorDictBase):
    actions = tensordict[("agents", "action")]
    for substep in range(self.substeps):
      self.drone.apply_action(actions)
      self.sim.step(...)
    ...

btx0424 avatar Oct 10 '23 06:10 btx0424