OmniSimulator.agent.agent.Agent
- class OmniSimulator.agent.agent.Agent(agent_id: str, name: str, location_id: str, max_grasp_limit: int = 2, properties: Dict[str, Any] | None = None)[source]
智能体类 - 表示模拟环境中的智能体
- __init__(agent_id: str, name: str, location_id: str, max_grasp_limit: int = 2, properties: Dict[str, Any] | None = None)[source]
初始化智能体
- Parameters:
agent_id – 智能体唯一ID
name – 智能体名称
location_id – 智能体初始位置ID (房间ID)
max_grasp_limit – 最大可抓取物体数量
properties – 其他属性字典,包含max_length/width/height/weight等
Methods
__init__(agent_id, name, location_id[, ...])初始化智能体
add_ability_from_object(ability, object_id)从物体获取能力
can_carry(object_properties)Check if agent can carry the object (weight limit only) Cooperative mode has no weight limit
can_grab()检查智能体是否还能抓取更多物体(数量限制)
drop_object(object_id, object_properties)放下物体
from_dict(data)从字典创建智能体对象
grab_object(object_id, object_properties)抓取物体
has_ability(ability)检查是否拥有特定能力
move_to(new_location_id)移动到新位置
remove_ability_from_object(ability, object_id)移除来自特定物体的能力
to_dict()将智能体转换为字典表示
update_near_objects([near_id, env_manager])更新智能体可交互的物体集合
- __init__(agent_id: str, name: str, location_id: str, max_grasp_limit: int = 2, properties: Dict[str, Any] | None = None)[source]
初始化智能体
- Parameters:
agent_id – 智能体唯一ID
name – 智能体名称
location_id – 智能体初始位置ID (房间ID)
max_grasp_limit – 最大可抓取物体数量
properties – 其他属性字典,包含max_length/width/height/weight等
- can_carry(object_properties: Dict[str, Any]) Tuple[bool, str][source]
Check if agent can carry the object (weight limit only) Cooperative mode has no weight limit
- update_near_objects(near_id: str | None = None, env_manager=None)[source]
更新智能体可交互的物体集合
- Parameters:
near_id – 靠近的物体ID,如果为None则只保留库存和位置
env_manager – 环境管理器实例,用于查询物体关系
- add_ability_from_object(ability: str, object_id: str) None[source]
从物体获取能力
- Parameters:
ability – 能力名称
object_id – 提供能力的物体ID
- remove_ability_from_object(ability: str, object_id: str) None[source]
移除来自特定物体的能力
- Parameters:
ability – 能力名称
object_id – 提供能力的物体ID