irsim.world.object_base#

Classes#

ObjectInfo

Snapshot of an object's public state used by behaviors and planners.

ObstacleInfo

Geometry and motion snapshot exposed for collision-aware behaviors.

ObjectBase

Base class representing a generic object in the robot simulator.

Module Contents#

class irsim.world.object_base.ObjectInfo[源代码]#

Snapshot of an object's public state used by behaviors and planners.

Behavior functions receive this structure instead of the full object when only immutable configuration-style fields are needed. Additional fields can be attached with add_property() for custom behaviors.

id: int#
shape: str#
kinematics: str#
role: str#
color: str#
static: bool#
goal: numpy.ndarray#
vel_min: numpy.ndarray#
vel_max: numpy.ndarray#
acce: numpy.ndarray#
angle_range: numpy.ndarray#
goal_threshold: float#
wheelbase: float#
G: numpy.ndarray#
h: numpy.ndarray#
cone_type: str#
convex_flag: bool#
name: str#
add_property(key, value)[源代码]#

Attach an additional field to this info snapshot.

class irsim.world.object_base.ObstacleInfo[源代码]#

Geometry and motion snapshot exposed for collision-aware behaviors.

center: numpy.ndarray#
vertex: numpy.ndarray | None#
velocity: numpy.ndarray#
radius: float#
G: numpy.ndarray#
h: numpy.ndarray#
cone_type: str#
convex_flag: bool#
add_property(key, value)[源代码]#

Attach an additional field to this obstacle snapshot.

class irsim.world.object_base.ObjectBase(shape: dict | None = None, kinematics: dict | None = None, state: list | None = None, velocity: list | None = None, goal: list | None = None, role: str = 'obstacle', color: str = 'k', static: bool = False, vel_min: list | None = None, vel_max: list | None = None, acce: list | None = None, angle_range: list | None = None, behavior: dict | None = None, group_behavior: dict | None = None, goal_threshold: float = 0.1, sensors: dict | None = None, arrive_mode: str = 'position', description: str | None = None, group: int = 0, group_name: str | None = None, state_dim: int | None = None, vel_dim: int | None = None, unobstructed: bool = False, fov: float | None = None, fov_radius: float | None = None, name: str | None = None, **kwargs)[源代码]#

Base class representing a generic object in the robot simulator.

This class encapsulates common attributes and behaviors for all objects, including robots and obstacles, managing their state, velocity, goals, and kinematics.

