Create a 2D pedestrian
[1]:
import pprint
import configuration.utils.constants as cst
from configuration.models.agents import Agent
from configuration.models.measures import AgentMeasures
# Define the type of agent to be created (e.g., pedestrian)
agent_type = cst.AgentTypes.pedestrian
# Define a dictionary containing measurements specific to the agent type
measures = {
"sex": "male", # Specify the sex of the agent
"bideltoid_breadth": 45.0, # Shoulder breadth (cm)
"chest_depth": 25.0, # Chest depth (cm)
"height": 180.0, # Height of the agent (cm)
"weight": 75.0, # Weight of the agent (kg)
}
# Create an instance of AgentMeasures using the defined agent type and measurements
agent_measures = AgentMeasures(agent_type=agent_type, measures=measures)
# Create an instance of Agent using the defined agent type and measures object
current_agent = Agent(agent_type=agent_type, measures=agent_measures)
# Retrieve additional parameters for 2D shapes associated with the current agent (in meters)
shapes2D_dict = current_agent.shapes2D.get_additional_parameters()
[2]:
pprint.pprint(shapes2D_dict)
{'disk0': {'material': 'human_naked',
'radius': 0.087,
'type': 'disk',
'x': -0.017,
'y': 0.138},
'disk1': {'material': 'human_naked',
'radius': 0.119,
'type': 'disk',
'x': 0.01,
'y': 0.061},
'disk2': {'material': 'human_naked',
'radius': 0.125,
'type': 'disk',
'x': 0.015,
'y': 0.0},
'disk3': {'material': 'human_naked',
'radius': 0.119,
'type': 'disk',
'x': 0.01,
'y': -0.061},
'disk4': {'material': 'human_naked',
'radius': 0.087,
'type': 'disk',
'x': -0.017,
'y': -0.138}}