Controller#
Motion control and dynamic obstacle avoidance.
The Controller is the real-time “pilot” of your robot. While the Planner looks ahead to find a global route, the Controller deals with the immediate reality — calculating velocity commands to follow the global path (path following) or a global target point (object following) while reacting to dynamic obstacles and adhering to kinematic constraints.
It supports several control algorithms, switched by configuration or at run time: Pure Pursuit, Stanley, DWA, DVZ and the vision followers.
Available Run Types#
The Controller typically runs at a high frequency (10Hz-50Hz) to ensure smooth motion.
Timed |
Periodic Control Loop. Computes a new velocity command periodically if all necessary inputs are available. |
Action Server |
Goal Tracking. Offers a |
Inputs#
Key Name |
Allowed Types |
Number |
Default |
|---|---|---|---|
plan |
1 |
|
|
location |
|
1 |
|
sensor_data |
1 |
|
|
local_map |
1 |
|
|
vision_detections |
|
1 |
None. Provide it to use vision target tracking. |
depth_camera_info |
1 |
None. Required for the RGB-D follower. |
|
vision_depth |
1 |
None. A separate depth source, an aligned depth image or a point cloud, paired with detections by time stamp within |
Tip
Provide a vision_detections input topic to the controller to activate the creation of a vision-based target following action server, track_vision_target. See the Vision Tracking tutorial for more details.
Outputs#
Key Name |
Allowed Types |
Number |
Default |
|---|---|---|---|
command |
1 |
|
|
multi_command |
1 |
|
|
interpolation |
1 |
|
|
local_plan |
1 |
|
|
tracked_point |
|
1 |
|
path_samples |
1 |
|
Algorithms#
EMOS includes several production-ready control plugins suited for different environments:
Pure Pursuit — Geometric path tracking towards a look-ahead point on the path. Simple, smooth and predictable.
Stanley — Geometric path tracking using the front axle as reference. Best for Ackermann steering.
DVZ — Deformable Virtual Zone. Reactive collision avoidance based on risk zones. Extremely fast for crowded dynamic environments.
DWA — Dynamic Window Approach. Sample-based collision avoidance with GPU support. Considers kinematics to find optimal velocity.
Vision followers —
VisionRGBFollowerandVisionRGBDFollower. Steer the robot to keep a visual target centered, from RGB alone or with depth.
See the Algorithms Reference for detailed descriptions of each algorithm.
Configuration#
Field |
Default |
Effect |
|---|---|---|
|
|
The control algorithm, a |
|
0.1 s |
Time step of the computed control sequence. |
|
false |
Read obstacles from the sensor directly rather than from the local map. |
|
|
How commands go out: |
|
0.2 s |
How far apart a detection and its separate depth may be in time. |
|
false |
Publishes the sampled trajectories on |
Built-in Actions#
set_algorithm(algorithm_value) switches the algorithm while the recipe runs, which is what an event uses to move from Pure Pursuit outdoors to DWA indoors. stop_path_tracking() ends the current tracking as if the path had been reached, clears the plan and stops the robot; a new plan resumes tracking. Both return (success, message). With vision tracking enabled, the StopVisionTracking service stops a running target follow.
Usage Example#
from kompass.components import Controller, ControllerConfig
from kompass.control import ControllersID
from kompass.ros import Topic
# Setup custom configuration
my_config = ControllerConfig(loop_rate=10.0)
# Init a controller object
my_controller = Controller(component_name="controller", config=my_config)
# Change an input
my_controller.inputs(plan=Topic(name='/global_path', msg_type='Path'))
# Change run type (default "Timed")
my_controller.run_type = "ActionServer"
# Choose the algorithm
my_controller.algorithm = ControllersID.DWA