参数:
  • shape (dict) -- Parameters defining the shape of the object for geometry creation. The dictionary should contain keys and values required by the GeometryFactory to create the object's geometry, including name (for example, circle or rectangle) and associated parameters. If omitted, a circle with radius 1 is created; an explicit {"name": "circle"} uses radius 0.2.

  • kinematics (dict) -- Parameters defining the kinematics of the object. Includes kinematic model and any necessary parameters. If None, no kinematics model is applied. Defaults to None.

  • state (list of float) -- Initial state vector [x, y, theta, ...]. The state can have more dimensions depending on state_dim. Excess dimensions are truncated, and missing dimensions are filled with zeros. Defaults to [0, 0, 0].

  • velocity (list of float) -- Initial velocity vector [vx, vy] or according to the kinematics model. Defaults to [0, 0].

  • goal (list of float or list of list of float) -- Goal state vector [x, y, theta, ...] or [[x, y, theta], [x, y, theta], ...] for multiple goals Used by behaviors to determine the desired movement. Defaults to None.

  • role (str) -- Role of the object in the simulation, e.g., "robot" or "obstacle". Defaults to "obstacle".

  • color (str) -- Color of the object when plotted. Defaults to "k" (black).

  • static (bool) -- Indicates if the object is static (does not move). Defaults to False.

  • vel_min (list of float) -- Minimum velocity limits for each control dimension. Used to constrain the object's velocity. Defaults to [-1, -1].

  • vel_max (list of float) -- Maximum velocity limits for each control dimension. Used to constrain the object's velocity. Defaults to [1, 1].

  • acce (list of float) -- Acceleration limits, specifying the maximum change in velocity per time step. Defaults to [inf, inf].

  • angle_range (list of float) -- Allowed range of orientation angles [min, max] in radians. The object's orientation will be wrapped within this range. Defaults to [-pi, pi].

  • behavior (dict or str) -- Behavioral mode or configuration of the object. Can be a behavior name (str) or a dictionary with behavior parameters. If None and no group behavior is configured, the object remains static unless an external velocity is supplied.

  • group_behavior (dict) -- Shared behavior defaults for objects in the same group. When an object's own behavior configuration is empty or missing, the group behavior will be used as a fallback and exposed via beh_config.

  • goal_threshold (float) -- Threshold distance to determine if the object has reached its goal. When the object is within this distance to the goal, it's considered to have arrived. Defaults to 0.1.

  • sensors (list of dict) -- List of sensor configurations attached to the object. Each sensor configuration is a dictionary specifying sensor type and parameters. Defaults to None.

  • arrive_mode (str) -- Mode for arrival detection, either "position" or "state". Determines how arrival at the goal is evaluated. Defaults to "position".

  • description (str) -- Description or label for the object. Can be used for identification or attaching images in plotting. Defaults to None.

  • group (int) -- Group identifier for organizational purposes, allowing objects to be grouped. Defaults to 0.

  • state_dim (int) -- Dimension of the state vector. If None, it is inferred from the class attribute state_shape. Defaults to None.

  • vel_dim (int) -- Dimension of the velocity vector. If None, it is inferred from the class attribute vel_shape. Defaults to None.

  • unobstructed (bool) -- Indicates if the object should be considered to have an unobstructed path, ignoring obstacles in certain scenarios. Defaults to False.

  • fov (float) -- Field of view angles in radians for the object's sensors. Defaults to None. If set lidar, the default value is angle range of lidar.

  • fov_radius (float) -- Field of view radius for the object's sensors. Defaults to None. If set lidar, the default value is range_max of lidar.

  • **kwargs --

    Additional keyword arguments for extended functionality.

    • plot (dict): Plotting options for the object. May include 'show_goal', 'show_text', 'show_arrow', 'show_uncertainty', 'show_trajectory', 'trail_freq', etc.

抛出:

ValueError -- If dimension parameters do not match the provided shapes or if input parameters are invalid.

变量:
  • state_dim (int) -- Dimension of the state vector.

  • state_shape (tuple) -- Shape of the state array.

  • vel_dim (int) -- Dimension of the velocity vector.

  • vel_shape (tuple) -- Shape of the velocity array.

  • state (np.ndarray) -- Current state of the object.

  • _init_state (np.ndarray) -- Initial state of the object.

  • _velocity (np.ndarray) -- Current velocity of the object.

  • _init_velocity (np.ndarray) -- Initial velocity of the object.

  • _goal (np.ndarray) -- Goal state of the object.

  • _init_goal (np.ndarray) -- Initial goal state of the object.

  • _geometry (any) -- Geometry representation of the object.

  • group (int) -- Group identifier for the object.

  • stop_flag (bool) -- Flag indicating if the object should stop.

  • arrive_flag (bool) -- Flag indicating if the object has arrived at the goal.

  • collision_flag (bool) -- Flag indicating a collision has occurred.

  • unobstructed (bool) -- Indicates if the object has an unobstructed path.

  • static (bool) -- Indicates if the object is static.

  • vel_min (np.ndarray) -- Minimum velocity limits.

  • vel_max (np.ndarray) -- Maximum velocity limits.

  • color (str) -- Color of the object.

  • role (str) -- Role of the object (e.g., "robot", "obstacle").

  • info (ObjectInfo) -- Information container for the object.

  • wheelbase (float) -- Distance between the front and rear wheels. Specified for ackermann robots.

  • fov (float) -- Field of view angles in radians.

  • fov_radius (float) -- Field of view radius.

Initialize an ObjectBase instance.

This method sets up a new ObjectBase object with the specified parameters, initializing its geometry, kinematics, behaviors, sensors, and other properties relevant to simulation.

The initialization process includes: - Setting up geometry handlers and collision detection - Configuring kinematics models for movement - Initializing state vectors and goal management - Setting up behaviors and sensor systems - Configuring visualization and plotting options

备注

All parameters are documented in the class docstring above. Refer to the ObjectBase class documentation for detailed parameter descriptions.

