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[源代码]#
Behavior function for differential drive robot using RVO (Reciprocal Velocity Obstacles).
- 参数:
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.
- 返回:
Velocity [linear, angular] (2x1) for differential drive.
- 返回类型:
np.array
- irsim.lib.behavior.behavior_methods.beh_diff_dash(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[源代码]#
Behavior function for differential drive robot using dash-to-goal behavior.
- 参数:
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.
- 返回:
Velocity [linear, angular] (2x1) for differential drive.
- 返回类型:
np.array
- irsim.lib.behavior.behavior_methods.beh_omni_dash(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[源代码]#
Behavior function for omnidirectional robot using dash-to-goal behavior.
- 参数:
ego_object -- The ego robot object.
external_objects (list) -- List of external objects in the environment.
**kwargs -- Additional keyword arguments (currently unused).
- 返回:
Velocity [vx, vy] (2x1) for omnidirectional drive.
- 返回类型:
np.array
- irsim.lib.behavior.behavior_methods.beh_omni_rvo(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[源代码]#
Behavior function for omnidirectional robot using RVO (Reciprocal Velocity Obstacles).
- 参数:
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.
- 返回:
Velocity [vx, vy] (2x1) for omnidirectional drive.
- 返回类型:
np.array
- irsim.lib.behavior.behavior_methods.beh_diff_sfm(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[源代码]#
Behavior function for differential drive robot using the Social Force Model.
- 参数:
ego_object -- The ego robot object.
external_objects (list) -- List of external objects in the environment.
**kwargs -- SFM tuning parameters; see
SFMVelocity().
- 返回:
Velocity [linear, angular] (2x1) for differential drive.
- 返回类型:
np.array
- irsim.lib.behavior.behavior_methods.beh_omni_sfm(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[源代码]#
Behavior function for omnidirectional robot using the Social Force Model.
- 参数:
ego_object -- The ego robot object.
external_objects (list) -- List of external objects in the environment.
**kwargs -- SFM tuning parameters; see
SFMVelocity().
- 返回:
Velocity [vx, vy] (2x1) for omnidirectional drive.
- 返回类型:
np.array
- irsim.lib.behavior.behavior_methods.beh_omni_angular_dash(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[源代码]#
Behavior function for omnidirectional-angular robot using dash-to-goal behavior.
- 参数:
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.
- 返回:
Velocity [forward, lateral, yaw_rate] (3x1) in body frame.
- 返回类型:
np.array
- irsim.lib.behavior.behavior_methods.beh_acker_dash(ego_object: Any, external_objects: list[Any], **kwargs: Any) numpy.ndarray[源代码]#
Behavior function for Ackermann steering robot using dash-to-goal behavior.
- 参数:
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.
- 返回:
Velocity [linear, steering angle] (2x1) for Ackermann drive.
- 返回类型:
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][源代码]#
Compute the next world-frame velocity using the Social Force Model.
Anisotropic Moussaid-Helbing (2009) variant.
- 参数:
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 -- SFM tuning parameters (see
social_force_model).force_factor_* -- SFM tuning parameters (see
social_force_model).sigma_obstacle -- SFM tuning parameters (see
social_force_model).lambda_importance -- SFM tuning parameters (see
social_force_model).gamma -- SFM tuning parameters (see
social_force_model).n_angular -- SFM tuning parameters (see
social_force_model).n_velocity -- SFM tuning parameters (see
social_force_model).
- 返回:
Updated world-frame velocity
(vx, vy).- 返回类型:
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[源代码]#
Calculate the omnidirectional velocity using RVO.
- 参数:
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).
- 返回:
Velocity [vx, vy] (2x1).
- 返回类型:
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[源代码]#
Calculate the differential drive velocity using RVO.
- 参数:
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).
- 返回:
Velocity [linear, angular] (2x1).
- 返回类型:
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[源代码]#
Calculate the body-frame velocity to reach a goal.
- 参数:
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).
- 返回:
Body-frame velocity [forward, lateral] (2x1).
- 返回类型:
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, angular_acce: float = float('inf'), dt: float = 0.0) numpy.ndarray[源代码]#
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.
The yaw rate is ramped down near the target so the robot can decelerate to a stop within the remaining angle. The ramp uses the exact discrete-time formula
ω ≤ -a·dt + √(a²·dt² + 2·a·remaining)so the robot stops cleanly within one step ofangle_tolerancewithout overshoot.- 参数:
state (np.array) -- Current state [x, y, theta] (3x1).
goal (np.array) -- Goal state [x, y, theta] (3x1).
max_vel (np.array) -- Absolute 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).
angular_acce (float) -- Angular acceleration limit (rad/s^2). Used to cap yaw rate so the robot can always stop within the remaining angle.
inf(default) gives bang-bang behaviour.dt (float) -- Simulation time step (s). Used for exact discrete-time decel ramp. 0 (default) falls back to the continuous-time approximation.
- 返回:
Body-frame velocity [forward, lateral, yaw_rate] (3x1).
- 返回类型:
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, angular_acce: float = float('inf'), dt: float = 0.0) numpy.ndarray[源代码]#
Calculate the differential drive velocity to reach a goal.
- 参数:
state (np.array) -- Current state [x, y, theta] (3x1).
goal (np.array) -- Goal position [x, y] (2x1).
max_vel (np.array) -- Absolute 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).
angular_acce (float) -- Angular acceleration limit (rad/s^2) for the decel ramp.
inf(default) gives bang-bang behaviour.dt (float) -- Simulation time step (s) for exact discrete-time decel ramp.
- 返回:
Velocity [linear, angular] (2x1).
- 返回类型:
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[源代码]#
Calculate the Ackermann steering velocity to reach a goal.
- 参数:
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.
- 返回:
Velocity [linear, steering angle] (2x1).
- 返回类型:
np.array