irsim.lib.behavior.behavior_methods#
Functions#
|
Behavior function for differential drive robot using RVO (Reciprocal Velocity Obstacles). |
|
Behavior function for differential drive robot using dash-to-goal behavior. |
|
Behavior function for omnidirectional robot using dash-to-goal behavior. |
|
Behavior function for omnidirectional robot using RVO (Reciprocal Velocity Obstacles). |
|
Behavior function for differential drive robot using the Social Force Model. |
|
Behavior function for omnidirectional robot using the Social Force Model. |
|
Behavior function for omnidirectional-angular robot using dash-to-goal behavior. |
|
Behavior function for Ackermann steering robot using dash-to-goal behavior. |
|
Compute the next world-frame velocity using the Social Force Model. |
|
Calculate the omnidirectional velocity using RVO. |
|
Calculate the differential drive velocity using RVO. |
|
Calculate the body-frame velocity to reach a goal. |
|
Calculate body-frame velocity to reach a goal. |
|
Calculate the differential drive velocity to reach a goal. |
|
Calculate the Ackermann steering velocity to reach a goal. |
Module Contents#
- irsim.lib.behavior.behavior_methods.beh_diff_rvo(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[source]#
Behavior function for differential drive robot using RVO (Reciprocal Velocity Obstacles).
- Parameters:
ego_object – The ego robot object.
external_objects (list) – List of external objects in the environment.
**kwargs – Additional keyword arguments: - vxmax (float): Maximum x velocity, default 1.5. - vymax (float): Maximum y velocity, default 1.5. - acce (float): Acceleration factor, default 1.0. - factor (float): Additional scaling factor, default 1.0. - mode (str): RVO calculation mode, default “rvo”. - neighbor_threshold (float): Neighbor threshold distance, default 10.0.
- Returns:
Velocity [linear, angular] (2x1) for differential drive.
- Return type:
np.array
- irsim.lib.behavior.behavior_methods.beh_diff_dash(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[source]#
Behavior function for differential drive robot using dash-to-goal behavior.
- Parameters:
ego_object – The ego robot object.
external_objects (list) – List of external objects in the environment.
**kwargs – Additional keyword arguments: - angle_tolerance (float): Allowable angular deviation, default 0.1.
- Returns:
Velocity [linear, angular] (2x1) for differential drive.
- Return type:
np.array
- irsim.lib.behavior.behavior_methods.beh_omni_dash(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[source]#
Behavior function for omnidirectional robot using dash-to-goal behavior.
- Parameters:
ego_object – The ego robot object.
external_objects (list) – List of external objects in the environment.
**kwargs – Additional keyword arguments (currently unused).
- Returns:
Velocity [vx, vy] (2x1) for omnidirectional drive.
- Return type:
np.array
- irsim.lib.behavior.behavior_methods.beh_omni_rvo(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[source]#
Behavior function for omnidirectional robot using RVO (Reciprocal Velocity Obstacles).
- Parameters:
ego_object – The ego robot object.
external_objects (list) – List of external objects in the environment.
**kwargs – Additional keyword arguments: - vxmax (float): Maximum x velocity, default 1.5. - vymax (float): Maximum y velocity, default 1.5. - acce (float): Acceleration factor, default 1.0. - factor (float): Additional scaling factor, default 1.0. - mode (str): RVO calculation mode, default “rvo”. - neighbor_threshold (float): Neighbor threshold distance, default 3.0.
- Returns:
Velocity [vx, vy] (2x1) for omnidirectional drive.
- Return type:
np.array
- irsim.lib.behavior.behavior_methods.beh_diff_sfm(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[source]#
Behavior function for differential drive robot using the Social Force Model.
- Parameters:
ego_object – The ego robot object.
external_objects (list) – List of external objects in the environment.
**kwargs – SFM tuning parameters; see
SFMVelocity().
- Returns:
Velocity [linear, angular] (2x1) for differential drive.
- Return type:
np.array
- irsim.lib.behavior.behavior_methods.beh_omni_sfm(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[source]#
Behavior function for omnidirectional robot using the Social Force Model.
- Parameters:
ego_object – The ego robot object.
external_objects (list) – List of external objects in the environment.
**kwargs – SFM tuning parameters; see
SFMVelocity().
- Returns:
Velocity [vx, vy] (2x1) for omnidirectional drive.
- Return type:
np.array
- irsim.lib.behavior.behavior_methods.beh_omni_angular_dash(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[source]#
Behavior function for omnidirectional-angular robot using dash-to-goal behavior.
- Parameters:
ego_object – The ego robot object.
external_objects (list) – List of external objects in the environment.
**kwargs – Additional keyword arguments: - angle_tolerance (float): Allowable angular deviation, default 0.1.
- Returns:
Velocity [forward, lateral, yaw_rate] (3x1) in body frame.
- Return type:
np.array
- irsim.lib.behavior.behavior_methods.beh_acker_dash(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[source]#
Behavior function for Ackermann steering robot using dash-to-goal behavior.
- Parameters:
ego_object – The ego robot object.
external_objects (list) – List of external objects in the environment.
**kwargs – Additional keyword arguments: - angle_tolerance (float): Allowable angular deviation, default 0.1.
- Returns:
Velocity [linear, steering angle] (2x1) for Ackermann drive.
- Return type:
np.array
- irsim.lib.behavior.behavior_methods.SFMVelocity(state_tuple: Any, neighbor_list: list[Any] | None = None, line_segments: list[list[float]] | None = None, vmax: float = 1.5, step_time: float = 0.1, neighbor_threshold: float = 10.0, relaxation_time: float = 0.5, force_factor_desired: float = 1.0, force_factor_social: float = 2.1, force_factor_obstacle: float = 10.0, sigma_obstacle: float = 0.8, lambda_importance: float = 2.0, gamma: float = 0.35, n_angular: float = 2.0, n_velocity: float = 3.0, safety_radius: float = 0.0, **_: Any) tuple[float, float][source]#
Compute the next world-frame velocity using the Social Force Model.
Anisotropic Moussaid-Helbing (2009) variant.
- Parameters:
state_tuple – Full RVO-style state
[x, y, vx, vy, radius, vx_des, vy_des, theta].neighbor_list – Neighbour states
[[x, y, vx, vy, radius], ...].line_segments – Line obstacles
[[x1, y1, x2, y2], ...].vmax – Speed cap.
step_time – Integration step.
neighbor_threshold – Spatial cutoff for social interactions.
relaxation_time – gamma, n_angular, n_velocity: SFM tuning parameters (see
social_force_model).force_factor_* – gamma, n_angular, n_velocity: SFM tuning parameters (see
social_force_model).sigma_obstacle – gamma, n_angular, n_velocity: SFM tuning parameters (see
social_force_model).lambda_importance – gamma, n_angular, n_velocity: SFM tuning parameters (see
social_force_model).
- :paramgamma, n_angular, n_velocity: SFM tuning parameters
(see
social_force_model).
- Returns:
Updated world-frame velocity
(vx, vy).- Return type:
tuple[float, float]
- irsim.lib.behavior.behavior_methods.OmniRVO(state_tuple: Any, neighbor_list: list[Any] | None = None, vxmax: float = 1.5, vymax: float = 1.5, acce: float = 1, factor: float = 1.0, mode: str = 'rvo', neighbor_threshold: float = 3.0, line_segments: list[list[float]] | None = None) numpy.ndarray[source]#
Calculate the omnidirectional velocity using RVO.
- Parameters:
state_tuple (tuple) – Current state and orientation.
neighbor_list (list) – List of neighboring agents (default None).
vxmax (float) – Maximum x velocity (default 1.5).
vymax (float) – Maximum y velocity (default 1.5).
acce (float) – Acceleration factor (default 1).
factor (float) – Additional scaling factor (default 1.0).
mode (str) – RVO calculation mode (default “rvo”).
neighbor_threshold (float) – Neighbor threshold (default 3.0).
line_segments (list) – Line segments [[x1, y1, x2, y2], …] (default None).
- Returns:
Velocity [vx, vy] (2x1).
- Return type:
np.array
- irsim.lib.behavior.behavior_methods.DiffRVO(state_tuple: Any, neighbor_list: list[Any] | None = None, vxmax: float = 1.5, vymax: float = 1.5, acce: float = 1, factor: float = 1.0, mode: str = 'rvo', neighbor_threshold: float = 3.0, line_segments: list[list[float]] | None = None) numpy.ndarray[source]#
Calculate the differential drive velocity using RVO.
- Parameters:
state_tuple (tuple) – Current state and orientation.
neighbor_list (list) – List of neighboring agents (default None).
vxmax (float) – Maximum x velocity (default 1.5).
vymax (float) – Maximum y velocity (default 1.5).
acce (float) – Acceleration factor (default 1).
factor (float) – Additional scaling factor (default 1.0).
mode (str) – RVO calculation mode (default “rvo”).
neighbor_threshold (float) – Neighbor threshold (default 3.0).
line_segments (list) – Line segments [[x1, y1, x2, y2], …] (default None).
- Returns:
Velocity [linear, angular] (2x1).
- Return type:
np.array
- irsim.lib.behavior.behavior_methods.OmniDash(state: numpy.ndarray, goal: numpy.ndarray, max_vel: numpy.ndarray, goal_threshold: float = 0.1) numpy.ndarray[source]#
Calculate the body-frame velocity to reach a goal.
- Parameters:
state (np.array) – Current state [x, y, theta] (3x1 or 2x1).
goal (np.array) – Goal position [x, y] (2x1).
max_vel (np.array) – Maximum velocity [forward, lateral] (2x1).
goal_threshold (float) – Distance threshold to consider goal reached (default 0.1).
- Returns:
Body-frame velocity [forward, lateral] (2x1).
- Return type:
np.array
- irsim.lib.behavior.behavior_methods.OmniAngularDash(state: numpy.ndarray, goal: numpy.ndarray, max_vel: numpy.ndarray, goal_threshold: float = 0.3, angle_tolerance: float = 0.1) numpy.ndarray[source]#
Calculate body-frame velocity to reach a goal.
Drives forward and strafes laterally toward the goal while turning to face it. After arriving at the goal position, rotates in place to match the goal orientation.
- Parameters:
state (np.array) – Current state [x, y, theta] (3x1).
goal (np.array) – Goal state [x, y, theta] (3x1).
max_vel (np.array) – Maximum velocity [forward, lateral, yaw_rate] (3x1).
goal_threshold (float) – Distance threshold to consider goal reached (default 0.3).
angle_tolerance (float) – Allowable angular deviation (default 0.1).
- Returns:
Body-frame velocity [forward, lateral, yaw_rate] (3x1).
- Return type:
np.array
- irsim.lib.behavior.behavior_methods.DiffDash(state: numpy.ndarray, goal: numpy.ndarray, max_vel: numpy.ndarray, goal_threshold: float = 0.1, angle_tolerance: float = 0.2) numpy.ndarray[source]#
Calculate the differential drive velocity to reach a goal.
- Parameters:
state (np.array) – Current state [x, y, theta] (3x1).
goal (np.array) – Goal position [x, y] (2x1).
max_vel (np.array) – Maximum velocity [linear, angular] (2x1).
goal_threshold (float) – Distance threshold to consider goal reached (default 0.1).
angle_tolerance (float) – Allowable angular deviation (default 0.2).
- Returns:
Velocity [linear, angular] (2x1).
- Return type:
np.array
- irsim.lib.behavior.behavior_methods.AckerDash(state: numpy.ndarray, goal: numpy.ndarray, max_vel: numpy.ndarray, goal_threshold: float, angle_tolerance: float) numpy.ndarray[source]#
Calculate the Ackermann steering velocity to reach a goal.
- Parameters:
state (np.array) – Current state [x, y, theta] (3x1).
goal (np.array) – Goal position [x, y] (2x1).
max_vel (np.array) – Maximum velocity [linear, steering angle] (2x1).
goal_threshold (float) – Distance threshold to consider goal reached.
angle_tolerance (float) – Allowable angular deviation.
- Returns:
Velocity [linear, steering angle] (2x1).
- Return type:
np.array