抛出:

ValueError -- If dimension parameters do not match the provided shapes or if input parameters are invalid.

vel_shape = (2, 1)#
state_shape = (3, 1)#
role = 'obstacle'#
group = 0#
description = None#
color = 'k'#
classmethod reset_id_iter(start: int = 0, step: int = 1)[源代码]#

Restart the object id counter of the currently bound environment.

step(velocity: numpy.ndarray | None = None, sensor_step: bool = True, **kwargs: Any)[源代码]#

Perform a single simulation step, updating the object's state and sensors.

This method advances the object by one time step, integrating the given velocity or behavior-generated velocity to update the object's position, orientation, and other state variables. It also updates sensors and checks for collisions.

参数:
  • velocity (np.ndarray, optional) --

    Desired velocity for this step. If None, the object will use its behavior system to generate velocity. The shape and meaning depend on the kinematics model:

    • Differential: [linear_velocity, angular_velocity]

    • Omnidirectional: [velocity_x, velocity_y]

    • Ackermann: [linear_velocity, steering_angle]

  • **kwargs -- Additional parameters passed to behavior generation and processing.

返回:

The updated state vector of the object after the step. Returns the current state unchanged if the object is static or stopped.

返回类型:

np.ndarray

备注

  • Static objects (static=True) will not move and return their current state

  • Objects with stop_flag=True will halt and return their current state

  • The method automatically handles sensor updates and trajectory recording

sensor_step()[源代码]#

Update all sensors for the current state.

check_status(colliding=None)[源代码]#

Check the current status of the object, including arrival and collision detection.

This method evaluates collision detection and sets stop flags based on the collision mode. It also handles different collision modes like 'stop', 'reactive', 'unobstructed', and 'unobstructed_obstacles'.

check_arrive_status()[源代码]#

Check if the object has arrived at its goal position.

The arrival detection depends on the arrive_mode setting: - "state": Compares full state (x, y, theta) - "position": Compares only position (x, y)

Updates the arrive_flag and handles multiple goals by removing completed ones.

check_arrive(goal, threshold=None)[源代码]#

Check if the object has arrived at a given goal.

参数:
  • goal (np.ndarray) -- Goal state to check arrival against.

  • threshold (float, optional) -- Distance threshold for arrival. Defaults to self.goal_threshold if not provided.

返回:

True if the object is within the threshold, False otherwise.

返回类型:

bool

check_collision_status(colliding=None)[源代码]#

Update the collision flag and the list of colliding objects.

参数:

colliding (list, optional) -- Objects already known to intersect this one, e.g. from the environment's batched geometry query. When None the geometry tree is queried for this object alone.

check_collision(obj)[源代码]#

Check collision with another object.

参数:

obj (ObjectBase) -- Another object to check collision with.

返回:

True if collision occurs, False otherwise.

返回类型:

bool

gen_behavior_vel(velocity: numpy.ndarray | None = None) numpy.ndarray[源代码]#

Generate behavior-influenced velocity for the object.

This method adjusts the desired velocity based on the object's behavior configurations. If no desired velocity is provided (velocity is None), the method may generate a default velocity or issue warnings based on the object's role and behavior settings.

备注

Wander goal renewal (sampling a new random goal upon arrival) is handled in pre_process().

参数:

velocity (Optional[np.ndarray]) -- Desired velocity vector. If None, the method determines the velocity based on behavior configurations. Defaults to None.

返回:

Velocity vector adjusted based on behavior configurations and constraints.

返回类型:

np.ndarray

Logging:

Emits a warning if velocity is None and no behavior configuration is set for a robot.

pre_process()[源代码]#

Perform pre-processing before stepping the object.

This method is called before velocity generation and state updates. Can be overridden by subclasses to implement custom pre-processing logic.

Default behavior:
  • If wander is enabled and the object has just arrived (arrive_flag), sample a new random goal within [rl, rh] and clear arrive_flag.

  • If loop is enabled and the object has just arrived (arrive_flag), reset goals to initial waypoints and clear arrive_flag.

post_process()[源代码]#

Perform post-processing after stepping the object.

This method is called after state updates and sensor updates. Can be overridden by subclasses to implement custom post-processing logic.

