Drive Manager

Safety enforcement and command smoothing.

The DriveManager is the final gatekeeper before commands reach your robot’s low-level interfaces. Its primary job is to ensure that every command falls within the robot’s physical limits, satisfies smoothness constraints, and does not lead to a collision.

It acts as a safety shield, intercepting velocity commands from the Controller and applying Emergency Stops or Slowdowns based on immediate sensor data.

Safety Layers

The Drive Manager implements a multi-stage safety pipeline.

Emergency Stop

Critical Zone. Checks proximity sensors directly. If an obstacle enters the configured Safety Distance (m) and Angle (rad), the robot stops immediately to prevent collision.

Dynamic Slowdown

Warning Zone. If an obstacle enters the Slowdown Zone, the robot’s velocity is proportionally reduced, allowing for smoother reactions than a hard stop.

Control Limiting

Kinematic Constraints. Clamps incoming velocity and acceleration commands to the robot’s physical limits (max vel, max acc) to prevent hardware stress.

Smoothing

Jerk Control. Applies smoothing filters (e.g., low-pass) to incoming commands to prevent jerky movements and wheel slip.

Emergency Zone & Slowdown Zone
Emergency Zone & Slowdown Zone

Emergency Zone & Slowdown Zone

High-Performance Core

Critical and Slowdown Zone checking is implemented in C++ via kompass-core. The implementation supports both GPU and CPU acceleration (defaults to GPU if available) for minimal latency.

Built-in Actions

The Drive Manager provides built-in behaviors for direct control and recovery. These can be triggered via Events.

  • move_forward - Moves the robot forward for max_distance meters, if the path is clear.

  • move_backward - Moves the robot backward for max_distance meters, if the path is clear.

  • rotate_in_place - Rotates the robot for max_rotation radians, checking the safety margin.

  • move_to_unblock - Recovery Behavior. Automatically attempts to move forward, backward, or rotate to free the robot from a collision state or blockage.

Sensor Requirement

All movement actions require active \(360^o\) sensor data (LaserScan or PointCloud2) data to verify that the movement direction is collision-free.

Interface

Inputs

The Drive Manager subscribes to commands and raw sensor data.

Key Name

Allowed Types

Number

Default

command

geometry_msgs.msg.Twist, geometry_msgs.msg.TwistStamped

1

/control (Twist)

multi_command

TwistArray

1

/control_list

sensor_data

sensor_msgs.msg.LaserScan, std_msgs.msg.Float64, std_msgs.msg.Float32, sensor_msgs.msg.PointCloud2

1+ (Up to 10)

/scan (LaserScan)

location

nav_msgs.msg.Odometry, geometry_msgs.msg.PoseStamped, geometry_msgs.msg.Pose

1

/odom (Odometry)

Outputs

The processed commands sent to the hardware.

Key Name

Allowed Types

Number

Default

robot_command

geometry_msgs.msg.Twist, geometry_msgs.msg.TwistStamped

1

/cmd_vel (Twist)

emergency_stop

Bool

1

/emergency_stop

Usage Example

from kompass.components import DriveManager, DriveManagerConfig
from kompass.ros import Topic

# 1. Configuration
# Define safety zones and loop behavior
my_config = DriveManagerConfig(
    closed_loop=True,              # Check robot state feedback
    critical_zone_distance=0.1,    # Stop if obstacle < 10cm
    slowdown_zone_distance=0.3,    # Slow down if obstacle < 30cm
    critical_zone_angle=90.0       # Check 90 degrees cone in front
)

# 2. Instantiate
driver = DriveManager(component_name="driver", config=my_config)

# 3. Remap Outputs
# Send safe commands to your specific robot topic
driver.outputs(robot_command=Topic(name='/my_robot_cmd', msg_type='TwistStamped'))

See Next

Learn how to trigger the unblocking behaviors automatically using Events.

Event-Driven Recovery Tutorial →