kompass.components.drive_manager#

Module Contents#

Classes#

DriveManagerConfig

DriveManager component configuration parameters

DriveManager

DriveManager.

API#

class kompass.components.drive_manager.DriveManagerConfig#

Bases: kompass.config.ComponentConfig

DriveManager component configuration parameters

Name

Type, Default

Description

closed_loop

bool, True

Publish commands in closed loop by checking the robot velocity from the odometry topic

cmd_rate

float, 10.0

Rate for sending the commands to the robot in closed loop (Hz)

closed_loop_span

int, 3

Max number of commands to send in a closed loop execution

smooth_commands

bool, False

Filter (smooth) incoming velocity commands to limit the acceleration

cmd_tolerance

float, 0.1

Tolerance value when checking for reaching the command in closed loop

critical_zone_angle

float, 0.1

Angle range for the emergency stop critical zone (deg)

critical_zone_distance

float, 0.05

Distance for the emergency stop critical zone (meters)

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.Component

DriveManager.

init_variables()#

Overwrites the init variables method called at Node init

execute_cmd_open_loop(cmd: geometry_msgs.msg.Twist, max_time: float)#

Execute a control command in open loop

Parameters:
  • cmd (Twist) – Velocity Twist message

  • max_time (float) – Maximum time for the open loop execution (s)

execute_cmd_closed_loop(cmd: 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)

move_forward(max_distance: float) bool#

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

Return type:

bool

move_backward(max_distance: float) bool#

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

Return type:

bool

rotate_in_place(max_rotation: float, safety_margin: Optional[float] = None) bool#

Rotates the robot in place if a safety margin around the robot is clear

Parameters:

safety_margin (Optional[float], optional) – Margin clear of obstacles to perform rotation, if None defaults to 5% of the robot_radius

Returns:

If the movement action is performed

Return type:

bool

move_to_unblock(max_distance_forward: Optional[float] = None, max_distance_backwards: Optional[float] = None, max_rotation: float = np.pi / 4, rotation_safety_margin: Optional[float] = None) bool#

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

Return type:

bool

property robot: kompass.config.RobotConfig#
property run_type: kompass.config.ComponentRunType#
property inputs_keys: List[kompass.components.defaults.TopicsKeys]#
property outputs_keys: List[kompass.components.defaults.TopicsKeys]#
inputs(**kwargs)#
outputs(**kwargs)#
config_from_yaml(config_file: str)#
property odom_tf_listener: Optional[ros_sugar.tf.TFListener]#
property scan_tf_listener: ros_sugar.tf.TFListener#
property depth_tf_listener: ros_sugar.tf.TFListener#
get_transform_listener(src_frame: str, goal_frame: str) ros_sugar.tf.TFListener#
in_topic_name(key: Union[str, kompass.components.defaults.TopicsKeys]) Union[str, List[str], None]#
out_topic_name(key: Union[str, kompass.components.defaults.TopicsKeys]) Union[str, List[str], None]#
get_in_topic(key: Union[str, kompass.components.defaults.TopicsKeys]) Union[kompass.components.ros.Topic, List[kompass.components.ros.Topic], None]#
get_out_topic(key: Union[str, kompass.components.defaults.TopicsKeys]) Union[kompass.components.ros.Topic, List[kompass.components.ros.Topic], None]#
get_callback(key: Union[str, kompass.components.defaults.TopicsKeys], idx: int = 0) Optional[kompass.callbacks.GenericCallback]#
get_publisher(key: Union[str, kompass.components.defaults.TopicsKeys], idx: int = 0) ros_sugar.io.Publisher#
callbacks_inputs_check(inputs_to_check: Optional[List[str]] = None, inputs_to_exclude: Optional[List[str]] = None) bool#