mid_process(state: numpy.ndarray)[源代码]#

Process state in the middle of a step. Make sure the state is within the desired dimension.

参数:

state (np.ndarray) -- State vector.

返回:

Processed state.

返回类型:

np.ndarray

get_lidar_scan()[源代码]#

Get the lidar scan of the object.

返回:

Lidar scan data containing range and angle information.

返回类型:

dict

get_lidar_points()[源代码]#

Get the lidar scan points of the object.

返回:

Array of lidar scan points.

返回类型:

np.ndarray

get_lidar_offset()[源代码]#

Get the lidar offset relative to the object.

返回:

Lidar offset [x, y, theta] relative to the object center.

返回类型:

list

get_fov_detected_objects()[源代码]#

Detect the env objects that in the field of view.

返回:

The objects that in the field of view of the object.

返回类型:

list

fov_detect_object(detected_object: ObjectBase)[源代码]#

Detect whether the input object is in the field of view.

参数:

object -- The object that to be detected.

返回:

Whether the object is in the field of view.

返回类型:

bool

set_state(state: list | numpy.ndarray | None = None, init: bool = False)[源代码]#

Set the current state of the object.

This method updates the object's position, orientation, and other state variables. It also updates the object's geometry representation to match the new state.

参数:
  • state (Union[list, np.ndarray]) --

    The new state vector for the object. The format depends on the object's state dimension:

    • 2D objects: [x, y, theta] where theta is orientation in radians

    • 3D objects: [x, y, z, roll, pitch, yaw] or similar based on configuration

    Must match the object's state_dim dimension.

  • init (bool) -- Whether to also set this as the initial state for reset purposes. If True, the object will return to this state when reset() is called. Default is False.

抛出:

AssertionError -- If the state dimension doesn't match the expected state_dim.

示例

>>> # Set robot position and orientation
>>> robot.set_state([5.0, 3.0, 1.57])  # x=5, y=3, facing pi/2 radians
>>>
>>> # Set as initial state for resets
>>> robot.set_state([0, 0, 0], init=True)
set_velocity(velocity: list | numpy.ndarray | None = None, init: bool = False) None[源代码]#

Set the velocity of the object.

参数:
  • velocity -- The velocity of the object. Depending on the kinematics model.

  • init (bool) -- Whether to set the initial velocity (default False).

set_original_geometry(geometry: shapely.geometry.base.BaseGeometry)[源代码]#

Set the original geometry of the object.

参数:

geometry (BaseGeometry) -- Shapely geometry to use as the new original geometry. Subsequent geometry updates will be transformed from this base.

set_random_goal(obstacle_list, init: bool = False, free: bool = True, goal_check_radius: float = 0.2, range_limits: list | None = None, max_attempts: int = 100)[源代码]#

Set random goal(s) in the environment. If free set to True, the goal will be placed only in the free from obstacles part of the environment.

参数:
  • obstacle_list -- List of objects in the environment

  • init (bool) -- Whether to set the initial goal (default False).

  • free (bool) -- Whether to check that goal is placed in a position free of obstacles.

  • goal_check_radius (float) -- Radius in which to check if the goal is free of obstacles.

  • range_limits (list) -- List of lower and upper bound range limits in which to set the random goal position.

  • max_attempts (int) -- Max number of attempts to place the goal in a position free of obstacles.

set_goal(goal: list | numpy.ndarray | None = None, init: bool = False)[源代码]#

Set the goal(s) for the object to navigate towards.

This method configures the target location(s) that the object's behavior system will attempt to reach. Multiple goals can be provided for sequential navigation.

参数:
  • goal (Union[list, np.ndarray]) --

    The goal specification. Can be:

    • Single goal: [x, y, theta] for one target location

    • Multiple goals: [[x1, y1, theta1], [x2, y2, theta2], ...] for sequential targets

    • None: Clear all goals

    The theta component specifies the desired final orientation in radians.

  • init (bool) -- Whether to also set this as the initial goal for reset purposes. If True, these goals will be restored when reset() is called. Default is False.

示例

