kompass.components.drive_manager#
Module Contents#
Classes#
DriveManager component configuration parameters |
|
DriveManager component used for direct communication with the robot. |
API#
- class kompass.components.drive_manager.DriveManagerConfig#
Bases:
kompass.config.ComponentConfigDriveManager component configuration parameters
Name
Type, Default
Description
closed_loop
bool,TruePublish commands in closed loop by checking the robot velocity from the odometry topic
closed_loop_span
int,3Max number of commands to send in a closed loop execution
smooth_commands
bool,FalseFilter (smooth) incoming velocity commands to limit the acceleration
cmd_tolerance
float,0.05Tolerance value when checking for reaching the command in closed loop
critical_zone_angle
float,45degAngle range for the emergency stop critical zone (deg)
critical_zone_distance
float,0.05Distance for the emergency stop critical zone (meters)
slowdown_zone_distance
float,0.2Distance for the slowdown zone (meters)
disable_safety_stop
bool,FalseSet to
Trueto disable the safety stop functionalityuse_without_scan_sensor
bool,FalseSet to
Trueto allow running the drive manager with no spatial sensor at all.Rangesensors (e.g. front and back ultrasounds) count as safety sensors and do not need this flaguse_gpu
bool,TrueUse GPU implementation for the critical zone checking if available, otherwise use CPU implementation
sensor_data_timeout
float,0.2Maximum age (seconds) of a safety sensor’s last message before it is considered stale
stale_sensor_policy
str,"stop"What to do when a safety sensor goes stale:
"stop"triggers an emergency stop until data returns,"skip"runs the check on the remaining sensors only
- class kompass.components.drive_manager.DriveManager(component_name: str, config_file: Optional[str] = None, config: Optional[kompass.components.drive_manager.DriveManagerConfig] = None, inputs: Optional[Dict[str, kompass.components.ros.Topic]] = None, outputs: Optional[Dict[str, kompass.components.ros.Topic]] = None, **kwargs)#
Bases:
kompass.components.component.ComponentDriveManager component used for direct communication with the robot.
Inputs:
Key Name
Allowed Types
Number
Default
intermediate_cmd
1
Topic(name="/control", msg_type="Twist")intermediate_cmd_list
1
Topic(name="/control_list", msg_type="TwistArray")spatial_sensor
sensor_msgs.msg.LaserScan,sensor_msgs.msg.PointCloud2,sensor_msgs.msg.Range1 to 10
Topic(name="/scan", msg_type="LaserScan")robot_location
nav_msgs.msg.Odometry,geometry_msgs.msg.PoseStamped,geometry_msgs.msg.Pose1
Topic(name="/odom", msg_type="Odometry")Outputs:
Key Name
Allowed Types
Number
Default
final_command
1
Topic(name="/cmd_vel", msg_type="Twist")emergency
1
Topic(name="/emergency_stop", msg_type="Bool")- init_variables()#
Overwrites the init variables method called at Node init
- execute_cmd_closed_loop(output: geometry_msgs.msg.Twist, max_time: float)#
Execute a control command in closed loop
- Parameters:
cmd (Twist) – Velocity Twist message
max_time (float) – Maximum time for the closed loop execution (s)
- stop_robot(stop_timeout: float = 5.0, **_) kompass.components.ros.ActionReturnType#
Stops the robot in closed loop: drops queued commands and publishes zero velocity until the robot moves slower than its minimum velocity
- Parameters:
stop_timeout (float) – Maximum time to wait for the robot to stop (s)
- Returns:
If the robot stopped, with a reason when it did not
- Return type:
ActionReturnType
- move_forward(max_distance: float, **_) kompass.components.ros.ActionReturnType#
Moves the robot forward if the forward direction is clear of obstacles
- Parameters:
max_distance (float) – Maximum distance (m)
- Returns:
If the movement action is performed, with the distance traveled
- Return type:
ActionReturnType
- move_backward(max_distance: float, **_) kompass.components.ros.ActionReturnType#
Moves the robot backwards if the backward direction is clear of obstacles
- Parameters:
max_distance (float) – Maximum distance (m)
- Returns:
If the movement action is performed, with the distance traveled
- Return type:
ActionReturnType
- rotate_in_place(max_rotation: float, safety_margin: Optional[float] = None, **_) kompass.components.ros.ActionReturnType#
Rotates the robot in place if the space around it is clear.
Turns the way the angle asks for: a negative
max_rotationis a clockwise rotation of that size- Parameters:
max_rotation (float) – Angle to turn (rad), signed
safety_margin (Optional[float], optional) – Clearance to keep beyond the critical zone while turning (m), None for 5% of the robot’s radius. The checker sees out to the slowdown zone, so a margin wider than the band between the two zones asks for the most it can tell: nothing inside the slowdown zone at all
- Returns:
If the movement action is performed, with the angle rotated
- Return type:
ActionReturnType
- move_to_unblock(max_distance_forward: Optional[float] = None, max_distance_backwards: Optional[float] = None, max_rotation: float = np.pi / 2, rotation_safety_margin: Optional[float] = None, **_) kompass.components.ros.ActionReturnType#
Moves the robot forward/backward or rotate in place to get out of blocking spots
- Parameters:
max_distance_forward (Optional[float], optional) – Maximum distance to move forward (meters), if None defaults to 2 * robot_radius
max_distance_backwards (Optional[float], optional) – Maximum distance to move backwards (meters), if None defaults to 2 * robot_radius
max_rotation (float, optional) – Maximum rotation angle (radians), defaults to np.pi/4
rotation_safety_margin (Optional[float], optional) – Safety margin to perform rotation in place (meters), if None defaults to 5% of robot_radius
- Returns:
If one of the movement actions is performed, with the one that was
- Return type:
ActionReturnType