Controller#
The state of an action.
the action has not started
the action is running
the action failed
the action succeeded
- Type:
- Type:
Holds the state of a long running task and notifies observers when it terminates.
Abort the action, calling the
done_cb
if set.
- Type:
Return whenever the action is done or not.
- Returns:
True if the action failed or succeeded
- Type:
Optional[Callable[[navground.core.Action.State], None]]
A callback called when the action terminates
The callback argument is the final state of the action.
- Type:
Return whenever the action is running.
- Returns:
True if the action is running
- Type:
Optional[Callable[[float], None]]
A callback called when the action is running
The callback argument is the minimal expected time to terminate the action.
-
The current state
This class exposes a higher level, stateful interface to a behavior, to which it delegates 2D collision avoidance.
The controller provides actions (event-based interfaces) to
go to a point/pose, stopping once the target has been reached,
follow a point/pose, which does not terminates once the target has been reached
follow a velocity/twist
Typical usage of a controller
Pick and configure a
Behavior
Initialize and configure the controller
At regular intervals, update the state, using the
Behavior
API, and callupdate()
.When needed, trigger one of the actions.
Either manually check the action’s
state
or set callbacks to be notified when the action terminates or updates.Actuate the target command by using the return value of
update()
or by setting a callbackset_cmd_cb()
Constructs a new instance.
- Parameters:
behavior – The navigation behavior
Starts an action to follow a target direction.
If an action is already running, the controller aborts it, unless it was following a velocity/twist, in which case it just updates the target.
- Parameters:
direction – The target direction. Must have positive norm.
- Returns:
The new action.
Start following a path.
Internally calls
go_to_position()
to move towards the last point of the path .- Parameters:
path – The path
tolerance – The spatial tolerance
- Returns:
The new action.
Starts an action to follow a point.
The action keeps running even after the agent arrive at the target.
If an action is already running, the controller aborts it, unless it was following a point/pose, in which case it just updates the target.
- Parameters:
point – The target point
- Returns:
The new action.
Starts an action to follow a pose
The action keeps running even after the agent arrive at the target.
If an action is already running, the controller aborts it, unless it was following a point/pose, in which case it just updates the target.
- Parameters:
pose – The target pose
- Returns:
The new action.
Starts an action to follow a target twist.
If an action is already running, the controller aborts it, unless it was following a velocity/twist, in which case it just updates the target.
- Parameters:
twist – The target twist
- Returns:
The new action.
Starts an action to follow a target velocity.
If an action is already running, the controller aborts it, unless it was following a velocity/twist, in which case it just updates the target.
- Parameters:
velocity – The target velocity
- Returns:
The new action.
Starts an action to go to a pose.
The action succeed once the agent arrives within a tolerance from the target pose and comes to a stop.
If an action is already running, the controller aborts it.
- Parameters:
pose – The target pose
position_tolerance – The spatial tolerance
orientation_tolerance – The spatial tolerance
along_path – An optional path to follow
- Returns:
The new action.
Starts an action to go to a point.
The action succeed once the agent arrives within a tolerance from the target point and comes to a stop.
If an action is already running, the controller aborts it.
- Parameters:
point – The target point
tolerance – The spatial tolerance
along_path – An optional path to follow
- Returns:
The new action.
Sets the callback called each time a command is computed for an active action.
- Parameters:
value – A callback that takes the command twist as argument.
Abort the running action.
Updates the control for time step.
Internally calls
Behavior.compute_cmd()
for collision avoidance.- Parameters:
time_step – The time step
- Returns:
The command twist to execute the current action
- Type:
The navigation behavior used by the controller
- Type:
Optional[navground.core.Frame]
The frame of reference for the command.
- Type:
Returns whether the control action is idle.
- Returns:
True only if the control action is not running.
- Type:
@private
- Type:
The minimal speed to consider the agent as stopped.
the default is 1 cm/s.
-
The state of the control action.