>>> # Set single goal
>>> robot.set_goal([10.0, 5.0, 0.0])  # Move to (10,5) facing East
>>>
>>> # Set multiple sequential goals
>>> waypoints = [[5, 0, 0], [10, 5, 1.57], [0, 10, 3.14]]
>>> robot.set_goal(waypoints)
>>>
>>> # Clear goals
>>> robot.set_goal(None)
append_goal(goal: list | numpy.ndarray)[源代码]#

Append a goal to the goal list.

set_laser_color(laser_indices, laser_color: str = 'cyan', alpha: float = 0.3)[源代码]#

Set the color of the lasers.

参数:
  • laser_indices (list) -- The indices of the lasers to set the color.

  • laser_color (str) -- The color to set the lasers. Default is 'cyan'.

  • alpha (float) -- The transparency of the lasers. Default is 0.3.

input_state_check(state: list, dim: int = 3)[源代码]#

Check and adjust the state to match the desired dimension.

参数:
  • state (list) -- State of the object.

  • dim (int) -- Desired dimension. Defaults to 3.

返回:

Adjusted state.

返回类型:

list

plot(ax: Any, state: numpy.ndarray | None = None, vertices: numpy.ndarray | None = None, **kwargs: Any) None[源代码]#

Plot this object through its dedicated renderer.

plot_object(ax: Any, state: numpy.ndarray | None = None, vertices: numpy.ndarray | None = None, **kwargs: Any) None[源代码]#

Draw this object's geometry or description image.

plot_object_image(ax: Any, state: numpy.ndarray | None = None, vertices: numpy.ndarray | None = None, description: str | None = None, **kwargs: Any) None[源代码]#

Draw this object's configured description image.

plot_trajectory(ax: Any, trajectory: list | None = None, keep_traj_length: int = 0, **kwargs: Any) None[源代码]#

Draw this object's trajectory.

plot_goal(ax: Any, goal_state: numpy.ndarray | None = None, vertices: numpy.ndarray | None = None, goal_color: str | None = None, goal_zorder: int | None = 1, goal_alpha: float | None = 0.5, **kwargs: Any) None[源代码]#

Draw this object's goal.

plot_text(ax: Any, state: numpy.ndarray | None = None, **kwargs: Any) None[源代码]#

Draw this object's text labels.

plot_arrow(ax: Any, state: numpy.ndarray | None = None, velocity: numpy.ndarray | None = None, arrow_theta: float | None = 0.0, arrow_length: float = 0.4, arrow_width: float = 0.6, arrow_color: str | None = None, arrow_zorder: int = 3, **kwargs: Any) None[源代码]#

Draw this object's velocity arrow.

plot_trail(ax: Any, state: numpy.ndarray | None = None, vertices: numpy.ndarray | None = None, keep_trail_length: int = 0, **kwargs: Any) None[源代码]#

Draw one historical outline for this object.

plot_fov(ax: Any, **kwargs: Any) None[源代码]#

Draw this object's field of view.

plot_uncertainty(ax: Any, **kwargs: Any) None[源代码]#

Draw this object's uncertainty visualization.

plot_clear(all: bool = False) None[源代码]#

Clear this object's artists.

done()[源代码]#

Check if the object has completed its task.

返回:

True if the task is done, False otherwise.

返回类型:

bool

reset()[源代码]#

Reset the object to its initial state.

refresh(sensor_step: bool = True)[源代码]#

Refresh state-derived attributes (geometry and sensors) without advancing the simulation. Used after reset so geometry/sensor readings reflect the current state without running a kinematic step (which would clobber _velocity and add noise drift).

参数:

sensor_step -- Whether to update attached sensors immediately. Environments pass False while refreshing all object geometries, rebuild the spatial index, then update all sensors from the same state snapshot.

remove()[源代码]#

Remove the object from the environment.

get_vel_range() tuple[numpy.ndarray, numpy.ndarray][源代码]#

Get the velocity range considering acceleration limits.

返回:

Minimum and maximum velocities.

返回类型:

tuple

get_info() ObjectInfo[源代码]#

Get object information.

返回:

Information about the object.

返回类型:

ObjectInfo

get_obstacle_info() ObstacleInfo[源代码]#

Get information about the object as an obstacle.

返回:

Obstacle-related information, including state, vertices, velocity, and radius.

