Experimental run#
#include "navground/sim/experimental_run.h"
- Group together parameters to run an experimental run. - Public Members - Simulation time step 
 - Maximal number of steps to perform 
 - Whether to terminate when no progress is possible 
 
- Holds the configuration to record sensing during an experimental run. - Public Members - The name of the dataset group 
 - The sensor to record, if none, it will the record the behavior sensing state 
 - The indices of the agents to record 
 
- Holds the configuration to record neighbors during an experimental run. - Public Members - Whether to record neighbors or not 
 - The number of neighbors to record. If more, it will record the nearest - numberrecord. If fewer, it will pads with zeros.
 - Whether to use a frame relative to the agent or the absolute frame. 
 
- Holds which data to record during an experimental run. - Public Functions - Sets all to record or not record. - Parameters:
- value – [in] The desired value 
 
 - Add a sensor to be recorded. - Parameters:
- name – [in] The name of the group 
- sensor – [in] The sensor to record 
- agent_indices – [in] The agent indices whose sensing to record 
 
 
 - Public Members - Whether to record the simulation time 
 - Whether to record the agents poses 
 - Whether to record the agents twists 
 - Whether to record the agents control commands 
 - Whether to record the agents actuated control commands 
 - Whether to record the agents targets 
 - Whether to record collisions 
 - Whether to record safety violations 
 - Whether to record data from task events 
 - Whether to record the time since when agents are stuck 
 - Whether to record efficacy (i.e., fraction of actual velocity vs optimal velocity) 
 - Whether to record the initial world state (as YAML) 
 - Whether and how to record neighbors 
 - Whether to use uid as keys for sensing and task events. Else it will use the agent index. 
 - The sensors to record 
 - Public Static Functions - Sets all to record or not record. - Returns:
- The configuration. 
 
 
- Simulates a world and collects data. - Public Types - The state of the run. - Values: - The run is ready to be executed 
 - The run is being executed 
 - The run has finished executing 
 
 - Time point 
 - Public Functions - Construct an ExperimentalRun. - Parameters:
- world – [in] The world to simulate 
- run_config – [in] The run configuration 
- record_config – [in] The record configuration 
- seed – [in] The seed used to initialize the world 
 
 
 - Construct an ExperimentalRun. - Parameters:
- world – [in] The world to simulate 
- time_step – [in] The duration of a simulation step 
- max_steps – [in] The maximum number of steps to perform 
- terminate_when_all_idle_or_stuck – [in] Whether to terminate when all agents idle or stuck 
- record_config – [in] The record configuration 
- seed – [in] The seed used to initialize the world 
 
 
 - Gets the real-time duration of the run. - Returns:
- The duration in ns or 0 if the run is not yet finished. 
 
 - Gets when the simulation started. - Returns:
- The begin stamp 
 
 - Gets when the simulation finished. - Returns:
- The end stamp 
 
 - Returns the simulated world. - Returns:
- The simulated world. 
 
 - Whether the run is finished. - Returns:
- True if finished, False otherwise. 
 
 - Whether the run is running. - Returns:
- True if running, False otherwise. 
 
 - Whether the run is running or has already finished. - Returns:
- True if started, False otherwise. 
 
 - Gets the simulation state. - Returns:
- The state. 
 
 - Gets the time step used for simulation. - Returns:
- The time step. 
 
 - Gets the maximal number of steps to simulate. - Returns:
- The maximal number of steps. 
 
 - Gets whether to terminate when all agents are idle or stuck. - Returns:
- Whether to terminate when all agents are idle or stuck. 
 
 - Gets the record associated to a given key. - Parameters:
- key – [in] The key 
- Returns:
- The record or null if none is found. 
 
 - Gets the records. - Parameters:
- group – [in] If specified, limits to records in a given group. 
- Returns:
- The records 
 
 - Gets the recorded times. - Returns:
- The record or none if not recorded. 
 
 - Gets the recorded poses. - Returns:
- The record or none if not recorded. 
 
 - Gets the recorded twists. - Returns:
- The record or none if not recorded. 
 
 - Gets the recorded commands. - Returns:
- The record or none if not recorded. 
 
 - Gets the recorded actuated commands. - Returns:
- The record or none if not recorded. 
 
 - Gets the recorded targets. - Returns:
- The record or none if not recorded. 
 
 - Gets the recorded safety margin violations. - Returns:
- The record or none if not recorded. 
 
 - Gets the recorded collisions. - Returns:
- The record or none if not recorded. 
 
 - Gets the recorded collisions events, i.e. collisions separated by more than min_interval steps. - Parameters:
- min_interval – [in] The minimal interval between collision among the same pair to be considered a new event 
- Returns:
- The record or none if not recorded. 
 
 - Gets the steps to the next recorded collision for each agent at each simulation step. - Parameters:
