2D Simulator API Documentation

Sim2DSimple

Bridge between the 2D simulator and e-MDB.

class sim_2d_emdb.simple_sim.Sim2DSimple(*args: Any, **kwargs: Any)[source]

Bases: Node

A simple 2D simulator for the e-MDB experiments.

denormalize_actuation(actuation, actuation_config)[source]

Denormalizes the actuation values.

Parameters:
  • actuation (dict) – Actuation values to denormalize.

  • actuation_config (dict) – Actuation configuration.

Returns:

Denormalized actuation.

Return type:

dict

execute_action(action)[source]

Execute an action in the simulation.

Parameters:

action (dict) – The action to be executed.

get_perceptions()[source]

Get the current perceptions from the simulation and update the perception messages.

load_configuration()[source]

Load configuration from a file.

load_experiment_file_in_commander()[source]

Load the configuration file in the commander node.

Returns:

Response from the commander node indicating the success of the loading.

Return type:

core_interfaces.srv.LoadConfig.Response

new_action_service_callback(request, response)[source]

Execute a policy and publish new perceptions.

Parameters:
  • request (ROS srv defined in the config file. Typically cognitive_node_interfaces.srv.Policy.Request) – The message that contains the policy to execute.

  • response (ROS srv defined in the config file. Typically cognitive_node_interfaces.srv.Policy.Response) – Response of the success of the execution of the action.

Returns:

Response indicating the success of the action execution.

Return type:

ROS srv defined in the config file. Typically cognitive_node_interfaces.srv.Policy.Response

new_command_callback(data)[source]

Process a command received.

Parameters:

data (ROS msg defined in setup_control_channel) – The message that contais the command received.

reset_world()[source]

Reset the world to a random state.

setup_control_channel(simulation)[source]

Configure the ROS topic/service where listen for commands to be executed.

Parameters:

simulation (dict) – The params from the config file to setup the control channel.

setup_perceptions(perceptions)[source]

Configure the ROS publishers where publish perception values.

Parameters:

perceptions (dict) – The params from the config file to setup the perceptions.

world_reset_service_callback(request, response)[source]

Callback for the world reset service.

Parameters:
  • request (ROS msg defined in the config file Typically cognitive_processes_interfaces.srv.WorldReset.Request) – The message that contains the request to reset the world.

  • response (ROS msg defined in the config file. Typically cognitive_processes_interfaces.srv.WorldReset.Response) – Response of the world reset service.

Returns:

Response indicating the success of the world reset.

Return type:

ROS msg defined in the config file. Typically cognitive_processes_interfaces.srv.WorldReset.Response

Sim2DPerception

Bridge between the 2D simulator perception and e-MDB.

class sim_2d_emdb.perception.Sim2DDistancesPerception(*args: Any, **kwargs: Any)[source]

Bases: Perception

Sim2DDistancesPerception class

process_and_send_reading()[source]

Method that processes the sensor values received.

class sim_2d_emdb.perception.Sim2DPerception(*args: Any, **kwargs: Any)[source]

Bases: Perception

Sim2DPerception class

process_and_send_reading()[source]

Method that processes the sensor values received.