返回类型:

ObstacleInfo

get_init_Gh() tuple[numpy.ndarray, numpy.ndarray][源代码]#

Get the initial generalized inequality matrices G and h for the convex object.

返回:

Tuple containing initial G matrix and h vector.

返回类型:

tuple[np.ndarray, np.ndarray]

get_Gh() tuple[numpy.ndarray, numpy.ndarray][源代码]#

Get the generalized inequality matrices G and h for the convex object.

返回:

Tuple containing G matrix and h vector.

返回类型:

tuple[np.ndarray, np.ndarray]

get_desired_omni_vel(goal_threshold=0.1, normalized=False) numpy.ndarray[源代码]#

Get the desired omnidirectional velocity of the object.

参数:
  • goal_threshold (float) -- Threshold for goal proximity.

  • normalized (bool) -- Whether to normalize the velocity.

property name: str#

Get the name of the object.

返回:

The name of the object.

返回类型:

str

property group_name: str#

Get the group name of the object.

返回:

The group name of the object.

返回类型:

str

property abbr: str#

Get the abbreviation of the object.

返回:

The abbreviation of the object.

返回类型:

str

property goal_abbr: str#

Get the goal abbreviation of the object.

返回:

The goal abbreviation of the object.

返回类型:

str

set_text(text: str | None) None[源代码]#

Set custom display text for this object.

The text will be shown on the next render when show_text is enabled. Pass None to reset back to the default abbreviation.

参数:

text -- The text string to display, or None to reset.

set_goal_text(text: str | None) None[源代码]#

Set custom display text for this object's goal.

The text will be shown on the next render when show_goal_text is enabled. Pass None to reset back to the default goal abbreviation.

参数:

text -- The text string to display, or None to reset.

property shape: str#

Get the shape name of the object.

返回:

The shape name of the object.

返回类型:

str

property z: float#

Get the z coordinate of the object. For 3D object, the z coordinate is the height of the object, for 2D object, the z coordinate is 0.

返回:

The z coordinate of the object.

返回类型:

float

property kinematics: str | None#

Get the kinematics name of the object.

返回:

The kinematics name of the object.

返回类型:

str

property geometry: shapely.geometry.base.BaseGeometry#

Get the geometry Instance of the object.

返回:

The geometry of the object.

返回类型:

shapely.geometry.base.BaseGeometry

property centroid: numpy.ndarray#

Get the centroid of the object.

返回:

The centroid of the object.

返回类型:

np.ndarray

property id: int#

Get the id of the object.

返回:

The id of the object.

返回类型:

int

property state: numpy.ndarray#

Get the state of the object.

返回:

The state of the object.

返回类型:

np.ndarray

property init_state: numpy.ndarray#

Get the initial state of the object.

返回:

The initial state of the object.

返回类型:

np.ndarray

property velocity: numpy.ndarray#

Get the velocity of the object.

返回:

The velocity of the object.

返回类型:

np.ndarray

property goal: numpy.ndarray | None#

Get the goal of the object.

返回:

The goal of the object.

返回类型:

np.ndarray

property goal_vertices: numpy.ndarray | None#

Get the goal vertices of the object.

返回:

The goal vertices of the object.

返回类型:

np.ndarray

property position: numpy.ndarray#

Get the position of the object.

返回:

The position of the object .

返回类型:

np.ndarray

property radius: float#

Get the radius of the object.

返回:

The radius of the object.

返回类型:

float

property length: float#

Get the length of the object.

返回:

The length of the object.

返回类型:

float

property width: float#

Get the width of the object.

返回:

The width of the object.

返回类型:

float

property wheelbase: float#

Get the wheelbase of the object.

返回:

The wheelbase of the object.

返回类型:

float

property radius_extend: float#

Get the radius of the object with a buffer.

返回:

The radius of the object with a buffer.

返回类型:

float

property arrive: bool#

Get the arrive flag of the object.

返回:

The arrive flag of the object.

返回类型:

bool

property collision: bool#

Get the collision flag of the object.

返回:

The collision flag of the object.

返回类型:

bool

property vertices: numpy.ndarray | None#

Get the vertices of the object.

返回:

The single-boundary vertices, or None for compound geometry.