- min_interval – [in] The minimal interval between collision among the same pair to be considered a new event 
- Returns:
- A dataset of shape - {#steps, #agents}.
 
 - Gets the recorded task logs. - Returns:
- The records (empty if not recorded). 
 
 - Gets the recorded task logs. - Parameters:
- uid – [in] The agent uid or index (if RecordConfig::use_agent_uid_as_key is not set) 
- Returns:
- The record or none if not recorded. 
 
 - Gets the recorded sensing. - Returns:
- The dictionary {id -> {key: sensing data}. 
 
 - Gets the recorded sensing. - Parameters:
- id – [in] The agent uid or index (if RecordConfig::use_agent_uid_as_key is not set) 
- Returns:
- The dictionary {key: sensing data} 
 
 - Gets the recorded deadlocks. - Returns:
- The record or none if not recorded. 
 
 - Gets the recorded efficacy. - Returns:
- The record or none if not recorded. 
 
 - Gets the recorded neighbors. - Returns:
- The record or none if not recorded. 
 
 - Gets the number of recorded steps. - Returns:
- The recorded steps. 
 
 - Gets the recorded number of agents. - Gets the seed used to initialize the simulation. - Returns:
- The number of agents. 
- Returns:
- The seed. 
 
 - Gets a copy of the record configuration. - Returns:
- The record configuration. 
 
 - Associate an index to a given agent. - Data related to agents is stored in this order. For example, poses at a given time step are stored as - [[x_0, y_0, z_0], [x_1, y_1, z_1], ...]- where the pose of agent a is at the index returned by this function. - Parameters:
- agent – [in] The agent 
- Returns:
- The index of data related to this agent. 
 
 - Signals that has simulation has started. - Note that this won’t neither execute the simulation nor record data. It will just record the a time stamp and change the state to running. - You don’t need to call start, update, stop, or run when running an Experiment (see Experiment::run instead) but only if you are want to perform a run outside of an Experiment. - Either call start -> update periodically after manually advancing the simulation -> stop, or run once, which does perform all the steps automatically. 
 - Signals that data needs to be updated. - Note that this won’t execute the simulation. Use it only between start and stop calls to collect data about the current world state. - Note that after the maximal number of steps has been recorded, it won’t record any more data. 
 - Signals that has simulation has stopped. - Call this after start to stop the recording of a simulation. - You don’t need to call start, update, stop, or run when running an Experiment (see Experiment::run instead) but only if you are want to perform a run outside of an Experiment. 
 - Runs a simulation and automatically record data step by step. - You don’t need to call start, update, stop beside run as run manages all the simulation and recording. - You don’t need to call run when running an Experiment (see Experiment::run instead) but only if you are want to perform a run outside of an Experiment. 
 - Determines if a record is present. - Parameters:
- key – [in] The key 
- group – [in] An optional group. If specified, the record with be associated to the key - <group>/<key>.
 
- Returns:
- True if a record is associated with the key, False otherwise. 
 
 - Adds a record. - Parameters:
- key – [in] The key 
- group – [in] An optional group. If specified, the record with be associated to the key - <group>/<key>.
- force – [in] If specified, it will replace the record associated with the key, if already present. 
 
- Returns:
- The created record 
 
 - Add a record. - Parameters:
- ds – [in] The dataset 
- key – [in] The key associated to the record 
- group – [in] The group associated to the record. If provided, the effective key will be - <group>/<key>
- force – [in] Whether to replace a record if already existing for this key. 
 
 
 - Adds a probe. - Parameters:
- probe – [in] The probe 
 
 - Adds a record probe. - Parameters:
- key – [in] The key of the record to be created 
- force – [in] If specified, it will replace the record associated with the key, if already present. 
 
- Template Parameters:
- T – The probe class. 
 
 - Adds a group record probe. - Parameters:
- key – [in] The key of the group to be created 
- Template Parameters:
- T – The probe class. 
 
 - Gets the names of records. - Parameters:
- group – [in] An optional group. If specified, the looks for record associated to keys - <group>/....
- Returns:
- The record names (relative to the group if specified). 
 
 - Gets the record keys in a group. - Parameters:
- name – [in] The group name 
- Returns:
- A map of record keys - {<key>: name/<key>}indexed by keys relative to a group
 
 - Gets the YAML representation of the world at the begin of the simulation.. - Returns:
- The YAML string. 
 
 - Try to advance the world to a given recorded step. - Depending if the data has been recorded, it will update: - poses 
- twists 
- cmds 
- targets 
- sensing 
- time 
- collisions 
 - Parameters:
- step – [in] The step. Negative steps are interpreted as relative to the last registered step, i.e., -1 is the last step. 
- ignore_collisions – [in] Whether to skip setting collisions 
- ignore_twists – [in] Whether to skip setting twists 
- ignore_cmds – [in] Whether to skip setting [last] commands 
- ignore_targets – [in] Whether to skip setting targets 
- ignore_sensing – [in] Whether to skip setting sensing 
 
- Returns:
- True if the operation was possible and false otherwise. 
 
 - Resets the run. 
 - Gets recorded collisions at a given step. - Parameters:
- step – [in] The step. Negative steps are interpreted as relative to the last registered step, i.e., -1 is the last step. 
- Returns:
- The set of colliding entity pairs. 
 
 - Gets the last recorded simulation time. - Returns:
- The simulation time 
 
 - Gets the rectangle that contains the world during the whole run. - Returns:
- The bounding box. 
 
 - Public Static Functions - Decode a target from data stored by a run. - Parameters:
- data – [in] The data 
- Returns:
- The target 
 
 - Encode a target to be stored by a run. - Parameters:
- target – [in] The target 
- Returns:
- The data