RandomController¶
src.python_motion_planning.controller.random_controller.RandomController
¶
Bases: BaseController
Random controller
Source code in src\python_motion_planning\controller\random_controller.py
Python
class RandomController(BaseController):
"""
Random controller
"""
def get_action(self, obs: np.ndarray) -> Tuple[np.ndarray, tuple]:
"""
Randomly sample action in action space.
Parameters:
obs: observation ([pos, vel, rel_pos_robot1, rel_pos_robot2, ...], each sub-vector length=dim)
Returns:
action: action ([acc], length=dim)
target: lookahead point
"""
return self.action_space.sample(), self.goal
get_action(obs)
¶
Randomly sample action in action space.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obs
|
ndarray
|
observation ([pos, vel, rel_pos_robot1, rel_pos_robot2, ...], each sub-vector length=dim) |
required |
Returns:
Name | Type | Description |
---|---|---|
action |
ndarray
|
action ([acc], length=dim) |
target |
tuple
|
lookahead point |
Source code in src\python_motion_planning\controller\random_controller.py
Python
def get_action(self, obs: np.ndarray) -> Tuple[np.ndarray, tuple]:
"""
Randomly sample action in action space.
Parameters:
obs: observation ([pos, vel, rel_pos_robot1, rel_pos_robot2, ...], each sub-vector length=dim)
Returns:
action: action ([acc], length=dim)
target: lookahead point
"""
return self.action_space.sample(), self.goal