hbp_nrp_cle.robotsim.RobotInterface module

This module represents the interfaces for the robot (world) simulation both in terms of data exchange and control of the simulation

class IRobotCommunicationAdapter[source]

Bases: object

Represents the communication adapter to the robot

create_service_proxy(service, **config)[source]

Creates a service proxy object for the given service

Parameters
  • service – The Service

  • config – Additional configuration for the service proxy

Returns

A service proxy object

create_topic_publisher(topic, **config)[source]

Creates a publisher object for the given topic

Parameters
  • topic – The topic

  • config – Additional configuration for the publisher

Returns

A publisher object

create_topic_subscriber(topic, **config)[source]

Creates the subscription object for the given topic

Parameters
  • topic – The topic

  • config – Additional configuration for the subscriber

Returns

A subscription object

initialize(name)[source]

Initializes the robot adapter

Parameters

name – The name of the node

property published_topics

Gets the published topics for the robot communication adapter

Returns

A hash table of the communication adapters published topics

refresh_buffers(t)[source]

Refreshes the subscribed topic buffers for the given simulation time

Parameters

t – The simulation time

register_publish_topic(topic, **kwargs)[source]

Requests a publisher object for the given topic

Parameters
  • topic – The topic for which to create a publisher

  • kwargs – Additional configuration parameters

Returns

A publisher communication object

register_service_proxy(service, **kwargs)[source]

Requests a proxy object for the given service

Parameters
  • service – The service to which a proxy should be established

  • kwargs – Additional configuration parameters

Returns

A responder object that holds the current data

register_subscribe_topic(topic, **kwargs)[source]

Requests a subscription object for the given topic

Parameters
  • topic – The topic that should be subscribed

  • kwargs – Additional configuration parameters

Returns

A subscription object that holds the current data

property service_proxies

Gets the service proxies for the robot communication adapter

Returns

A hash table of the communication adapters service responses

shutdown()[source]

Closes any connections created by the adapter

property subscribed_topics

Gets the subscribed topics for the robot communication adapter

Returns

A hash table of the communication adapters subscribed topics

unregister_publish_topic(topic)[source]

Unregisters and removes the given publisher topic object.

Parameters

topic – The IRobotPublishedTopic to unregister.

unregister_service_proxies(service_proxy)[source]

Unregisters and removes the given service proxy object.

Parameters

service_proxy – The IRobotServiceProxy to unregister.

unregister_subscribe_topic(topic)[source]

Unregisters and removes the given subscriber topic object.

Parameters

topic – The IRobotSubscribedTopic to unregister.

class IRobotControlAdapter[source]

Bases: object

Represents a control adapter for the world simulation

initialize()[source]

Initializes the world simulation control adapter

property is_alive

Queries the current status of the world simulation

Returns

True, if the world simulation is alive, otherwise False

property is_paused

Queries the current status of the physics simulation

Returns

True, if the physics simulation is paused, otherwise False

reset()[source]

Resets the physics simulation

reset_world(models, lights)[source]

Resets the world excluding the robot

Parameters
  • models – A dictionary containing pairs model_name: model_sdf.

  • lights – A dictionary containing pairs light_name: light sdf.

run_step(dt)[source]

Runs the world simulation for the given CLE time step in seconds

Parameters

dt – The CLE time step in seconds

Returns

Updated simulation time, otherwise -1

run_step_async(dt)[source]

Runs the world simulation for the given CLE time step in seconds in an asynchronous manner.

Parameters

dt – The CLE time step in seconds

Returns

a Future for the result or potential exceptions of the execution

set_robots(robots)[source]

Sets the list of robots

set_time_step(time_step)[source]

Sets the physics simulation time step in seconds

Parameters

dt – The physics simulation time step in seconds

Returns

True, if the physics simulation time step is updated, otherwise False

shutdown()[source]

Shuts down the world simulation

property time_step

Gets the physics simulation time step in seconds

Parameters

dt – The physics simulation time step in seconds

Returns

The physics simulation time step in seconds

class IRobotPublishedTopic[source]

Bases: object

Represents a communication object for a published robot topic

reset(transfer_function_manager)[source]

Resets the published topic

Parameters

transfer_function_manager – The transfer function manager the publisher belongs to

Returns

The reset adapter

send_message(value)[source]

Send a message to the robot topic represented by this instance

Parameters

value – The message to be sent to the robot

class IRobotServiceProxy[source]

Bases: object

Represents a communication object for a service proxy

reset(transfer_function_manager)[source]

Resets the service proxy

Parameters

transfer_function_manager – The transfer function manager the service proxy belongs to

Returns

The reset adapter

set_request_args(*args, **kwargs)[source]

Set the request call arguments

update_value(*args, **kwargs)[source]

Call service and update response value

property value

Gets the current value of the service response

class IRobotSubscribedTopic[source]

Bases: object

Represents a communication object for a subscribed robot topic

property changed

Gets a value indicating whether the value of the subscribed topic has changed since the last time step

reset(transfer_function_manager)[source]

Resets the subscribed topic

Parameters

transfer_function_manager – The transfer function manager the subscriber belongs to

Returns

The reset adapter

property value

Gets the current value of the subscribed topic

class PreprocessedTopic(name, topic_type, pre_processing)[source]

Bases: hbp_nrp_cle.robotsim.RobotInterface.Topic

Represents a topic where pre-processing is applied to

property pre_processor

Gets the pre_processor

class Service(name, service_type)[source]

Bases: object

Represents a reference to a robot service

property name

Gets the name of the service

property service_type

Gets the type of the service

class Topic(name, topic_type)[source]

Bases: object

Represents a reference to a robot topic

property name

Gets the name of the topic

property topic_type

Gets the type of the topic