返回类型:

np.ndarray | None

property original_vertices: numpy.ndarray | None#

Get the original vertices of the object.

返回:

Original single-boundary vertices, or None for compound geometry.

返回类型:

np.ndarray | None

property part_vertices: list[numpy.ndarray] | None#

Return current vertices for each compound part.

返回:

One (2, N) array per compound part, or None for non-compound shapes.

返回类型:

list[np.ndarray] | None

property original_part_vertices: list[numpy.ndarray] | None#

Return body-frame vertices for each compound part.

property original_geometry: shapely.geometry.base.BaseGeometry#

Get the original geometry of the object.

返回:

The original geometry of the object.

返回类型:

shapely.geometry.base.BaseGeometry

property original_centroid: numpy.ndarray#

Get the center of the object.

返回:

The center of the object.

返回类型:

np.ndarray

property original_state: numpy.ndarray#

Get the original state of the object from the original centroid.

返回:

The original state of the object.

返回类型:

np.ndarray (3,1)

property external_objects#

Get the environment objects that are not the self object.

返回:

The environment objects that are not the self object.

返回类型:

list

property ego_object#

Get the ego object (this object itself).

返回:

The ego object (this object).

返回类型:

ObjectBase

property possible_collision_objects#

Get the possible collision objects of the object from the geometry tree.

返回:

The possible collision objects that could collide with this object.

返回类型:

list

property desired_omni_vel#

Calculate the desired omnidirectional velocity.

参数:

goal_threshold (float) -- Threshold for goal proximity.

返回:

Desired velocity [vx, vy].

返回类型:

np.ndarray

property rvo_neighbors#

Get the list of RVO neighbors. :returns: List of RVO neighbor states [x, y, vx, vy, radius]. :rtype: list

property rvo_neighbor_state#

Get the RVO state for this object.

返回:

State [x, y, vx, vy, radius], with (x, y) at the geometry centroid so the disc covers the collision geometry.

返回类型:

list

property rvo_line_segments: list[list[float]]#

Get line segments for RVO line obstacle avoidance.

返回:

List of line segments [[x1, y1, x2, y2], ...] for linestring objects,

empty list for other shapes.

返回类型:

list

property rvo_state#

Get the full RVO state including desired velocity.

返回:

State [x, y, vx, vy, radius, vx_des, vy_des, theta].

返回类型:

list

property velocity_xy#

Get the velocity in x and y directions.

返回:

Velocity [vx, vy].

返回类型:

(2*1) np.ndarray

vel_world2body(velocity_xy: numpy.ndarray) numpy.ndarray[源代码]#

Convert a world-frame velocity into this object's own command frame.

Velocity commands are given in the object's own frame, while holonomic planners such as RVO, SFM and ORCA produce a world-frame velocity. This converts one into the other using the object's current state, so the caller does not have to.

omni rotates the velocity into its own frame; diff turns it into [linear, angular] through vel_world2diff(), using this object's angular limit and step time.

参数:

velocity_xy -- World-frame velocity [vx, vy] (2x1).

返回:

Velocity in the object's command frame, shaped for its kinematics.

返回类型:

np.ndarray

抛出:

NotImplementedError -- For a model whose command a world-frame velocity does not determine.

示例

>>> action = env.robot.vel_world2body(world_vel)
>>> env.step(action)
property max_speed#

Get the maximum speed of the object.

返回:

The maximum speed of the object.

返回类型:

float

property beh_config: dict[str, Any]#

Get the behavior configuration for this object with group fallback.

返回:

The per-object behavior configuration if defined and non-empty;

otherwise, the group's shared behavior configuration.

返回类型:

dict

property world_param#

Get the world parameters.

返回:

World parameters including time, control_mode,

collision_mode, step_time, and count.

返回类型:

WorldParam

property env_param#

Get the environment parameters.

返回:

Environment parameters including logger and objects.

返回类型:

EnvParam

property logger#

Get the logger of the env_param.

返回:

The logger associated in the env_param.

返回类型:

Logger

property heading#

Get the heading of the object.

返回:

The heading of the object.

返回类型:

float

property orientation#

Get the orientation of the object.

返回:

The orientation angle of the object in radians.

返回类型:

float